Valhalla Legends Forums Archive | General Programming | GUI help VB

AuthorMessageTime
RhiNo
Ok, I was just wondering because ei havnt seen it done yet but is it possible to make a GUI in vb that has transparent parts so you can see whatever is under the application like some skins for winamp or windows media player.?
July 30, 2003, 7:27 PM
Soul Taker
Yes.
July 30, 2003, 7:48 PM
Camel
Col and LWA_COLORKEY set a transparant mask color for if you don't want a rectangular window. If you dont want to use that, just get rid of the LWA_COLORKEY flag.

[code]Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000
Public Const LWA_COLORKEY = &H1
Public Const LWA_ALPHA = &H2

Public Sub SetTrans(ByVal hWnd As Long, Ammount As Byte, Col As ColorConstants)
SetWindowLong hWnd, GWL_EXSTYLE, WS_EX_LAYERED Or GetWindowLong(hWnd, GWL_EXSTYLE)
SetLayeredWindowAttributes hWnd, Col, Ammount, LWA_ALPHA Or LWA_COLORKEY
End Sub[/code]


[edit] note that Ammount isn't a percent, it goes from 0 to 255
July 30, 2003, 7:54 PM
RhiNo
doesnt that hide the whole window or make the whole window transparent? i just want like certain spots and other spots to be like a normal GUI i just want to beable to make it like a circle or something or what would this be called so i can find tutorials about it and learn more on it.?
July 30, 2003, 10:22 PM
Camel
[quote author=RhiNo link=board=5;threadid=2137;start=0#msg16522 date=1059603752]
doesnt that hide the whole window or make the whole window transparent? i just want like certain spots and other spots to be like a normal GUI i just want to beable to make it like a circle or something or what would this be called so i can find tutorials about it and learn more on it.?
[/quote]

I doubt that is possible, but I'm not entirely sure. If it is, it would probably have to do with finding an area of the window and somehow getting it to have its own window handle.
July 30, 2003, 11:23 PM
Grok
You can create a region and make it transparent. Look for the region functions in MSDN. Let us know what you find.
July 30, 2003, 11:43 PM
RhiNo
[quote author=Grok link=board=5;threadid=2137;start=0#msg16532 date=1059608634]
You can create a region and make it transparent. Look for the region functions in MSDN. Let us know what you find.
[/quote]

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vblrfvbspec3_3.asp there are 2 links with info on regions and region clipings and what not thanks grok

+1 for grok for the idea of MSDNN i always forget bout msdn
July 31, 2003, 6:33 PM
sPlOrYgOn
WHAT?!? forget?
I goto MSDN everyday because I never learned vb properly..
July 31, 2003, 9:02 PM
Yoni
+1 to sPlOrYgOn
August 1, 2003, 8:26 AM

Search