天天看点

修改SourceGrid字体显示 转

修改SourceGrid字体显示

新的SourceGrid DotNet版本是4.40,主要问题是在实现的时候显示的字体实在不敢恭维。

修改两行代码搞定:

SourceGrid\DevAge.Windows.Forms\Drawing\VisualElements\TextGDI.cs

protected override void OnDraw(GraphicsCache graphics, RectangleF area)

        {

            if (Value == null || Value.Length == 0)

                return;

            SolidBrush brush;

            if (Enabled)

                brush = graphics.BrushsCache.GetBrush(ForeColor);

            else

                brush = graphics.BrushsCache.GetBrush(Color.FromKnownColor(KnownColor.GrayText));

            graphics.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            graphics.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;             graphics.Graphics.DrawString(Value, Font, brush, area, StringFormat);

        }