Okay, i have 2 objects in my form: a label with a picture and a picturebox with a picture.
The background of my form has another picture.
What i want to happen:
1.I press the label,the picture of the label is on top with the bakground of the picture in my picturebox.
2.when i release the label i want the label to still have its picture on top but now i want the label background to be the form's bacground picture;
My Code

//Label color is transparent
//picturebox picture through label
label1.parent = pictureBox1;
//the label's picture is on top with the picturebox's picture as its background
//Now i have a problem
//normally i would do
label1.parent = Form1;
//however it gives me an error "'Chess.Form1' is a 'type' but is used like a 'variable'"

does anyone know how to set the label1's Parent property to Form1?
i know its possible because the default Label1 parent is Form1
i know this for a fact when i did

MessageBox.show(Label1.Parent.ToString());

and i got "WindowsFormsApplication1.Form1, Text:Form1"

Any help is appreciated ;)

Recommended Answers

All 2 Replies

Line #7 label1.parent =this; (Form1 is a type/class name).

wow so simple :'(:'(:'(:'(:'(
yet i never thought of it, even though i used it a billion times before.

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.