Hello,
how to change the font name of DevExpress.XtraEditors.XtraForm caption?
If the the caption of XtraForm is Chinese font, it's very ugly. I have try all the skins but the caption font is not changed.
I create a new skin with SkinEditor, but there is no caption font property.so how to change the font name of form caption?
Thanks ,
Zheng
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Zheng,
This can be done only in by creating a derived FormPainter class. Here is some sample code:
public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm { public XtraForm1() { InitializeComponent(); } private void XtraForm1_Load(object sender, EventArgs e) { } protected override DevExpress.Skins.XtraForm.FormPainter CreateFormBorderPainter() { return new MyFormPainter(this, LookAndFeel); } } public class MyFormPainter : FormPainter { public MyFormPainter(Control owner, ISkinProvider provider) : base(owner, provider) { } protected override void DrawText(DevExpress.Utils.Drawing.GraphicsCache cache) { string text = Text; if(text == null || text.Length == 0 || this.TextBounds.IsEmpty) return; AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance()); appearance.Font = new Font("Arial", 12, FontStyle.Italic); appearance.TextOptions.Trimming = Trimming.EllipsisCharacter; Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, appearance.CalcDefaultTextSize(cache.Graphics).Height)); DrawTextShadow(cache, appearance, r); cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat()); } }
My project is attached.
Thanks,
Plato