473,395 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Semi Transparent controls

Ali Rizwan
925 512MB
Hi all
I have made my forms and its contents semi transparent but i want to make my controls transparent not my form how can i do this. I m using the following code to setting transperency to my form.
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  2.    (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  3. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  4.    (ByVal hwnd As Long, ByVal nIndex As Long, _
  5.    ByVal dwNewLong As Long) As Long
  6. Private Const GWL_STYLE = (-16)
  7. Private Const GWL_EXSTYLE = (-20)
  8. Private Declare Function SetLayeredWindowAttributes Lib "user32" _
  9.    (ByVal hwnd As Long, ByVal crKey As Long, _
  10.    ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  11. Private Const LWA_COLORKEY = &H1
  12. Private Const LWA_ALPHA = &H2
  13. Private Const WS_EX_LAYERED = &H80000
  14.  
  15.  
  16. Private m_lAlpha As Long
  17.  
  18. Private Sub Form_Load()
  19.  
  20.     m_lAlpha = 255
  21. If Settings.chkTrans.Value = 1 Then
  22.     If (m_lAlpha = 255) Then
  23.       Dim lStyle As Long
  24.       lStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
  25.       lStyle = lStyle Or WS_EX_LAYERED
  26.       SetWindowLong Me.hwnd, GWL_EXSTYLE, lStyle
  27.    End If
  28.    Dim lAlpha
  29.    m_lAlpha = m_lAlpha - 50
  30.    lAlpha = m_lAlpha
  31.    If (lAlpha < 0) Then
  32.       lAlpha = 0
  33.    End If
  34.    SetLayeredWindowAttributes Me.hwnd, 0, lAlpha, LWA_ALPHA
  35.  
  36.  End If
  37.  
  38. End Sub
Sep 5 '07 #1
2 1543
Robbie
180 100+
Ali, if all you wanted to do was edit your previous post with code=vb tags, there is an Edit button...

Check this out:
http://www.vbforums.com/showthread.php?t=430271

Look in a person called schoolbusdriver's sig. There you can find a transparent picturebox control (which I've used, and it's excellent!), and a frame with a transparency effect.

Hope it's useful!

EDIT: Agh! >_o
I see what you mean now - alpha faing. ><
Well I'll keep this post here in case it helps other people.
Sep 5 '07 #2
Ali Rizwan
925 512MB
Ali, if all you wanted to do was edit your previous post with code=vb tags, there is an Edit button...

Check this out:
http://www.vbforums.com/showthread.php?t=430271

Look in a person called schoolbusdriver's sig. There you can find a transparent picturebox control (which I've used, and it's excellent!), and a frame with a transparency effect.

Hope it's useful!

EDIT: Agh! >_o
I see what you mean now - alpha faing. ><
Well I'll keep this post here in case it helps other people.
thanx rob i know that edit button but i ll forgotten about that time.
Sep 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: jhomp ssens | last post by:
I would like to create a pulldown menu which is semi-transparent....that is, you can see the text and graphics behind it when it is pulled down. The effect I'm looking for can be seen at...
3
by: Steve Koon | last post by:
Any thoughts on getting this project to work or suggesting another method would be appreciated. Steve ========================================== Project: A Windows Form which acts as a...
8
by: Grahammer | last post by:
Is it possible to set the background of a usercontrol as transparent? I tried setting the background image of the usercontrol to a transparent GIF, but that caused MAJOR problems. I'm making...
2
by: Martin | last post by:
I've been complaing about the VB2005 Help-Information (or rather the lack of it) before, but when I was looking how to set the backstyle of a label control to "Transparent" I found that the VB2005...
4
by: ray well | last post by:
in my app i need to make a RichTextbox control transparent. i need it to be a like a pane of glass lying on a sheet of paper, where u can see everything on the sheet of paper not covered by text...
2
by: Trond Michelsen | last post by:
Hi. I have a transparent PNG-image that I would like to display on top of the rest of the web page. I've already got this part working. But, I'd like the background (as in "the part of the image...
0
by: SamSpide | last post by:
Hi all, I'm trying to place a semi-transparent image (i.e. an image with parts of it were drawn in transparent color) over a playing video, but can't seem to make it work. Instead of the...
0
by: James Arnold | last post by:
I am trying to use a semi transparent PNG as the form background, allowing you to see through certain parts. The intention is similar to a skinnable form like launchy, with semi-transparent pixels...
9
by: JamesF1982 | last post by:
Hey everyone, My question is related to HTML, Javascript, CSS and ASP.NET but i think it belongs here! Upon an event i am trying to add a semi-transparent colour across the page so the...
0
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all I have made my forms and its contents semi transparent but i want to make my controls transparent not my form how can i do this. I m using the following code to setting transperency to my...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.