[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Graphics On Invisible Form

Posted on 2004-10-30
14
Medium Priority
?
266 Views
Last Modified: 2013-12-04
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?
0
Comment
Question by:EXwithRaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 3
  • 2
14 Comments
 
LVL 3

Expert Comment

by:vippx
ID: 12450913
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
 
LVL 3

Expert Comment

by:vippx
ID: 12450919
for additional effects, make the form border style property as "none"
0
 
LVL 1

Expert Comment

by:baggaabhishek
ID: 12461578
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Expert Comment

by:vippx
ID: 12461903
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
 
LVL 1

Expert Comment

by:baggaabhishek
ID: 12462022
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
 
LVL 3

Expert Comment

by:vippx
ID: 12462208
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
 
LVL 3

Expert Comment

by:vippx
ID: 12462215
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
 

Author Comment

by:EXwithRaj
ID: 12480220
I am using VB 6 - not VB .Net.I guess now you've to reframe & rethink your suggestions.
0
 
LVL 3

Expert Comment

by:vippx
ID: 12490728
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
 

Author Comment

by:EXwithRaj
ID: 12521153
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
 
LVL 3

Expert Comment

by:vippx
ID: 12521506
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
 

Author Comment

by:EXwithRaj
ID: 12530394
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
 
LVL 3

Expert Comment

by:vippx
ID: 12530816
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
 
LVL 3

Accepted Solution

by:
vippx earned 300 total points
ID: 12530829
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question