DataGridTextBoxColumn.FormatInfo 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
값의 서식이 지정되는 방법을 결정하는 데 사용되는 culture 관련 정보를 가져오거나 설정합니다.
public:
property IFormatProvider ^ FormatInfo { IFormatProvider ^ get(); void set(IFormatProvider ^ value); };
[System.ComponentModel.Browsable(false)]
public IFormatProvider FormatInfo { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.FormatInfo : IFormatProvider with get, set
Public Property FormatInfo As IFormatProvider
속성 값
IFormatProvider 클래스와 같은 CultureInfo 인터페이스를 구현하는 개체입니다.
- 특성
예제
다음 예제에서는 새 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
설명
속성을 서식 문자 DataGridTextBoxColumn 중 하나로 설정할 Format 때 속성에서 제공하는 FormatInfo 정보를 사용하여 사용할 문화권별 서식을 추가로 지정합니다. 예를 들어 속성이 Format 형식 문자 "c"(통화)로 설정된 경우 lira의 기호를 사용하도록 추가로 지정할 수 있습니다. 이렇게 하려면 이탈리아에 대한 로캘 ID를 사용하여 새 CultureInfo 개체를 만들고 속성을 새 CultureInfo 개체로 설정합니다FormatInfo.
문자 서식 지정에 대한 자세한 내용은 서식 지정 형식 및 사용자 지정 날짜 및 시간 서식 문자열을 참조하세요.