DataGridColumnStyle.Edit DataGridColumnStyle.Edit DataGridColumnStyle.Edit DataGridColumnStyle.Edit Method

정의

값을 편집할 셀을 준비합니다.Prepares the cell for editing a value.

오버로드

Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean)

편집할 셀을 준비합니다.Prepares a cell for editing.

Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String)

지정된 CurrencyManager, 행 번호 및 Rectangle 매개 변수를 사용하여 편집할 셀을 준비합니다.Prepares the cell for editing using the specified CurrencyManager, row number, and Rectangle parameters.

Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean)

파생하는 클래스에서 재정의된 경우 편집할 셀을 준비합니다.When overridden in a deriving class, prepares a cell for editing.

Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean)

편집할 셀을 준비합니다.Prepares a cell for editing.

protected public:
 virtual void Edit(System::Windows::Forms::CurrencyManager ^ source, int rowNum, System::Drawing::Rectangle bounds, bool readOnly);
protected internal virtual void Edit (System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly);
abstract member Edit : System.Windows.Forms.CurrencyManager * int * System.Drawing.Rectangle * bool -> unit
override this.Edit : System.Windows.Forms.CurrencyManager * int * System.Drawing.Rectangle * bool -> unit
Protected Friend Overridable Sub Edit (source As CurrencyManager, rowNum As Integer, bounds As Rectangle, readOnly As Boolean)

매개 변수

rowNum
Int32 Int32 Int32 Int32

편집할 행 번호입니다.The row number to edit.

bounds
Rectangle Rectangle Rectangle Rectangle

컨트롤이 위치할 경계 Rectangle입니다.The bounding Rectangle in which the control is to be sited.

readOnly
Boolean Boolean Boolean Boolean

열이 읽기 전용인지 여부를 나타내는 값입니다.A value indicating whether the column is a read-only. 값이 읽기 전용이면 true이고, 그렇지 않으면 false입니다.true if the value is read-only; otherwise, false.

설명

일반적으로 Edit 메서드 사이트 위치 편집 중인 셀의 모눈 위에 제어 합니다.Typically, the Edit method sites a control onto the grid at the location of the cell being edited.

Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String)

지정된 CurrencyManager, 행 번호 및 Rectangle 매개 변수를 사용하여 편집할 셀을 준비합니다.Prepares the cell for editing using the specified CurrencyManager, row number, and Rectangle parameters.

protected public:
 virtual void Edit(System::Windows::Forms::CurrencyManager ^ source, int rowNum, System::Drawing::Rectangle bounds, bool readOnly, System::String ^ displayText);
protected internal virtual void Edit (System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string displayText);
abstract member Edit : System.Windows.Forms.CurrencyManager * int * System.Drawing.Rectangle * bool * string -> unit
override this.Edit : System.Windows.Forms.CurrencyManager * int * System.Drawing.Rectangle * bool * string -> unit
Protected Friend Overridable Sub Edit (source As CurrencyManager, rowNum As Integer, bounds As Rectangle, readOnly As Boolean, displayText As String)

매개 변수

rowNum
Int32 Int32 Int32 Int32

편집되고 있는 이 열의 행 번호입니다.The row number in this column which is being edited.

bounds
Rectangle Rectangle Rectangle Rectangle

컨트롤이 위치할 Rectangle입니다.The Rectangle in which the control is to be sited.

readOnly
Boolean Boolean Boolean Boolean

열이 읽기 전용인지 여부를 나타내는 값입니다.A value indicating whether the column is a read-only. 값이 읽기 전용이면 true이고, 그렇지 않으면 false입니다.true if the value is read-only; otherwise, false.

displayText
String String String String

컨트롤에 표시할 텍스트입니다.The text to display in the control.

예제

다음 코드 예제에서는 합니다 Edit 에서 클릭된 된 셀의 텍스트를 변경 하는 방법의 System.Windows.Forms.DataGrid 제어 합니다.The following code example uses the Edit method to change the text of a clicked cell in the System.Windows.Forms.DataGrid control.

public ref class Form1: public Form
{
private:
   DataSet^ myDataSet;
   void dataGrid1_MouseDown( Object^ sender, MouseEventArgs^ e )
   {
      // Use the HitTest method to get a HitTestInfo object.
      System::Windows::Forms::DataGrid::HitTestInfo^ hi;
      DataGrid^ grid = dynamic_cast<DataGrid^>(sender);
      hi = grid->HitTest( e->X, e->Y );

      // Test if the clicked area was a cell.
      if ( hi->Type == DataGrid::HitTestType::Cell )
      {
         // If it's a cell, get the GridTable and CurrencyManager of the
         // clicked table.         
         DataGridTableStyle^ dgt = grid->TableStyles[ 0 ];
         CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(this->BindingContext[ myDataSet->Tables[ dgt->MappingName ] ]);

         // Get the Rectangle of the clicked cell.
         Rectangle cellRect;
         cellRect = grid->GetCellBounds( hi->Row, hi->Column );

         // Get the clicked DataGridTextBoxColumn.
         MyColumnStyle ^ gridCol = dynamic_cast<MyColumnStyle^>(dgt->GridColumnStyles[ hi->Column ]);

         // Edit the value.
         gridCol->EditVal( myCurrencyManager, hi->Row, cellRect, false, "New Text" );
      }
   }


public:
   ref class MyColumnStyle: public DataGridTextBoxColumn
   {
   public:
      void EditVal( CurrencyManager^ cm, int row, Rectangle rec, bool readOnly, String^ text )
      {
         this->Edit( cm, row, rec, readOnly, text );
      }
   };
};
public class Form1: Form
{
static void Main(){}

protected DataSet myDataSet;

private void dataGrid1_MouseDown(object sender, MouseEventArgs e)
{
    // Use the HitTest method to get a HitTestInfo object.
    System.Windows.Forms.DataGrid.HitTestInfo hi;   
    DataGrid grid = (DataGrid) sender;
    hi=grid.HitTest(e.X, e.Y);
    // Test if the clicked area was a cell.
    if (hi.Type==DataGrid.HitTestType.Cell)
    {
       // If it's a cell, get the GridTable and CurrencyManager of the
       // clicked table.         
       DataGridTableStyle dgt = grid.TableStyles[0];     
       CurrencyManager myCurrencyManager = (CurrencyManager)
       	this.BindingContext[myDataSet.Tables[dgt.MappingName]];
       // Get the Rectangle of the clicked cell.
       Rectangle cellRect;
       cellRect=grid.GetCellBounds(hi.Row, hi.Column);
       // Get the clicked DataGridTextBoxColumn.
       MyColumnStyle gridCol =(MyColumnStyle) 
       dgt.GridColumnStyles[hi.Column];
       // Edit the value.
       gridCol.EditVal(myCurrencyManager, hi.Row, cellRect, false, "New Text");
    }
 }

public class MyColumnStyle:DataGridTextBoxColumn{
	public void EditVal(CurrencyManager cm, int row, Rectangle rec, 
	bool readOnly, string text){
		this.Edit(cm, row, rec, readOnly, text);
	}
}
}
Public Class Form1
   Inherits Form

   Protected myDataSet As DataSet

   Shared Sub Main()
   End Sub
    
    Private Sub dataGrid1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
        ' Use the HitTest method to get a HitTestInfo object.
        Dim hi As System.Windows.Forms.DataGrid.HitTestInfo
        Dim grid As DataGrid = CType(sender, DataGrid)
        hi = grid.HitTest(e.X, e.Y)
        ' Test if the clicked area was a cell.
        If hi.Type = DataGrid.HitTestType.Cell Then
            ' If it's a cell, get the GridTable and CurrencyManager of the
            ' clicked table.         
            Dim dgt As DataGridTableStyle = grid.TableStyles(0)
            Dim myCurrencyManager As CurrencyManager = _
            CType(Me.BindingContext _
            (myDataSet.Tables(dgt.MappingName)), CurrencyManager)
            ' Get the Rectangle of the clicked cell.
            Dim cellRect As Rectangle
            cellRect = grid.GetCellBounds(hi.Row, hi.Column)
            ' Get the clicked DataGridTextBoxColumn.
            Dim gridCol As MyColumnStyle = CType(dgt.GridColumnStyles _
            (hi.Column), MyColumnStyle)
            ' Edit the value.
            gridCol.EditVal(myCurrencyManager, hi.Row, cellRect, False, "New Text")
        End If
    End Sub
End Class 

Public Class MyColumnStyle
   Inherits DataGridTextBoxColumn
   Public Sub EditVal(cm As CurrencyManager, row As Integer, _
   rec As Rectangle, bReadOnly As Boolean, text As String)
      MyBase.Edit(cm, row, rec, bReadOnly, text)
   End Sub
End Class

설명

일반적으로 Edit 메서드 사이트 위치 편집 중인 셀의 모눈 위에 제어 합니다.Typically, the Edit method sites a control onto the grid at the location of the cell being edited.

Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean)

파생하는 클래스에서 재정의된 경우 편집할 셀을 준비합니다.When overridden in a deriving class, prepares a cell for editing.

protected public:
 abstract void Edit(System::Windows::Forms::CurrencyManager ^ source, int rowNum, System::Drawing::Rectangle bounds, bool readOnly, System::String ^ displayText, bool cellIsVisible);
protected internal abstract void Edit (System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string displayText, bool cellIsVisible);
abstract member Edit : System.Windows.Forms.CurrencyManager * int * System.Drawing.Rectangle * bool * string * bool -> unit
Protected Friend MustOverride Sub Edit (source As CurrencyManager, rowNum As Integer, bounds As Rectangle, readOnly As Boolean, displayText As String, cellIsVisible As Boolean)

매개 변수

rowNum
Int32 Int32 Int32 Int32

편집되고 있는 이 열의 행 번호입니다.The row number in this column which is being edited.

bounds
Rectangle Rectangle Rectangle Rectangle

컨트롤이 위치할 Rectangle입니다.The Rectangle in which the control is to be sited.

readOnly
Boolean Boolean Boolean Boolean

열이 읽기 전용인지 여부를 나타내는 값입니다.A value indicating whether the column is a read-only. 값이 읽기 전용이면 true이고, 그렇지 않으면 false입니다.true if the value is read-only; otherwise, false.

displayText
String String String String

컨트롤에 표시할 텍스트입니다.The text to display in the control.

cellIsVisible
Boolean Boolean Boolean Boolean

셀을 표시할지 여부를 나타내는 값입니다.A value indicating whether the cell is visible. 셀이 표시되면 true이고, 그렇지 않으면 false입니다.true if the cell is visible; otherwise, false.

설명

일반적으로 Edit 메서드 사이트 위치 편집 중인 셀의 모눈 위에 제어 합니다.Typically, the Edit method sites a control onto the grid at the location of the cell being edited.

적용 대상