画图

来源:互联网 发布:ubuntu 磁盘空间 查看 编辑:程序博客网 时间:2024/04/30 02:55

//绘制菜单

Graphics g = e.Graphics;

if ((e.State&DrawItemState.Selected)==DrawItemState.Selected)
            {
                g.FillRectangle(new SolidBrush(Color.Red), e.Bounds.Left, e.Bounds.Top, e.Bounds.Width, e.Bounds.Height);

                string MyString = "显示太空图";
                Font MyFont = new Font("宋体", 20, FontStyle.Bold);
                SolidBrush MyBrush = new SolidBrush(Color.Yellow);
                float x = 10.0F;
                float y = 10.0F;
                StringFormat MyFormat = new StringFormat();
                MyFormat.FormatFlags = StringFormatFlags.NoWrap;
                e.Graphics.DrawString(MyString, MyFont, MyBrush, x, y, MyFormat);
            }