windowsforms-devexpress-dot-utils-dot-appearanceobject-9388a929.md
Gets the formatting attributes specified by the appearance object’s settings.
Namespace : DevExpress.Utils
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
public StringFormat GetStringFormat()
Public Function GetStringFormat As StringFormat
| Type | Description |
|---|---|
| StringFormat |
A StringFormat object which specifies formatting attributes, such as the line spacing and alignment.
|
The formatting attributes are specified by the text options which can be accessed via the AppearanceObject.TextOptions property.
The following code snippets (auto-collected from DevExpress Examples) contain references to the GetStringFormat() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
Color captionColor = EditorsSkins.GetSkin(viewInfo.LookAndFeel.ActiveLookAndFeel)[EditorsSkins.SkinEditorButton].Color.GetForeColor();
info.Cache.DrawString(str_value, viewInfo.Appearance.Font, new SolidBrush(captionColor), info.Bounds, info.Appearance.GetStringFormat());
return;
winforms-grid-show-editor-buttons-on-cell-hover/CS/WindowsApplication3/Form1.cs#L48
info.EditorButtonPainter.DrawObject(args);
e.Cache.DrawString(e.DisplayText, e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), textRect, e.Appearance.GetStringFormat());
e.Handled = true;
a.GetFont(),Brushes.Green ,
a.GetStringFormat(), pInfo.Text, angle, hotKeyPrefixOverride);
}
winforms-xtraform-center-caption/CS/WindowsApplication1/Custom Form Painter/CustomFormPainter.cs#L43
DrawTextShadow(cache, appearance, r);
cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat());
}
winforms-scheduler-customize-appointment-flyout/CS/CustomAppointmentFlyoutExample/Form1.cs#L52
GraphicsCache cache = viewInfo.Cache;
StringFormat stringFormat = new StringFormat(viewInfo.View.Appearance.GetStringFormat());
stringFormat.Alignment = stringFormat.LineAlignment = StringAlignment.Center;
Dim captionColor As Color = EditorsSkins.GetSkin(viewInfo.LookAndFeel.ActiveLookAndFeel)(EditorsSkins.SkinEditorButton).Color.GetForeColor()
info.Cache.DrawString(str_value, viewInfo.Appearance.Font, New SolidBrush(captionColor), info.Bounds, info.Appearance.GetStringFormat())
Return
winforms-grid-show-editor-buttons-on-cell-hover/VB/WindowsApplication3/Form1.vb#L51
info.EditorButtonPainter.DrawObject(args)
e.Cache.DrawString(e.DisplayText, e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), textRect, e.Appearance.GetStringFormat())
e.Handled = True
winforms-xtraform-center-caption/VB/WindowsApplication1/Custom Form Painter/CustomFormPainter.vb#L49
DrawTextShadow(cache, appearance, r)
cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat())
End Sub
winforms-scheduler-customize-appointment-flyout/VB/CustomAppointmentFlyoutExample/Form1.vb#L57
Dim cache As GraphicsCache = viewInfo.Cache
Dim stringFormat As StringFormat = New StringFormat(viewInfo.View.Appearance.GetStringFormat())
stringFormat.LineAlignment = StringAlignment.Center
winforms-pivot-customize-cell/VB/PivotCustomDraw/Form1.vb#L26
r.Inflate(-4, -4)
e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, Brushes.White, r, e.Appearance.GetStringFormat())
e.Handled = True
See Also