天天看點

修改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);

        }