473,466 Members | 1,296 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form1_Resize(..)

jj

I used the following code to trigger some actions when the form is resized.
It works fine ONLY when the form is restored or resized to smaller size. My
codes are not executed ( ibelieve...) when I try to maximize or resize it to
larger size.

Any hints are greatly appreciated.
Thanks
JJ
private boolean bLoaded ;

private void Form1_Load(object sender, System.EventArgs e)

{

bLoaded = false ;

this.Resize += new EventHandler(Form1_Resize);

bLoaded = true ;
}

private void Form1_Resize(object sender, System.EventArgs e)

{

if (bLoaded == true)

{

//My code here ;

}
Nov 17 '05 #1
2 4679
"jj" <jj@hotmail.com> wrote in message
news:u$**************@TK2MSFTNGP10.phx.gbl...

I used the following code to trigger some actions when the form is resized. It works fine ONLY when the form is restored or resized to smaller size. My codes are not executed ( ibelieve...) when I try to maximize or resize it to larger size.


It should work. Try this in a test project...

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Name = "Form1";
this.Text = "Form1";
this.Resize += new System.EventHandler(this.Form1_Resize);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Resize(object sender, System.EventArgs e)
{
MessageBox.Show( "Resize" );
}
}
}
--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Nov 17 '05 #2
It should work like that. Put a breakpoint in the event handler and debug
hrough to see if it is infact being called.

"jj" wrote:

I used the following code to trigger some actions when the form is resized.
It works fine ONLY when the form is restored or resized to smaller size. My
codes are not executed ( ibelieve...) when I try to maximize or resize it to
larger size.

Any hints are greatly appreciated.
Thanks
JJ
private boolean bLoaded ;

private void Form1_Load(object sender, System.EventArgs e)

{

bLoaded = false ;

this.Resize += new EventHandler(Form1_Resize);

bLoaded = true ;
}

private void Form1_Resize(object sender, System.EventArgs e)

{

if (bLoaded == true)

{

//My code here ;

}

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ayende Rahien | last post by:
I want to build a application where I've a fixed sidebar, and a replacable main area. (Think frames in HTML, where you've a menu on one side, and the real data on the other.) I build the...
6
by: Adnan Hebibovic | last post by:
Hello developers How can I detect Windows shutdown from .NET and I mean clean .NET not catching the events with Win32 API ... Thanks
1
by: Zanthor | last post by:
Ok, I've got a small App I'm trying to make minimize to the system tray... The behavior I'm after is that while the forms FormWindowState is Normal I want the form visible in the taskbar, when...
3
by: Poul C | last post by:
Hello With the code below I can resize all the components on a Form when ever the Form resizes. For the time beeing it dosn't allow a component to contain another component, but with a...
3
by: JJ | last post by:
I have athe following code, but nothing happens when I minimize or maximze the form using "top right corner minimze/maximize buttons". What am I missing!!!!! Help please!!!!!!!!!! Thanks JJ ...
1
by: JJ | last post by:
I have some custom actions to run after "Resizing a Form". I used the code below, but my actions are taken before the Form is completely resized. That is not what I wante. I wanted to Completely...
8
by: News Microsoft | last post by:
Hi there. I would like to know how can I test if a Form exists. This is the situation: I have a single Form in my application. My objective is, when I minimize the form, it will disapear and a...
2
by: Emre Sevinc | last post by:
Hello, I have a strange situation. I create a very simple Windows Forms application and place the code below however even though I place breakpoints in various event handling points VS.NET 2005...
2
by: null | last post by:
Hello I have a listbox in my form, which I want to clear if the form's hieght changes. I am having difficulty with that, as it seems when the form is minimised the height changes, this is not...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.