我想将窗口窗体颜色从基本蓝色更改为其他。有人可以帮助我们如何做到这一点吗?我只看到表单 ii formborderstyle 的一个属性。
4 回答
实际上,您可以通过在其中添加 CSS 来更改背景颜色。可能看起来有点复杂,但我已经完成并在我的项目中使用它会很容易。您可以尝试参考一下,看看是否有帮助
CSS 标记
<link rel="stylesheet" href="css/style.css" type="text/css" />
我的 css 文件中的 css 代码
body {
font-family: helvetica, arial, sans-serif;
background:#FCDFFF; //you can choose the html colour code accordingly
}
在您的 aspx 窗口表单页面中,应该有一个正文。该正文实际上链接到 css 文件中的正文。希望这就是你的意思。这样做的好处是,您可以选择任何颜色。
你可以试试这个。使用样式属性BODY或FORM
<body style="background-color:green; ">
<form id="form1" runat="server" style ="background-color:green;">
...
</form>
</body>
you can do it but it will not be easy You have to use P/Invoke for this:
The thing you are trying to achieve is known as Drawing in Non Client Area of Windows Form.
Title Bar(is the place where maximize , minimize , close button resides) of a Windows Form is not in Client Area of it and there is not direct way of painting it.
Anyhow You will get a lot of articles and project on it on Internet here is it:
http://www.codeplex.com/Wiki/View.aspx?ProjectName=CustomerBorderForm
http://www.geekswithblogs.net/kobush/articles/CustomBorderForms.aspx
http://customerborderform.codeplex.com/releases/view/146
reference taken from :http://social.msdn.microsoft.com/Forums/windows/en-US/485fb4c5-8430-4cb5-8a4d-ccd7892e403b/how-to-change-the-title-bar-appearance
您可以参考以下这些网站,其中包含有关您的解决方案的大量信息
http://msdn.microsoft.com/en-us/library/aa288405(v=vs.71).aspx
http://www.codeproject.com/Questions/165119/How-to-change-the-color-of-Windows-form-header
http://www.dotnetfunda.com/codes/code359-change-the-window-form-color.aspx