DataGridTextBoxColumn.Format 속성

정의

텍스트의 서식 지정 방법을 지정하는 문자를 가져오거나 설정합니다.

public:
 property System::String ^ Format { System::String ^ get(); void set(System::String ^ value); };
public string Format { get; set; }
member this.Format : string with get, set
Public Property Format As String

속성 값

String

텍스트의 서식 지정 방법을 지정하는 문자입니다.

예제

다음 예제에서는 새 CultureInfo 개체를 만들고 개체의 DataGridTextBoxColumn 속성에 FormatInfo 할당합니다. 또한 이 예제에서는 속성을 "c"로 설정 Format 하여 열에 값을 통화로 표시하도록 지정합니다.

private:
   void ChangeColumnCultureInfo()
   {
      /* Create a new CultureInfo Object* using the
        the locale ID for Italy. */
      System::Globalization::CultureInfo^ ItalyCultureInfo = gcnew CultureInfo( 0x0410 );
      
      /* Cast a column that holds numeric values to the
        DataGridTextBoxColumn type, and set the FormatInfo
        property to the new CultureInfo Object*. */
      DataGridTextBoxColumn^ myGridTextBoxColumn =
         dynamic_cast<DataGridTextBoxColumn^>(myDataGrid->TableStyles[ "Orders" ]->
         GridColumnStyles[ "OrderAmount" ]);
      myGridTextBoxColumn->FormatInfo = ItalyCultureInfo;
      myGridTextBoxColumn->Format = "c";
   }
private void ChangeColumnCultureInfo(){
   /* Create a new CultureInfo object using the 
   the locale ID for Italy. */
   System.Globalization.CultureInfo ItalyCultureInfo= 
   new CultureInfo(0x0410);
     
   /* Cast a column that holds numeric values to the   
   DataGridTextBoxColumn type, and set the FormatInfo
   property to the new CultureInfo object. */
   DataGridTextBoxColumn myGridTextBoxColumn = 
   (DataGridTextBoxColumn) myDataGrid.TableStyles["Orders"].
   GridColumnStyles["OrderAmount"];
   myGridTextBoxColumn.FormatInfo = ItalyCultureInfo;
   myGridTextBoxColumn.Format = "c";
}
Public Class Form1:Inherits Form
private myDataGrid as DataGrid    
    Public Shared Sub Main()
        Dim t As New Form1()
        ' Write a purchase order.
    End Sub
Private Sub ChangeColumnCultureInfo()
   ' Create a new CultureInfo object using the 
   ' the locale ID for Italy. 
   Dim ItalyCultureInfo As CultureInfo = New _
   CultureInfo(&H0410)
   ' Cast a column that holds numeric values to the   
   ' DataGridTextBoxColumn type, and set the FormatInfo
   ' property to the new CultureInfo object. 
   Dim myGridTextBoxColumn As DataGridTextBoxColumn = _
   CType( myDataGrid.TableStyles("Orders"). _
   GridColumnStyles("OrderAmount"), DataGridTextBoxColumn)
   myGridTextBoxColumn.FormatInfo = ItalyCultureInfo
   myGridTextBoxColumn.Format = "c"
End Sub

설명

이 속성은 Format 열에 값이 표시되는 방식을 지정합니다. 예를 들어 속성을 "c"로 설정하여 값의 형식을 현지 통화로 지정합니다. CultureInfo 컴퓨터의 경우 실제 통화 형식을 결정하는 데 사용됩니다. 데이터가 변경될 때 값은 네이티브 형식에 자동으로 서식이 지정되지 않습니다.

문자 서식 지정에 대한 자세한 내용은 서식 지정 형식사용자 지정 날짜 및 시간 서식 문자열을 참조하세요.

적용하는 형식은 데이터 형식에 적합해야 합니다. 예를 들어 데이터가 본질적으로 숫자인 경우 숫자 형식 문자열 중 하나를 사용합니다.

적절한 문화권 ID로 DataGridTextBoxColumn 생성된 새 CultureInfo 인스턴스로 속성을 설정 FormatInfo 하여 해당 속성을 변경할 CultureInfo 수 있습니다.

설정 하는 CultureInfo 애플리케이션에 대 한 설정 합니다 CurrentCulture 의 속성을 Application 새 개체 CultureInfo 적절 한 문화권 ID를 사용 하 여 생성 되는 인스턴스

적용 대상

추가 정보