Is it possible to change the BackColor of ToolStripSeparator control? There is a BackColor property in the designer, but it doesn't appear to be used - the color is always white.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
The default
toolstrip
renderer ignores the BackColor property and uses hard-coded colors.You can refer following link to use your own renderer to paint the separators the way you want them.
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/6cceab5b-7e06-40cf-82da-56cdcc57eb5d
http://www.c-sharpcorner.com/uploadfile/mahesh/toolstrip-in-C-Sharp/
Please refer above link. I hope that helps you!
I see the question was asked 2 years ago, but I still can't find a simple and clear solution for this on the web. So...
I've just faced the problem today and found that it's pretty simple to solve it.
Having the same situation:
Solution:
Create a class which inherits the
ToolStripSeparator
class and add a method to thePaint
EventHandler
to draw the separator:Then add the separator:
Result:
I just pointed my separators' Paint event to this custom proc:
Where the CUSTOM_COLOR_FOREGROUND is a solid/named Color, such as Color.White for example.