MESCIUS SPREAD for Windows Forms 17.0J サンプルコード集
シェイプの操作(移動、回転など)を禁止する

MESCIUS SPREAD for Windows Forms 17.0J サンプルコード集 > シェイプ > シェイプの操作(移動、回転など)を禁止する

デフォルトでは実行時のマウス操作によって任意のシェイプオブジェクトに対して移動や回転を行うこともできますが、あらかじめこれらを禁止しておくことでユーザーによる操作を制御することができます。

【実行例】 回転可能シェイプ

回転可能シェイプ

【実行例】 回転不可シェイプ(回転ハンドルは非表示)

回転不可シェイプ


 private void Form1_Load(object sender, System.EventArgs e)
 {

   //Textシェイプを追加します
   FarPoint.Win.Spread.DrawingSpace.TextShape text = new FarPoint.Win.Spread.DrawingSpace.TextShape();
   text.Text = "SPREAD for .NET";
   text.BackColor = Color.LightBlue;
   text.Font = new Font("Arial", 9, FontStyle.Italic);
   text.SetBounds(10, 50, 320, 60);

   //回転および移動を禁止します
   text.CanRotate = false;
   text.CanMove = FarPoint.Win.Spread.DrawingSpace.Moving.None;

   fpSpread1.ActiveSheet.AddShape(text);

 }
 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

   'Textシェイプを追加します
   Dim text As New FarPoint.Win.Spread.DrawingSpace.TextShape
   text.Text = "SPREAD for .NET"
   text.BackColor = Color.LightBlue
   text.Font = New Font("Arial", 9, FontStyle.Italic)
   text.SetBounds(10, 50, 320, 60)

   '回転および移動を禁止します
   text.CanRotate = False
   text.CanMove = FarPoint.Win.Spread.DrawingSpace.Moving.None

   FpSpread1.ActiveSheet.AddShape(text)

 End Sub