PowerTools SPREAD for Windows Forms 8.0J
IsReservedLocation メソッド (EditBaseCellType)


エディタコントロールを描画するためのグラフィックデバイスインタフェース。
ポインタ位置のX座標
ポインタ位置のY座標
矩形領域の位置とサイズ
エディタコントロールの外観設定
エディタコントロールの名前を含むオブジェクト。
エディタコントロールの表示倍率を表す数値
指定されたカーソル位置に、エディタコントロールに対する特別な意味があるかどうかを判定します。
構文
'Declaration
 
Public Overrides Function IsReservedLocation( _
   ByVal g As Graphics, _
   ByVal x As Integer, _
   ByVal y As Integer, _
   ByVal rc As Rectangle, _
   ByVal appearance As Appearance, _
   ByVal value As Object, _
   ByVal zoomFactor As Single _
) As Object
'使用法
 
Dim instance As EditBaseCellType
Dim g As Graphics
Dim x As Integer
Dim y As Integer
Dim rc As Rectangle
Dim appearance As Appearance
Dim value As Object
Dim zoomFactor As Single
Dim value As Object
 
value = instance.IsReservedLocation(g, x, y, rc, appearance, value, zoomFactor)
public override object IsReservedLocation( 
   Graphics g,
   int x,
   int y,
   Rectangle rc,
   Appearance appearance,
   object value,
   float zoomFactor
)

パラメータ

g
エディタコントロールを描画するためのグラフィックデバイスインタフェース。
x
ポインタ位置のX座標
y
ポインタ位置のY座標
rc
矩形領域の位置とサイズ
appearance
エディタコントロールの外観設定
value
エディタコントロールの名前を含むオブジェクト。
zoomFactor
エディタコントロールの表示倍率を表す数値

戻り値の型

予約されている位置を含む Object
解説

zoomFactor パラメータの限度については、シートの ZoomFactor プロパティを参照してください。

次のサンプルコードは、メソッドの使用方法を説明するためにチェックボックスセル型をサブクラス化していますが、他のセル型でも同じように使用できます。
class myCkBox  : FarPoint.Win.Spread.CellType.CheckBoxCellType
{
CheckBox ckbx = new CheckBox();

public myCkBox()
{
}
new event EventHandler EditingCanceled;
new event EventHandler EditingStopped;

public override void StartEditing(EventArgs e, bool selectAll, bool autoClipboard)
{
   return;
}
public override void CancelEditing()
{
   EditingCanceled(ckbx, EventArgs.Empty);
   base.FireEditingCanceled();
}
public override bool StopEditing()
{
   if (EditingStopped != null)
   {
      EditingStopped(ckbx, EventArgs.Empty);
      base.FireEditingStopped();
      return true;
   }
   else
   {
      return false;
   }
}

public override bool IsReservedKey(KeyEventArgs e)
{
   return base.IsReservedKey(e);
}
public override object IsReservedLocation(Graphics g, int x, int y, Rectangle r, FarPoint.Win.Spread.Appearance appr, object
value, float zoom)
{
   return base.IsReservedLocation(g, x, y, r, appr, value, zoom);
}
public override Size GetPreferredSize(Graphics g, Size size, FarPoint.Win.Spread.Appearance appr, object value, float zoom)
{
   return base.GetPreferredSize(g, size, appr, value, zoom);
}
public override object Parse(string s)
{
   return base.Parse(s);
}
public override string Format(object o)
{
   return base.Format(o.ToString());
}
public override Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
{
   return ckbx;
}
public override object GetEditorValue()
{
   return ckbx.CheckState;
}
public override void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appr, object value, bool issel, bool
islocked, float zoom)
{
   GetEditorValue();
   if (ckbx.CheckState == CheckState.Checked)
   {
      ControlPaint.DrawCheckBox(g, r.X, r.Y, r.Width - 40, r.Height - 6, ButtonState.Checked);
   }
   else if (ckbx.CheckState == CheckState.Unchecked)
   {
     ControlPaint.DrawCheckBox(g, r.X, r.Y, r.Width - 40, r.Height - 6, ButtonState.Normal);
   }
}
public override void SetEditorValue(object value)
{
   ckbx.CheckState = CheckState.Checked;
}
public override Cursor GetReservedCursor(object o)
{
   return base.GetReservedCursor(o);
}
}

private void menuItem4_Click(object sender, System.EventArgs e)
{
   myCkBox ckbx = new myCkBox();
   fpSpread1.ActiveSheet.Cells[0, 0].CellType = ckbx;
}
Public Class myCkBox
Inherits FarPoint.Win.Spread.CellType.CheckBoxCellType

Dim ckbx As New CheckBox()

Sub New()

End Sub

Public Shadows Event EditingStopped(ByVal sender As Object, ByVal e As EventArgs)

Public Shadows Event EditingCancelled(ByVal sender As Object, ByVal e As EventArgs)

Public Overrides Sub StartEditing(ByVal e As EventArgs, ByVal selectAll As Boolean, ByVal autoClipboard As Boolean)
   MyBase.StartEditing(e, selectAll, autoClipboard)
End Sub

Public Overrides Sub CancelEditing()
   RaiseEvent EditingCancelled(ckbx, EventArgs.Empty)
   MyBase.FireEditingCanceled()
End Sub

Public Overrides Function StopEditing() As Boolean
   RaiseEvent EditingStopped(ckbx, EventArgs.Empty)
   MyBase.FireEditingStopped()
   Return True
End Function

Public Overrides Function IsReservedKey(ByVal e As KeyEventArgs) As Boolean
   Return MyBase.IsReservedKey(e)
End Function

Public Overrides Function IsReservedLocation(ByVal g As Graphics, ByVal x As Integer, ByVal y As Integer, ByVal r As Rectangle,
ByVal appr As FarPoint.Win.Spread.Appearance, ByVal value As Object, ByVal zoom As Single) As Object
   Return MyBase.IsReservedLocation(g, x, y, r, appr, value, zoom)
End Function

Public Overrides Function GetPreferredSize(ByVal g As Graphics, ByVal s As Size, ByVal appr As FarPoint.Win.Spread.Appearance,
ByVal value As Object, ByVal zoom As Single) As Size
   Return MyBase.GetPreferredSize(g, s, appr, value, zoom)
End Function

Public Overrides Function Parse(ByVal s As String) As Object
   Return MyBase.Parse(s)
End Function

Public Overrides Function Format(ByVal o As Object) As String
   Return MyBase.Format(o)
End Function

Public Overrides Function GetEditorControl(ByVal appr As FarPoint.Win.Spread.Appearance, ByVal zoom As Single) As Control
   Return ckbx
End Function

Public Overrides Function GetEditorValue() As Object
   Return ckbx.CheckState
End Function

Public Overrides Sub PaintCell(ByVal g As Graphics, ByVal r As Rectangle, ByVal appr As FarPoint.Win.Spread.Appearance, ByVal
Value As Object, ByVal issel As Boolean, ByVal islocked As Boolean, ByVal zoom As Single)
   GetEditorValue()
   If ckbx.CheckState = CheckState.Checked Then
      ControlPaint.DrawCheckBox(g, r.X, r.Y, r.Width - 40, r.Height - 6, ButtonState.Checked)
   ElseIf ckbx.CheckState = CheckState.Unchecked Then
      ControlPaint.DrawCheckBox(g, r.X, r.Y, r.Width - 40, r.Height - 6, ButtonState.Normal)
   End If
End Sub

Public Overrides Sub SetEditorValue(ByVal value As Object)
   ckbx.CheckState = CheckState.Checked
End Sub

Public Overrides Function GetReservedCursor(ByVal o As Object) As Cursor
   Return MyBase.GetReservedCursor(o)
End Function
End Class

Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
   Dim ckbx As New myCkBox()
   FpSpread1.ActiveSheet.Cells(0, 0).CellType = ckbx
End Sub
参照

EditBaseCellType クラス
EditBaseCellType メンバ

 

 


© 2004-2015, GrapeCity inc. All rights reserved.