473,782 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resizing a form

Hi there

I have a little problem.

How do i make sure that a graph is not redrawn while the form with the graph
is being resized ?
I have tried to add a mouse up/down event handler on the form1, but it
dosn't get called when resizing :(

I would like to be able to resize my form, but also make sure the graph is
only redrawn when the user is not resizing any more.

Hope my question make sense :)

--
Søren Reinke
www.Xray-Mag.com/ - Your free diving magazin on the net.
Current issue Diving in North America, 99 pages.
Download it in PDF
Nov 17 '05
12 6735
Nevermind, it's working perfectly so it must be right :-)
Here is the whole business in C#, in case that helps anyone...

---
// Variables having to do with the resizing code follow
protected bool bSizeMode = false;

/// <summary>
/// Windows Constants for WndProc call in BeginResize/EndResize events
/// </summary>
protected const int WM_SIZING = 0x214,
WM_ENTERSIZEMOV E = 0x231,
WM_EXITSIZEMOVE = 0x232,
WM_SYSCOMMAND = 0x112,
SC_SIZE = 0xF000;

/// <summary>
/// Fires once at the beginning of a resizing drag.
/// </summary>
public event EventHandler BeginResize;

/// <summary>
/// Fires once at the end of a resizing drag.
/// </summary>
public event EventHandler EndResize;
/// <summary>
/// Process Windows messages (in this case to provide Begin/EndResize events
/// </summary>
/// <param name="m"></param>
protected override void WndProc(ref Message m)
{
switch ( m.Msg )
{
case WM_SIZING:
// Resize event already provided
break;
case WM_SYSCOMMAND:
bSizeMode = ((m.WParam.ToIn t32() & 0xFFF0) == SC_SIZE);
break;
case WM_ENTERSIZEMOV E:
if ( bSizeMode )
{
OnBeginResize(E ventArgs.Empty) ;
}
break;
case WM_EXITSIZEMOVE :
{
if ( bSizeMode )
{
OnEndResize(Eve ntArgs.Empty);
}
break;
}

} // end switch
base.WndProc (ref m);
}
/// <summary>
/// Raise BeginResize event
/// </summary>
/// <param name="e"></param>
protected virtual void OnBeginResize(S ystem.EventArgs e)
{
if ( BeginResize != null )
BeginResize(thi s, e);
}

/// <summary>
/// Raise EndResize event
/// </summary>
/// <param name="e"></param>
protected virtual void OnEndResize(Sys tem.EventArgs e)
{
if ( EndResize != null )
EndResize(this, e);
}
---
Nov 17 '05 #11
You're right that VB's local Static variable must be declared as a Class
level variable in C#.

....and the translation looks good to me :-)

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Rachel Suddeth" <ra****@bldhoun d.com> wrote in message
news:ed******** *****@TK2MSFTNG P12.phx.gbl...
Nevermind, it's working perfectly so it must be right :-)
Here is the whole business in C#, in case that helps anyone...

---
// Variables having to do with the resizing code follow
protected bool bSizeMode = false;

/// <summary>
/// Windows Constants for WndProc call in BeginResize/EndResize events
/// </summary>
protected const int WM_SIZING = 0x214,
WM_ENTERSIZEMOV E = 0x231,
WM_EXITSIZEMOVE = 0x232,
WM_SYSCOMMAND = 0x112,
SC_SIZE = 0xF000;

/// <summary>
/// Fires once at the beginning of a resizing drag.
/// </summary>
public event EventHandler BeginResize;

/// <summary>
/// Fires once at the end of a resizing drag.
/// </summary>
public event EventHandler EndResize;
/// <summary>
/// Process Windows messages (in this case to provide Begin/EndResize
events
/// </summary>
/// <param name="m"></param>
protected override void WndProc(ref Message m)
{
switch ( m.Msg )
{
case WM_SIZING:
// Resize event already provided
break;
case WM_SYSCOMMAND:
bSizeMode = ((m.WParam.ToIn t32() & 0xFFF0) == SC_SIZE);
break;
case WM_ENTERSIZEMOV E:
if ( bSizeMode )
{
OnBeginResize(E ventArgs.Empty) ;
}
break;
case WM_EXITSIZEMOVE :
{
if ( bSizeMode )
{
OnEndResize(Eve ntArgs.Empty);
}
break;
}

} // end switch
base.WndProc (ref m);
}
/// <summary>
/// Raise BeginResize event
/// </summary>
/// <param name="e"></param>
protected virtual void OnBeginResize(S ystem.EventArgs e)
{
if ( BeginResize != null )
BeginResize(thi s, e);
}

/// <summary>
/// Raise EndResize event
/// </summary>
/// <param name="e"></param>
protected virtual void OnEndResize(Sys tem.EventArgs e)
{
if ( EndResize != null )
EndResize(this, e);
}
---

Nov 17 '05 #12
> Here is the whole business in C#, in case that helps anyone...

---


Thanks Rachel

I'll try to implement it soon.

--
Søren Reinke
www.Xray-Mag.com/ - Your free diving magazin on the net.
Current issue Diving in North America, 99 pages.
Download it in PDF
Nov 17 '05 #13

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

Similar topics

0
2626
by: TJ Talluto | last post by:
<facts> I have a "month calendar" that always displays exactly 42 days... and alongside is a vertical box that displays the detail (form fields) of any particular select event that appears on the calendar, so that the event may be changed, or a new event may be created. monthname X X X X X X X form X X X X X X X form X X X X X X X form
11
18837
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that they are too big and wind up covering up some of the fields on the main form. Is there any good code out there that works in a similar fashion that will also either a) stretch the form width wise on widescreens or b), rely on height rather than...
1
5216
by: Terry | last post by:
I've seen several posts from people who have seen this flashing in TreeView's when resizing a form. I've noticed it in my app, but only in the child windows. For example, my main form has a splitter with a TreeView and I do not get the flickering with it. I created a new Form based Windows app. Added a TreeView (dock left), then a splitter and a property grid on the right (dock fill). For this test, I added a panel and button at the...
4
6145
by: Thomas Richter | last post by:
Hi, I can't get of the black flicker when I resize my form. this = Mainform : System.Windows.Forms.Form If I set the size from 300 to 500 I see for ca 500ms some black areas. I try to solve it with: this.SetStyle(ControlStyles.DoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.ResizeRedraw, true); But it doesn't work.
6
51926
by: John Bowman | last post by:
Hi All, I must be missing something really obvious, so I'd appreciate someone helping me out. I have a simple Windows form that currently only has a title bar (aka the Text Property is set) and the MinmizeBox, ControlBox and MaximizeBox(es) are all set to false. It's FormBorderStyle is set to "Fixed Single". Eventually this form will have a nice background image. I need to use this form as sort of back drop while other forms/operations...
11
17873
by: Sharon | last post by:
I'm writing a new control derived from UserControl. I need to get an event when the control is done resizing. I tried the Resize, SizeChanged, Move and the Layout events and I also tried to override them. But they all invoked when the control is in the middle of the resizing process. I'm not using breakpoints, I'm using trace to see which one is invoked and when.
13
2511
by: Martin Ho | last post by:
I know this must be trivial for many of you. But I am playing with this and can't figure it out. I have a form, on that form is one panel which has 3 textboxes, when I run my program and maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving...
6
4548
by: JDeats | last post by:
I have a WinForms based application written for the .NET Framework 2.0 and in this application I need to be able to be able to take some action in code when the user finishes resizing the form. I can easily create an event handler for the SizeChanged form level event, the problem is if the user is using a mouse drag to resize the form this event is firing every few milliseconds or what have you until the user stops the drag process. ...
10
7078
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for only small sized iamages.. for eg. resizing takes place for 70 kb sized images but fails for 600kb or more.. my code is below..
0
9641
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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 we have to send another system
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.