Alsing.Drawing.GDI.FontList.PaintValue C# (CSharp) Method

PaintValue() public method

public PaintValue ( System.Drawing.Design.PaintValueEventArgs e ) : void
e System.Drawing.Design.PaintValueEventArgs
return void
        public override void PaintValue(PaintValueEventArgs e)
        {
            string text = e.Value.ToString();
            var bp = new Bitmap(e.Bounds.Width, e.Bounds.Height);
            Graphics g = Graphics.FromImage(bp);

            g.FillRectangle(SystemBrushes.Highlight, e.Bounds);

            IntPtr hdc = g.GetHdc();
            var gf = new GDIFont(text, 9);
            int a = 0;
            IntPtr res = NativeMethods.SelectObject(hdc, gf.hFont);
            NativeMethods.SetTextColor(hdc, ColorTranslator.ToWin32(SystemColors.Window));
            NativeMethods.SetBkMode(hdc, 0);
            NativeMethods.TabbedTextOut(hdc, 1, 1, "abc", 3, 0, ref a, 0);
            NativeMethods.SelectObject(hdc, res);
            gf.Dispose();
            g.ReleaseHdc(hdc);
            e.Graphics.DrawImage(bp, e.Bounds.Left, e.Bounds.Top);

            //	e.Graphics.DrawString ("abc",new Font (text,10f),SystemBrushes.Window,3,0);
        }