Devexpress'te Sayı, Tarih, Alfanümerik format tabloları



Format Specifier
Description
Sample Format String
Sample Output
c or C
The number is converted to a string that represents a currency amount. The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default currency precision from the current regional options is used.
c2
$1,234.00
e or E
The number is converted to a string of the form "-d.ddd...E+ddd" or "-d.ddd...e+ddd", where each 'd' indicates a digit (0-9). The string starts with a minus sign if the number is negative. One digit always precedes the decimal point. The precision specifier indicates the desired number of digits after the decimal point. If the precision specifier is omitted, a default of six digits after the decimal point is used. The case of the format specifier indicates whether to prefix the exponent with an 'E' or an 'e'. The exponent always consists of a plus or minus sign and a minimum of three digits. The exponent is padded with zeros to meet this minimum if required.
E1
1.2E+003
n or N
The number is converted to a string of the form "-d,ddd,ddd.ddd...", where each 'd' indicates a digit (0-9). The string starts with a minus sign if the number is negative. Thousand separators are inserted between each group of three digits to the left of the decimal point. The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default currency precision from the current regional options is used.
n0
1,234
x or X
The number is converted to a string of hexadecimal digits. The case of the format specifier indicates whether uppercase or lowercase characters are used for hexadecimal digits greater than 9. The precision specifier indicates the minimum number of digits in the resulting string. If required, the number is padded with zeros to its left to produce the number of digits given by the precision specifier. This format is supported for integral types only.
X8
000004D2

Standard Format Strings for Date/Time Values
Standard date and time format strings contain a single character. This character defines the pattern used to represent the value (whether or not and how to display year numbers, month numbers, etc). All the specifiers are covered in the Standard Date and Time Format Strings topic in MSDN. The following table from the MSDN article Standard Date and Time Format Strings gives some examples.
Format Specifier
Description
Sample Output
d
Short date pattern.
3/12/2003
D
Long date pattern.
Wednesday, March 12, 2003
t
Short time pattern.
12:00 AM
T
Long time pattern.
12:00:00 AM
f
Full date/time pattern (short time).
Wednesday, March 12, 2003 12:00 AM
F
Full date/time pattern (full time).
Wednesday, March 12, 2003 12:00:00 AM
g
General date/time pattern (short time).
3/12/2003 12:00 AM
G
General date/time pattern (full time).
3/12/2003 12:00:00 AM
Example 1
The following code demonstrates a way of formatting values in a DateEdit control using the Long Date pattern (when editing is disabled). The RepositoryItemDateEdit.DisplayFormat property is customized to implement this formatting type. See the Format Specifiers topic for information on format specifiers.
The result for the English (USA) culture is displayed below.
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img2876.jpg
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=dx-active-tab-left.gif
C#
VB
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=dx-inactive-tab-right.gif
using DevExpress.Utils;
// ...
dateEdit1.Properties.DisplayFormat.FormatType = FormatType.DateTime;
dateEdit1.Properties.DisplayFormat.FormatString = "D";
Custom Format Strings for Numeric Values
Custom format strings are used to construct format patterns manually. You only need to use them when the standard format strings do not meet your requirements. All format strings represented by a literal character, followed by one or two digits, are treated as standard format strings, and so all other strings are interpreted as custom format strings. The table below lists the most used characters that can construct a custom format string. Please refer to the Custom Numeric Format Strings topic in MSDN for a complete list of the characters available.
Character
Meaning
0
The digit is always displayed.
#
The digit is displayed only when needed (i.e., use to suppress leading zeros).
.
Specifies the position of the decimal point. The appearance of the point depends on regional settings.
,
Specifies the position of a comma. The appearance of the comma depends on regional settings.
Note that custom format strings can also contain other characters and they will be copied to the formatted string. This can be used to add explanatory text to the value. If you need to display one of the reserved characters, it must be preceded by the '\' symbol.
When formatting numeric values, you can apply different formats to positive, negative and zero values. To do this, the format string must contain three parts delimited by semicolons. The first part sets the positive values format, the second is applied to negative values and the third represents zero values.
Example 2
The following example demonstrates a way of representing values in a CalcEdit editor that is dependent on the sign of the values. This type of formatting is implemented using custom format specifiers. Formatting is applied via the editor's RepositoryItem.DisplayFormat property, so this affects the text in display mode only and is not in effect in edit mode. See the Format Specifierstopic for information on format specifiers.
The sample code execution result is shown in the image below.
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img2881.jpg
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=dx-active-tab-left.gif
C#
VB
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=dx-inactive-tab-right.gif
using DevExpress.Utils;
// ...
calcEdit1.Properties.DisplayFormat.FormatType = FormatType.Numeric;
calcEdit1.Properties.DisplayFormat.FormatString = "#.00;[#.0];Zero";
Custom Format Strings for Date/Time Values
To create format patterns for date and time values, you need to combine the strings listed in the tables below. These strings represent the year, month, day, number and so on in different formats.
The following table lists the most used strings that can be used to format dates. (Samples assume that the formatted date is 9/2/2003).
Symbol
Meaning
Value
yy
The last two digits of the year.
03
yyyy
Four digit year.
2003
MM
The number of the month.
09
MMM
The short text description of the month.
Sep
MMMM
The full name of the month.
September
dd
The number of the day.
02
ddd
The short text for the day of the week.
Tue
dddd
The full name of the day of the week.
Tuesday
/
Date separator. Its appearance depends on regional settings.

The next table lists strings that are used to format time values.
Symbol
Meaning
hh
Hours.
mm
Minutes.
ss
Seconds.
tt
If present, represents data in AM/PM format.
:
Time separator. Its appearance depends upon regional settings.
Note: the tables above lists only the most used format string portions. For a complete list, please refer to the Custom Date and Time Format Strings topic in MSDN.
Example 3
The following sample code demonstrates a way of formatting date/time values in a DateEditcontrol using a custom format string. See the Format Specifiers topic for information on format specifiers.
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img2882.jpg
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=dx-active-tab-left.gif
C#
VB
Açıklama: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=dx-inactive-tab-right.gif
using DevExpress.Utils;
// ...
dateEdit1.Properties.DisplayFormat.FormatType = FormatType.DateTime;
dateEdit1.Properties.DisplayFormat.FormatString = "MMM/d/yyyy hh:mm tt";


Hiç yorum yok:

BlackListIP control on Serenity platform (.NET Core)

 In the Serenity platform, if you want to block IPs that belong to people you do not want to come from outside in the .net core web project,...