/// <summary> /// 矩形を塗り潰し、反転色で枠を描画します。 /// </summary> /// <param name="g">描画対象の矩形を指定します。</param> /// <param name="fill">塗り潰すのに使用する色を指定します。</param> /// <param name="rect">対象の矩形を指定します。</param> public static void FillRectangleReverseDotFramed(Gdi::Graphics g, Gdi::Color fill, Gdi::Rectangle rect) { using (Gdi::SolidBrush brush = new Gdi::SolidBrush(fill)) using (Gdi::Pen pen = new Gdi::Pen(~(afh.Drawing.Color32Argb)fill)){ pen.DashStyle = Gdi::Drawing2D.DashStyle.Dot; FillRectangleFramed(g, brush, pen, rect); } }
public void Draw() { using (Gdi::Pen penGrid = new Gdi::Pen(sender.GridColor)) using (Gdi::Brush brBack = new Gdi::SolidBrush(cBack)) using (Gdi::Brush brFore = new Gdi::SolidBrush(cFore)){ // Clear e.Graphics.FillRectangle(brBack, e.CellBounds); e.Graphics.DrawLine(penGrid, e.CellBounds.Left, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1); e.Graphics.DrawLine(penGrid, e.CellBounds.Right - 1, e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom); int h = (e.CellBounds.Height - e.CellStyle.Font.Height) / 2; e.Graphics.DrawString( text, e.CellStyle.Font, brFore, e.CellBounds.X + 1, e.CellBounds.Y + h, Gdi::StringFormat.GenericDefault ); } }