开发者

How to customize the look and feel of the UI controls in WinForms?

开发者 https://www.devze.com 2022-12-27 12:06 出处:网络
I\'d like to customize the standard user controls look (buttons, dgv, txtboxs ... etc) and the layout of my forms to a state of art modern interface like any decently built application. How can I do开

I'd like to customize the standard user controls look (buttons, dgv, txtboxs ... etc) and the layout of my forms to a state of art modern interface like any decently built application. How can I do开发者_Python百科 that?. What to look for? any articles, books .. etc that might be of help!


Your question is a little vague in terms of what exactly you want to achieve. However, you can customize the look of most controls simply by handling painting them on your own.

There are also some 3rd-party Winforms control libraries which are easily skinnable.

Also, if it's an option, WPF provides a very powerful style system to change the look of anything you want.


To customize the look of a control, you will need to override the OnPaint method and perform the paint yourself. There are numerous examples out there showing many ways to create and modify custom controls.

A google search http://www.google.com/search?hl=en&q=dotnet+custom+textbox&aq=f&aqi=&aql=&oq=&gs_rfai= for a custom textbox.

Do not forget the this.DrawMode = DrawMode.OwnerDrawFixed; otherwise the OnPaint will not be called.


it will be a whole lot easier to customise the appearance of controls if you can use WPF instead of WinForms. But if you must use WinForms, you will need to familiarise yourself with painting using the GDI+ functions, accessed through the Graphics object.

Here are some links for customising Windows Froms controls


DevExpress is such library that will provide you with multiple GUI styles. Otherwise, overriding the Paint() event is the way to go.

0

精彩评论

暂无评论...
验证码 换一张
取 消