.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 21st, 2003, 04:54 PM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Howto skin C# apps?

Is there anyone how might know how to skin C# or VB.NET forms?
Is it possible? (I think nothing is impossible...)
Is it going to be hard?

Reply With Quote
  #2  
Old August 21st, 2003, 08:01 PM
anatol anatol is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Bulgaria
Posts: 22 anatol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to anatol
Re: Howto skin C# apps?

Quote:
Originally posted by oni9
Is there anyone how might know how to skin C# or VB.NET forms?
Is it possible? (I think nothing is impossible...)
Is it going to be hard?


Yes, it is possible. The only way in Windows to skin controls (or windows, it is the same) is to grab the WM_PAINT message from the original control's procedure and process it yourself. In the .NET framework the OnPaint function represents the OS WM_PAINT message. In .NET there is no need to replace manually the original procedure of the window with your own because the framework does it. With the overlapped or popup windows, like the form, you must handle yourself the WM_ERASEBKGND message. These are general principles of painting in Windows so they apply to any framework. In .NET find the function that represents the OS WM_ERASEBKGND message, get the DC (or graphics context) and paint whatever you want in the nonclient area of your form. Don't do it in the OnPaint handler. It draws on the client area of the window.
It is not so hard once you know what you are doing.

Reply With Quote
  #3  
Old August 21st, 2003, 10:32 PM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Thanks anatol

I found the OnPaintBackground() function which I believe it represents WM_ERASEBKGND.

I'm not sure what client area and non-client area really means.
when I tried to draw a string by overriding OnPaintBackground(), the string drawn with a transparent background on the form, while with OnPaint(), it draws normally just like a label with solid form background.

Is that transparent background area the non-client area I'm suppose to paint with?


Abit confused, but I think I know how to skin apps with C#... thanks again

Reply With Quote
  #4  
Old August 23rd, 2003, 08:13 PM
anatol anatol is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Bulgaria
Posts: 22 anatol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to anatol
Quote:
Originally posted by oni9
Thanks anatol

I found the OnPaintBackground() function which I believe it represents WM_ERASEBKGND.

I'm not sure what client area and non-client area really means.
when I tried to draw a string by overriding OnPaintBackground(), the string drawn with a transparent background on the form, while with OnPaint(), it draws normally just like a label with solid form background.

Is that transparent background area the non-client area I'm suppose to paint with?


Abit confused, but I think I know how to skin apps with C#... thanks again


I'm sorrry about the confusion. When you want, say, to paint the background of the app with some image you handle the WM_ERASEBKGND, but if you want to completely ignore the painting that windows does to forms (the window frame) you hande the WM_NCPAINT, NC comes from "non-client". There are also WM_NCLBUTTONDOWN,WM_NCMOUSEMOVE, etc. Now, what client and non-client means: this is a key concept of windows proramming so you must know it, especially if you do painting in Windows. Non-client area means the entire window, including the caption borders, close, minimize, maximize buttons. Client area is the area where you usually display things, excluding caption, borders, etc. Example: in Windows Explorer the client area is where you see the directories and files, without the caption, menus, toolbars and statusbar. Usually all the work is done in the client area of the window, but if you want to change the look of the entire window you should handle the nonclient area painting i.e WM_NCPAINT. There must be a function that represent the WM_NCPAINT in the .NET. Sorry that i can't remember the names of the functions but i've uninstalled Visual Studio .NET so try to find them yourself. When tou handle WM_PAINT, i.e , the painting in the client area, you get the client DC (or graphics context) to paint at. If you handle the WM_NCPAINT, you get the window DC to paint at. In Windows you get them with GetDC() (for the client area) and GetWindowDC() (for the nonclient area).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Howto skin C# apps?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap