Link to home
Start Free TrialLog in
Avatar of shahzad73
shahzad73

asked on

transparant PictureBox and VB FORM

Hello there

I have a picture box on a VB Form and its has the same size as the size of the form that is when form resize picturBox adjust itself to the full size of form. now what i want is that PictureBox become transparant to the background that is what ever is drawn graphically(Line,circle,pset) is visible through the picturebox and what ever is drawn on picture box is also visible. the idea is that i use the Form to draw the final graphics and use picture box for scratch pad for drawing that is i draw what ever i want on the picture box and when it is final i draw it on the form. in this way i do not have to refrsh the form objects every time there is like mouse move. also i clear the picture box so that when CLS is called only picturebox objects are erased not the form objects. what are the settings and is this possible


Shahzad
Avatar of DreamMaster
DreamMaster

I'm pretty sure you cannot get the picturebox to be transparent...

Max.
It sounds like everything you need is on the form, so you could always make sure that the two are always in synch, then you don't need to make the picturebox invisible:

on image clear: Picture1.Picture = Form.Picture
on update image: Form.Picture = Picture1.Picture

The picturebox is a container and therefore does not support transparency (because of the way containers work, although you could probably write your own to function as needed.)  If you need transparent, you need the imagebox, which does not support drawing.
Avatar of shahzad73

ASKER

okey i think u are right picture box can not be transparant. also i think u misunderstand my requirments. i want what ever is drawn on the VB Form is visible through PictureBox. the idea is that i will draw animated objects which require constant redraw be drawn on PictureBox. in this way i will not redraw backgroun again and again.

is there any way i can do the same with imagebox. is there any way to draw lines, circles and psets on imagebox


Shahzad.
The only way I can think of to implement your idea is to create on a picturebox, then at various stages transfer the contents to the imagebox, and as necessary place on or extract from the form background.
ASKER CERTIFIED SOLUTION
Avatar of dekeldate
dekeldate

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi shahzad73
I am glad you like the workround I proposed, but am somewhat disapointed with the grade. I feel this is usually an exchange site. If a solution is given as a comment that means I would like some feedback, and would be most glad to clarify. Also if you are going to give such a low grade, maybe clarify with the potential 'winner', they may release your points, rather than receive such a grade.
The link I gave basicly explained the problem and then proposed a work-around. This work-around is definetely not as neat as just making the picturebox transparent, and is also not for every situation. My comment was aimed to help you find a solution, not as a solution in
FYI Some experts will not assist those who regularly give "C" grades, meaning that your future questions may get less quality answers.  If you would like to correct this issue, drop a zero-point question in the Customer Service topic area and refer to this question.