Hi,
I've made a form with a label which is transparent.
I've also got a contextmenustrip with an item that makes it possible to hide the formframe :
this
.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
When I execute this code, the frame hides, but the complete forms moves up the height of the frame (I can live with this), but also the background (which is transparent) moves up (without repainting).
I don't know if this explains the problem enough, so I will give an example.
Let's say you move the form to a place where the top of the transparent area is the beginnen of a color area in the background (let's say red) and the area above is green. when I rightclick to get my contextmenustrip and I select "hide frame" then the frame goes away, but the transparent area (and the rest on the form) moves up and the background that was red is still red where it should be green.
I tried this.Refresh() and this.Update(), but things don't get fixed :$
I even tried to move the form (this.Left+=100 and then this.Left-=100) but this also doesn't fix the problem.
Is there another way to get the background correct

Windowsform : hideframe with transparency
XiaoLin
KrishnaKumar Sivasubramanian
Hmm For example: if your form will be located over the VS 2005 toolstrip butons and u press that button and u will see the same efect as u said but if you got with the mouse over the Tool Strip of VS2005 you will see that VS will repaint himself and the "i dont know how to call it" will dissapre
hayedid
still the same problem :$
The background of the transparent area is still not what it should be.
jandrews
and you`re right the refresh doesnt work
when the button is pushed the form border dissaper
but the form(withoud the any border) is moved where the the form was before we pressed the button was, and that si 20 pixils upper exact the form border height
i think the refresh doesnt work because it`s nothing to paint
Eivind__no09
Code sample (to use as a test) :
private void Form1_Load(object sender, EventArgs e){
this.TransparencyKey = Color.Blue; Panel myTransparentPanel = new Panel(); this.Controls.Add(myTransparentPanel);myTransparentPanel.Dock =
DockStyle.Fill; Button myHideFrameButton = new Button();myTransparentPanel.BackColor =
Color.Blue;myTransparentPanel.Top = 10;
myTransparentPanel.Left = 10;
myHideFrameButton.Width = 100;
myHideFrameButton.Height = 50;
myHideFrameButton.BackColor =
Color.Red;myHideFrameButton.Text =
"Hide frame";myTransparentPanel.Controls.Add(myHideFrameButton);
myHideFrameButton.Click +=
new EventHandler(myHideFrameButton_Click);}
void myHideFrameButton_Click(object sender, EventArgs e){
this.FormBorderStyle = FormBorderStyle.None; //throw new Exception("The method or operation is not implemented.");}
When you execute the code and place the top of the button on the bottom of an other underlying frameborder and you press the button you will see that the underlying frameborder gets interrupted. That isn't supposed to happen.
Jeff Glenn
Hardascii
John Maloney
i dont really understand what is your problem
sl1pm4t
void myHideFrameButton_Click(object sender, EventArgs e)
{
int x=this.Location.X;
int y=this.Location.Y;
this.FormBorderStyle = FormBorderStyle.None;
this.Location=new Point(x,y);
}
this should work