Graphics On Invisible Form

If there's a graphics on a Form,is it possible to make the Form invisible at run-time but only display the graphics & any control on it?
EXwithRajAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vippxCommented:
Hi

What programming language are you talking about??

In .NET this can be done by setting the transparency key property to some wierd color (say pink, or one that you wont use on ur graphics or controls) then setr the background color of the form to that color. This would have the form go invisible if thats what you need.
0
vippxCommented:
for additional effects, make the form border style property as "none"
0
baggaabhishekCommented:
Thats ok vippx

But what if i need to display only the image and not the square of the picture box
Is that possible. e.g i have a circular image and i insert it on the form and set the properties u suggest , but in this case it will not show onl the image it will show as a complete square
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

vippxCommented:
hi

it will show up.. while designing the imageset the background and any part of the image that u need invisibel to the color of the transperancy key that you set for the form. then make the form of the same color... and if u run the app u can see all the parts on ur form that had the color of the transperancy key would have dissapeared.
0
baggaabhishekCommented:
I am not talking about the image , i am talking about the picturebox in which i am including the image.
Even if i set the backcolor property to the same as that of the form it still displays the square of the picturebox
or even if i set the backcolor to transparent even then it displays
0
vippxCommented:
Well im trying it out on my machine.. the form back color is also set to be transparent, the picturebox border is set to none. the picture property is set to strech image and now when i run the form, i dont see the frame of the pivture box. i created a simple cricle using "paint" program and set the unwanted background of the picture to the same color as my transperancy key and only that is visible.
0
vippxCommented:
and not back color of the picture box... et the background of ur image too to the color that is transparent as set on the property of the form.
0
EXwithRajAuthor Commented:
I am using VB 6 - not VB .Net.I guess now you've to reframe & rethink your suggestions.
0
vippxCommented:
Hi

For visual studio 6, you need to invoke some gdi 32 APIs to do the same. here is a  was to do it

http://juicystudio.com/tutorial/vb/transparentform.asp

http://juicystudio.com/tutorial/vb/transparentregion.asp

for a tranparent picturebox, check this:

http://www.freevbcode.com/ShowCode.Asp?ID=1903

hope this helps

0
EXwithRajAuthor Commented:
The code in the 2nd link(for "transparentregion") is working partly.The inside of the form is invisible & you can see the borders & caption - but the controls are all invisible.
   What I want is that only the  picture in a PictureBox or Image must be visible & the rest invisible.
0
vippxCommented:
Hi

Could u give some more information on the application of the code that you are trying to do? Are you trying to create a custom shaped form or do some image manipulation. If you are looking to create custom shaped forms( like Windows media player in skinned mode) then picturebox is not the way to go about it.

<quote>
The inside of the form is invisible & you can see the borders & caption - but the controls are all invisible.
</quote>

if you want the titlebar to be invisible then just set the borderstyle poperty of the form to "none"

if u are trying to create a custom shaped form try this :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchShapedWindowsFormsControlsInVisualStudioNET.asp

hope this is what you are looking for, if not, let me know
0
EXwithRajAuthor Commented:
vippx,I've already informed you that I am not using VB .Net.Therefore,your link to a .Net solution is of no use to me.
Besides,you may look at my requirements from 2 angles:
a) custom-shaped Form(or Windows skins)
b) if a Form is displaying an image,thru Image or PictureBox or any other control,I want only the graphic to display - and not the Form.
   In your previous reply,there was a link for the "transparentregion" technique.As per this,only the Form's body will be invisible - but not the controls in it & the Form's borders & title-bar.But my experience,as I'd already stated,is that all the controls,along with the Form's body, become invisible.
0
vippxCommented:
Hi Raj

Sorry for my eagerness to replyi posted this link as i had worked on it previously.

However i think i have replied in part that you can make the form borders and the titlebar disappear using the forms "Border Style" Property = none

and i was looking into option and use of these API functions should work like a charm ( atleast does so for me!)

Public Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Public Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

Public Type POINTAPI
        X As Long
        Y As Long
End Type


The use the SetWindowRgn with these 3 arguments

1.  pass the control's handle ( hwnd) u need to shape
2. pass a handle to the shape that you have created using any of the create region function API that we have declared above. It should allow u to create a lot of shapes, if not you can always use other create region API to create the shape of your choice.

3. Boolean value for redraw set as true.


here is a link to a step by step tutorial

http://www.onlytools.com/edgetracer/irregular_windows_vb.htm


And once again, i say if u need to get rid of the frame border and the titlebar, use borderstyle = none and not any APIs

0
vippxCommented:
Also for creating a skin u need not have a picturebox in place at all.. just set the picture property of the form to whatever image u need on the back ground. then create a window region to mask off all other parts than the ones u need of the image.

and that is the best way to do it
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.