Advertisement

Howw to make custom windows look

Started by August 26, 2000 04:33 PM
3 comments, last by ChMar 24 years, 4 months ago
I''m trying to make an non standanrd window, like those from the players. I can''t figure out how to do it. Could any one give me a clue, or an exaple in Vb or VC? Thanks in advance, ChMar.
ChMar
Here''s something on CodeGuru about skins.

I suggest that you look around CodeGuru, as there are several other MFC examples you may find helpful

lntakitopi@aol.com - http://www.geocities.com/guanajam
Advertisement
Have you tried using the _OWNERDRAW styles in combination with WM_MEASUREITEM and WM_DRAWITEM? This is mainly used for buttons, editboxes and other standard Win32 controls.

You also could simply catching the WM_PAINT and WM_ERASEBKGND, after registering your new custom window...

In order to give the window any shape you want you use SetWindowRgn() and its related funcions. Basically what you do is you create a bitmap wich is nothing more than a siloute of the shape you want. You then load that bitmap and read through it. As you come across a stripe of black you create a windows region that is on pixel wide. You then read the next line of the bitmap and create another window region. you then combine the two regions with the windows API. you just repeat this process over and over untile you''ve completely read the bitmap image. lastly you set the window''s region to the one you''ve created.

I believe I have an example of this at my web page Useless Code. Look at the style button source code. If for some reason the code is not there or you have any questions just email me.
God, I looked for ages to understand how to do non GDIshaped windows ... so that''s how you do it !
But isn''t that slow as fu*k ?

AS well, I got a window with round corners, but the non painted areas wouldn''t refresh correctly (that is, they wouldn''t really be transparent, but rather they would keep whatever was underneath if you tried to move them). Mmmm, I don''t remember if I defined a region though... I am gonna have to check that.

youpla :-P
-----------------------------Sancte Isidore ora pro nobis !

This topic is closed to new replies.

Advertisement