I have a Windows form, I call the method DrawToBitmap on the form. I altered the bitmap with some drawing objects.
I now want to overlay this bitmap with transparent parts over my form. Unfortunately my form contains some controls, which do not seem to want to get overlaid. the axbouser.
unFortunately, the only way I can do this is to have a semitransparent second form and place my bitmap as a background image. This method works very well with the exception It is incredibly slow.
Does anyone know how to draw my image over my form without the need to use resource intensive translucent forms?
Updating translucent forms, very slow
6 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Greg37 pointsPosted Jan 12, 2007, 1:10 AM EST
Aww man - typed out a massive reply to this post, and it got lost! :o( Here goes again then...
Ok, 2 main ways of doing this, depending on where you're declaring your child form. I'll use the local scope version, which is probably not the best way to do it, but easier for me to explain!
class ParentForm
{
string m_UserName;
private void OnButton1Click()
{
// declare new attack form
AttackForm myChildForm = new AttackForm();
if (myChildForm.ShowDialog() == DialogResult.OK)
{
// retrieve variables from Attack Form instance
m_UserName = myChildForm.myName;
}
}
}
In the AttackForm you'll need to introduce a property to return the variable (not certain 'Property' is the correct terminology), e.g.
public string myName
{
get
{
return tbxUserName.Text;
}
}
Hope this helps. I do need to mention I'm new to C#, so any mistakes above, please forgive me. I've built a simple app to demonstrate what I'm doing and it worked for me!
Cheers,
Greg
Greg37 pointsPosted Jan 12, 2007, 1:10 AM EST
Aww man - typed out a massive reply to this post, and it got lost! :o( Here goes again then...
Ok, 2 main ways of doing this, depending on where you're declaring your child form. I'll use the local scope version, which is probably not the best way to do it, but easier for me to explain!
class ParentForm
{
string m_UserName;
private void OnButton1Click()
{
// declare new attack form
AttackForm myChildForm = new AttackForm();
if (myChildForm.ShowDialog() == DialogResult.OK)
{
// retrieve variables from Attack Form instance
m_UserName = myChildForm.myName;
}
}
}
In the AttackForm you'll need to introduce a property to return the variable (not certain 'Property' is the correct terminology), e.g.
public string myName
{
get
{
return tbxUserName.Text;
}
}
Hope this helps. I do need to mention I'm new to C#, so any mistakes above, please forgive me. I've built a simple app to demonstrate what I'm doing and it worked for me!
Cheers,
Greg
Former memberPosted Jan 12, 2007, 3:43 PM EST
Former memberPosted Jan 12, 2007, 3:43 PM EST
Michael32 pointsPosted Jan 13, 2007, 4:06 PM EST
protected Form myChild;
public Form MyChild{
get{return myChild;}
set{myChild = value;}
}
the add the following to the child form
parent.MyChild = me;
this has to be called after you've canged the this.ParentForm
Michael32 pointsPosted Jan 13, 2007, 4:06 PM EST
protected Form myChild;
public Form MyChild{
get{return myChild;}
set{myChild = value;}
}
the add the following to the child form
parent.MyChild = me;
this has to be called after you've canged the this.ParentForm