| Visual Basic (Declaration) | |
|---|---|
<CategoryAttribute("Appearance")> <DescriptionAttribute("The font of the grid element.")> <ApplyToDesignerAttribute(True)> <AmbientValueAttribute()> <LocalizableAttribute(True)> Public Property Font As Font | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As GridElement Dim value As Font instance.Font = value value = instance.Font | |
| C# | |
|---|---|
[CategoryAttribute("Appearance")] [DescriptionAttribute("The font of the grid element.")] [ApplyToDesignerAttribute(true)] [AmbientValueAttribute()] [LocalizableAttribute(true)] public Font Font {get; set;} | |
Property Value
A reference to a System.Drawing.Font object representing the font to use. If a null reference (Nothing in Visual Basic), then the parent's font is used.The following example demonstrates how to adjust the font of a grid element to make it bold:
| Visual Basic | Copy Code |
|---|---|
gridElement.Font = New Font( gridElement.Font, gridElement.Font.Style Or FontStyle.Bold ) | |
| C# | Copy Code |
|---|---|
gridElement.Font = new Font( gridElement.Font, gridElement.Font.Style | FontStyle.Bold ); | |
Because the System.Drawing.Font object is immutable (meaning that you cannot adjust any of its properties), you can only assign the Font property a new Font object. However, you can base the new font on the existing font.
If the IsFontAmbient property returns true, then the value of the Font property is inherited from its parent.
To reset the value of the Font property to its default value, DefaultFont, the ResetFont method must be called or a null reference (Nothing in Visual Basic) assigned to the Font property.
Target Platforms: Windows 2000, Windows XP SP3 Family, Windows Server 2003-2008 Family, Windows Vista, Windows 7
Copy Code