468,765 Members | 916 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Trying to Resize an Active Form

I am trying to resize form1 aka (CipherForm) while the program is running.

I have Visual Studios 2003.

I have tried
Expand|Select|Wrap|Line Numbers
  1. private void CipherForm_Load(object sender, System.EventArgs e)
  2.         {
  3.             CipherForm h = new CipherForm(); 
  4.             h.Size = new Size(500, 500);
  5.         }
  6.  
What I want in the end is during an event the window will resize and exiting an event it will resize back.
Mar 18 '09 #1
7 2240
tlhintoq
3,525 Expert 2GB
Try...

h.Height = 500;
h.Width = 500;


As for "during an event"... An event is a rather instantaneous thing. You get an event at mouse down... you don't get continuous events while the mouse button is down. You get an event for ... the com port pin going low... you don't get continuous events for it.
Mar 18 '09 #2
Tried to do this to. It does not seem to resize.
Expand|Select|Wrap|Line Numbers
  1. private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
  2.         {
  3.             CipherForm h = new CipherForm(); 
  4.             h.Size = new Size(500, 500);
  5.             h.Height = 500;
  6.             h.Width = 500;
  7.  
  8.             KeyInstruction1.Visible = true;
  9.             KeyIn.Visible = true;
  10.             MaskEnbl.Visible = true;
  11.             MaskEnbl.Enabled = true;
  12.             KeyIn.Enabled = true;
  13.         }
  14.  
trying to resize of an ok from an openfile dialog
Mar 18 '09 #3
tlhintoq
3,525 Expert 2GB
Please use [code] tags.

As near as I can see there is nothing yet shown to even tell if it is resizing.
Line 3 you make a new form
You then make changes to the new form.
At no point do you .Show() the new form.
Mar 18 '09 #4
Ohhhhhh....

Yeah that pops up a new form. Ok! But I wanted to resize the old form, not create a new form. Unless I can make the old form disapear while the new form is active. Do you know how to do this.

As you can tell I am quite new to this
Mar 18 '09 #5
Plater
7,872 Expert 4TB
use the this keyword to refer to the current form(assuming the code you are writing is running on the form you want to resize)
Mar 18 '09 #6
Yes!!!!!!!!!!!!!! Thanks that worked :) .
Mar 18 '09 #7
tlhintoq
3,525 Expert 2GB
... Otherwise use the reference to the first instance of your CypherForm.

At some point you had to make it. You assigned it to something.
Mar 18 '09 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Mark Constant | last post: by
3 posts views Thread by Z D | last post: by
1 post views Thread by Diogo Alves - Software Developer | last post: by
4 posts views Thread by Rob Richardson | last post: by
2 posts views Thread by DraguVaso | last post: by
8 posts views Thread by nirdeshonline | last post: by
11 posts views Thread by Ajith Menon | last post: by
2 posts views Thread by Smitty | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.