本文介绍了如何在winforms中的toolstripcombobox中更改突出显示的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我如何使用c#
我尝试过:
Please help me how to change toolStripComboBox highlighted colour instead of Blue colour in windows form using c#
What I have tried:
private void toolStripComboBox1_Paint(object sender, PaintEventArgs e)
{
foreach (ToolStripComboBox item in toolStrip1.Items)
{
var asComboBox = item;
if (asComboBox != null)
{
var location = asComboBox.ComboBox.Location;
var size = asComboBox.ComboBox.Size;
Pen cbBorderPen = new Pen(Color.Gray);
Rectangle rect = new Rectangle(
location.X - 1,
location.Y - 1,
size.Width + 1,
size.Height + 1);
e.Graphics.DrawRectangle(cbBorderPen, rect);
}
}
}
推荐答案
这篇关于如何在winforms中的toolstripcombobox中更改突出显示的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!