C#4.0控件的默认背景色 [英] C# 4.0 Default Background Color of Controls

查看:82
本文介绍了C#4.0控件的默认背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问这个问题我很傻,但我想看看什么是首选的解决方案.

假设我有一个没有Tabpages的TabControl,并且当没有TabPages时,希望TabControl的主体区域的背景为黑色,而不是白色.我也遇到了第三方GridView控件的相同问题.

I feel silly for asking this, but I''m asking to see what is the preferred solution.

Let''s say I have a TabControl with no Tabpages and want the background of the TabControl''s body area to be Black instead of White when there are no TabPages. I have also run into the same problem with a 3rd party GridView control.

推荐答案

仍然没有回答.这是更改背景颜色的方法.

System.Windows.Forms:请参见属性BackColor.

WPF :参见属性:Background.

默认颜色:

System.Windows.Forms:将颜色设置为Control.另请参见UseVisualStyleBackColor(默认为true).

WPF :此类控件可以由子控件从父级继承.是XAML缺少的属性,它是默认设置.在大多数情况下,背景将被继承.几乎没有什么微妙的时刻.使用WPF,您可以使用不同的样式XAML来拥有不同的外观,但这是一个完全不同的故事.

您没有询问前景色-如果您在新背景上看不到黑色文字,那是您的错. :)

无论如何,当您对背景感到满意时,您将立即看到在哪里设置前景色. :)

祝您好运!
Still your question is left without an answer. Here is how you change the background colors.

System.Windows.Forms: see the property BackColor.

WPF: See the property: Background.

Default colors:

System.Windows.Forms: Set color to Control. See also UseVisualStyleBackColor (defaults to true).

WPF: Such properties can be inherited by child controls from parents. Is a property is missing from XAML, it is default. In most case background will be inherited. There are few subtle moments. With WPF you can have different skins with the different style XAMLs, but this is a whole different story.

You did not ask about foreground colors -- so it''s you fault if you don''t see your black text on your new background. :)

Anyway, when you''re comfortable with backgrounds, you will immediately see where to set the foreground colors. :)

Good luck!


如果其中没有任何标签页,我将摆脱标签控件本身.

然后太动态地添加选项卡控件.
I would get rid of the tab control itself if it does not have any tab pages in it.

Then add the tab control too dynamically.


这篇关于C#4.0控件的默认背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆