on maximum size changed

  • Thread starter Thread starter zach
  • Start date Start date
Z

zach

Could someone please refer me to an example
of implementing on maximum size changed.
I am wanting to do things when a form is minimized
and believe I can use on maximum size changed
to spark a method containing code to do the
things I want done.

Thanks,
Zach
 
Peter Duniho said:
zach said:
Could someone please refer me to an example
of implementing on maximum size changed.
I am wanting to do things when a form is minimized [...]

I would use the WindowStateChanged event instead. Any particular reason
you want to use the MaximumSizeChanged event instead? Especially since
minimizing a window isn't likely to cause that event to be raised?

Pete

Hi Pete,
You will be right. Could you please refer me to an example?
Many thanks,
Zach.
 
Peter Duniho said:
zach said:
[...]
I would use the WindowStateChanged event instead. Any particular reason
you want to use the MaximumSizeChanged event instead? Especially since
minimizing a window isn't likely to cause that event to be raised?

Hi Pete,
You will be right. Could you please refer me to an example?

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.sizechanged.aspx

Note that there's no WindowStateChanged event. I misspoke. You need to
track the SizeChanged event, and check the WindowState property to see if
it's changed from the last known value.

Pete
 
Peter Duniho said:
zach said:
[...]
I would use the WindowStateChanged event instead. Any particular reason
you want to use the MaximumSizeChanged event instead? Especially since
minimizing a window isn't likely to cause that event to be raised?

Hi Pete,
You will be right. Could you please refer me to an example?

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.sizechanged.aspx

Note that there's no WindowStateChanged event. I misspoke. You need to
track the SizeChanged event, and check the WindowState property to see if
it's changed from the last known value.

Pete

Pete, no sound on minimizing

public sealed partial class MainForm : Form
{
#region Instantiations.
Rectangle screen = Screen.PrimaryScreen.WorkingArea;
int size;
#endregion

#region Constructor.
public MainForm()
{
InitializeComponent();
// som code
this.SizeChanged +=new EventHandler(MainForm_SizeChanged);
size = screen.Width;

}
#endregion

void MainForm_SizeChanged(object sender, EventArgs e)
{
if(this.Width != size)
new Displays.WarnSound();
}

// some code
 
Peter Duniho said:
zach said:
[...]
I would use the WindowStateChanged event instead. Any particular reason
you want to use the MaximumSizeChanged event instead? Especially since
minimizing a window isn't likely to cause that event to be raised?

Hi Pete,
You will be right. Could you please refer me to an example?

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.sizechanged.aspx

Note that there's no WindowStateChanged event. I misspoke. You need to
track the SizeChanged event, and check the WindowState property to see if
it's changed from the last known value.

Pete

Pete I don't know how to do the SizeF stuff - establishing the size of the
display.

SizeF was = (SizeF)this.size;

is no good, what hould it be so I can compare was with is?
Zach.
 
zach said:
Peter Duniho said:
zach said:
[...]
I would use the WindowStateChanged event instead. Any particular
reason you want to use the MaximumSizeChanged event instead?
Especially since minimizing a window isn't likely to cause that event
to be raised?

Hi Pete,
You will be right. Could you please refer me to an example?

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.sizechanged.aspx

Note that there's no WindowStateChanged event. I misspoke. You need to
track the SizeChanged event, and check the WindowState property to see if
it's changed from the last known value.

Pete

Pete I don't know how to do the SizeF stuff - establishing the size of the
display.

SizeF was = (SizeF)this.size;

is no good, what hould it be so I can compare was with is?
Zach.

I have found out how to do it.

new Size( ..., ....)

Many thanks,
Zach.
 
Back
Top