日期:2014-05-18 浏览次数:20888 次
Boolean bPaint = false; private void MenuItemMouseEnter(object sender, EventArgs e) { ToolStripMenuItem menuItem = sender as ToolStripMenuItem; if (menuItem != null) { bPaint = true; menuItem.Invalidate(); } } private void MenuItemMouseLeave(object sender, EventArgs e) { bPaint = false; } private void MenuItemPaint(object sender, PaintEventArgs e) { ToolStripMenuItem menuItem = sender as ToolStripMenuItem; if (menuItem != null) { if (bPaint) { e.Graphics.FillRectangle(Brushes.Red, 0, 0, menuItem.Width, menuItem.Height); Brush brush = new SolidBrush(Color.Black); Font font = new Font(menuItem.Font.Name, menuItem.Font.Size); e.Graphics.DrawString(menuItem.Text, menuItem.Font, brush, 20, 2); } } }
------解决方案--------------------
用WPF吧,哥们。
------解决方案--------------------
用其他控件
Dev,ComponmentOne 等