Makes,Form,Trans,Parent
Quick Search for:  in language:    
Makes,Form,Trans,Parent
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
RentACoder Stats

 Code:  lines
 Jobs: 0 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for RentACoder.
Wrapping Scrolling Text
By Paranoid_Androi d on 7/2


Create A Dummy File
By AML on 7/2


Click here to see a screenshot of this code!Captionbar manipulation!
By Peter Hebels on 7/2

(Screen Shot)

A Game Of War
By Co0nest on 7/2


Click here to see a screenshot of this code!KeyGen Example
By Bengie|NET on 7/2

(Screen Shot)

Click here to see a screenshot of this code!OpenBrowser v1.9
By Orlando Jerez on 7/2

(Screen Shot)

SendMessageBySt ring() Example
By Jaime Muscatelli on 7/2


Click here to see a screenshot of this code!FirstSunday
By Jan Paul Penning on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Ikonz v1.0
By Gaurav Creations on 7/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Make Form Transparent.

Print
Email
 
VB icon
Submitted on: 2/27/1998
By: Kalani COM 
Level: Not Given
User Rating: By 104 Users
Compatibility:

Users have accessed this code 27018 times.
 
 
     Makes a Form Trans Parent
 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

    //**************************************
    //     
    //Windows API/Global Declarations for :M
    //     ake Form Transparent.
    //**************************************
    //     
    Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRECT As RECT) As Long
    Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRECT As RECT) As Long
    Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
    Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
    Declare Function ScreenToClient Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
    Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
    Public Const RGN_AND = 1
    Public Const RGN_COPY = 5
    Public Const RGN_DIFF = 4
    Public Const RGN_OR = 2
    Public Const RGN_XOR = 3
    Type POINTAPI
    x As Long
    Y As Long
    End Type
    Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
    End Type
    		
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    //**************************************
    //     
    // Name: Make Form Transparent.
    // Description:Makes a Form Trans Parent
    //     
    // By: Kalani COM
    //
    // Side Effects:No Controls are Visible 
    //     on the Form
    //
    //This code is copyrighted and has    // limited warranties.Please see http://
    //     www.Planet-Source-Code.com/xq/ASP/txtCod
    //     eId.816/lngWId.-10/qx/vb/scripts/ShowCod
    //     e.htm    //for details.    //**************************************
    //     
    
    Public Sub MakeTransparent(frm As Form)
    'This code was takin from a AOL Visual Basic
    'Message Board. It was submited by: SOOPRcow
    Dim rctClient As RECT, rctFrame As RECT
    Dim hClient As Long, hFrame As Long
    '// Grab client area and frame area
    GetWindowRect frm.hWnd, rctFrame
    GetClientRect frm.hWnd, rctClient
    '// Convert client coordinates to screen coordinates
    Dim lpTL As POINTAPI, lpBR As POINTAPI
    lpTL.x = rctFrame.Left
    lpTL.Y = rctFrame.Top
    lpBR.x = rctFrame.Right
    lpBR.Y = rctFrame.Bottom
    ScreenToClient frm.hWnd, lpTL
    ScreenToClient frm.hWnd, lpBR
    rctFrame.Left = lpTL.x
    rctFrame.Top = lpTL.Y
    rctFrame.Right = lpBR.x
    rctFrame.Bottom = lpBR.Y
    rctClient.Left = Abs(rctFrame.Left)
    rctClient.Top = Abs(rctFrame.Top)
    rctClient.Right = rctClient.Right + Abs(rctFrame.Left)
    rctClient.Bottom = rctClient.Bottom + Abs(rctFrame.Top)
    rctFrame.Right = rctFrame.Right + Abs(rctFrame.Left)
    rctFrame.Bottom = rctFrame.Bottom + Abs(rctFrame.Top)
    rctFrame.Top = 0
    rctFrame.Left = 0
    '// Convert RECT structures to region handles
    hClient = CreateRectRgn(rctClient.Left, rctClient.Top, rctClient.Right, rctClient.Bottom)
    hFrame = CreateRectRgn(rctFrame.Left, rctFrame.Top, rctFrame.Right, rctFrame.Bottom)
    '// Create the new "Transparent" region
    CombineRgn hFrame, hClient, hFrame, RGN_XOR
    '// Now lock the window's area to this created region
    SetWindowRgn frm.hWnd, hFrame, True
    End Sub

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
4/13/1999 9:50:00 AM:Joe
Hi, very nice code, exactly what i've 
been searching for...but how can i let 
objects leave visible on the form ??? 
they also disapear...
Thanks
Joe
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/15/1999 1:52:00 AM:Klendathu
I agree with Joe. WE WANT TO BE ABLE TO 
SEE THE OBJECTS!!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/25/1999 12:49:00 PM:GEEZA
These are simple Set Window Region 
APIs, i have messed with them myself 
many times, and the only way i know of 
to show the objects in the form is to 
Set a VISIBLE region for the object.  I 
did it for a Close button
Ask and i 
might be able to find the code
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/26/1999 9:39:00 AM:John
If you would like to have the objects 
visible Visit Code SetTranparent 
written by
satin katiyar at this site 
itself.I fully Agree with him.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/1/1999 2:54:00 PM:Mike
this seems like a really cool code. i'm 
new at
programming. can u email me 
exactly how to 
code your code. where 
do i put the declarations.
thanks. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/29/1999 11:56:00 AM:METEX
It's cool.Thank you.very graet thing 
that you do.Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/14/1999 11:35:00 AM:Wiz
im not sure how to put in your code but 
would like to try it.. if you could 
explain how i would put it in
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/18/1999 7:13:00 PM:Chris
Out of curiosity, when I place 
MakeTransparent(form1) in my <b>form 
load procedures<b> I get an error. Can 
you tell me what im doing 
wrong?
Thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/19/1999 10:51:00 AM:HATCHET
Chris,
When you put "Form1" inside of 
the parenthases, it things you want to 
return a value.  By definition, a Sub 
can't return anything.  Take out the 
Paren's and it should work 
fine:
MakeTransparent 
Form1
HATCHET
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/9/1999 5:55:00 AM:dpc
Wonderful bit of code.
Is there a way 
to make
 the form visible again 
though?
I'm working on figuring it 
out now, but am fairly new to the API.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/11/1999 12:42:00 AM:Alex
Can someone send me the project file of 
this too me? Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/17/1999 6:35:00 PM:CLOUD
I HAVE NOT I DEIA HOW TO WORK THIS 
COAD
somone help
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/18/1999 5:50:00 PM:bob
First, figure out how to spell right.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/28/1999 7:08:00 PM:Water
Thats right
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/15/1999 3:55:00 AM:William Floor
This code can be much smaller!!!
Just 
1 line of code, with the same effect. 
The Form and Controls are 
transparent:
Form1.Visible = 
False
Now the form seems to be 
transparent, but  it
is actually 
invisible.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/1/1999 4:57:00 PM:Austin Agarwal
Every one who wants to see the objects 
on the form, email me, i have a 
different code but its much better, 
Austin6865@aol.com
http://Austinaa.cl
ick2site.com
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/1999 1:11:00 PM:Uriel Hernández Robledo
Por favor, si tienes el OCX, 
envíamelo
Thank you.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/13/1999 6:58:00 PM:Kalani COM
Re: Uriel Hernandez Robledo
No hice 
un OCX pero el código proveió (y VB5+) 
de usted puede compilar esto en sus el 
propio. Perdón mi español horrible. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/16/1999 2:13:00 AM:Revenant
HEY!! I"VE SEEN THIS CODE!! IT"S 
EXACTLY THE SAME!! How dare you to 
steal codes from others and then credit 
yourself for 'creating' it!!! LAMERS!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/16/1999 9:27:00 PM:George
Hi,I am doing a project whereby I must 
display a waveform while playing a wav 
file in Visual Basic 6.0, Can you 
help?
Thanks In Advance.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/19/1999 9:51:00 AM:Shadow
I must find out how to make the objects 
visible. I have tried the code for 
making a transparent color on a form 
but that does not work. Could use some 
help.
Thanks, e-mail me if you have a 
solution.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/25/1999 11:46:05 PM:zdsdsadasd
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/30/2000 4:47:17 AM:ofer
I have to make an unrectangle form
(a 
form that I can design by myself) 
can 
you help with some advice
many thenks 
Ofer
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/26/2000 1:49:41 PM:Nick
You new people are too picky. Beggers 
can't be choosers. Experiment a bit get 
some books i recommend a book called 
"Guide To The Win 32 Api" mainly for 
vb4.0 but it covers every api, except 
for communications which is basically 
self explanitory.  The author's name is 
"Dan Appleman" i would get the isbn # 
but im too lazy.  Read Read Read Read! 
Thats All you need to do!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/12/2000 5:28:52 PM:Jeffrey C. Tatum
I don't understand you people. We the 
programmers post code for those who 
might want it, and learn from it. How 
dare you complain about it. It's people 
who critisize the programmers, that 
makes programmers now want to help. 
Give them credit where credit is due. 
THEY spend time writing the codes for 
you who cant write them. Show a little 
respect. And for Kalani, nice code. 
Keep up the good work.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/22/2001 8:31:05 PM:chris
great work here, but for some reason i 
find that when a form is made 
transparent its then unable to change 
the mousepointer! any solutions?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/22/2001 8:33:44 PM:marshy
Great work. However, one problem i find 
when making forms transparent is that 
it prevents you from changing the mouse 
pointer!  Any help much apperitiated
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/23/2002 2:28:05 PM:Scott68
Add these to your form code:
Private 
Sub Form_Load()
MakeTransparent 
Me
End Sub
Private Sub 
Form_Resize()
MakeTransparent Me
End 
Sub
Works great for me! 
Neat code, 
Thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | RentACoder Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.