translucent

toxicflame
01-28-2005, 11:37 AM
hey i have a form, and i wanted to make it circular, as well as the cmd buttons on it, but also make the buttons partial translucent so you can see themand the .caption, but see through them too. does anyone know how to do this?? thanks in advance!!! :D

stijn koopal
01-28-2005, 12:13 PM
Use the SetWindowRgn and CreateEllipticRgn for your circular form. This is also needed for translucentsy. You can find the Api's on http://www.mentalis.org/apilist/apilist.php

eXeption
01-28-2005, 09:00 PM
This is also needed for translucentsy.

For making forms transparent , semi transparent or making a purticular color in the window transparent, you have to use SetLayeredWindowAttributes.
No need to use it with above functions, it will work with all types of objects (which have a hWnd property).

toxicflame
01-30-2005, 06:02 PM
I have a form that i am tryin to make transparent... i used the code below and it worked. wen i click cmdTran it becomes translucent. however i also want an option to eliminate translucency. so wen they click that button it turns it off, and becomes non-seethrough. does anyone know how to do this. Thanks! :huh:




Private Declare Sub ReleaseCapture Lib "User32" ()

Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "User32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2

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

Public Function DarkMe()
Dim rtn As Long
rtn = GetWindowLong(hWnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hWnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hWnd, 0, 200, LWA_ALPHA
End Function

Private Sub cmdTran_Click()
DarkMe
End Sub

Peperl
01-31-2005, 01:33 AM
hi, you could set the alpha value to his maximun

toxicflame
01-31-2005, 08:22 AM
hi, you could set the alpha value to his maximun
ok cool thanks!!!! :rolleyes:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum