473,811 Members | 2,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resize a .NET form

Rob
I want to resize the height of a form without resizing the width,
therefore I tried:

Private Sub Form1_Resize(By Val sender As Object, ByVal e As System.EventArg s) Handles MyBase.Resize

Me.Width = 226

End Sub

However this causes a lot of flickering on my form. How can I turn
off the flickering ?

Please help, RS

Aug 1 '07 #1
4 1800
"Rob" <rl*****@worldn et.att.netschri eb
I want to resize the height of a form without resizing the width,
therefore I tried:

Private Sub Form1_Resize(By Val sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Resize

Me.Width = 226

End Sub

However this causes a lot of flickering on my form. How can I turn
off the flickering ?

Example:

Imports System.Runtime. InteropServices

Public Class Form1

<StructLayout(L ayoutKind.Seque ntial)_
Private Structure MinMaxInfo
Public reserved As Point
Public maxSize As Point
Public maxPosition As Point
Public minTrackSize As Point
Public maxTrackSize As Point
End Structure

Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)

Const WM_GETMINMAXINF O As Integer = &H24

MyBase.WndProc( m)

If m.Msg = WM_GETMINMAXINF O Then
Dim mmi As MinMaxInfo

mmi = DirectCast( _
Marshal.PtrToSt ructure(m.LPara m, GetType(MinMaxI nfo)), _
MinMaxInfo _
)

mmi.maxTrackSiz e.X = 226
mmi.minTrackSiz e.X = 226

Marshal.Structu reToPtr(mmi, m.LParam, True)
End If

End Sub

End Class


Armin
Aug 1 '07 #2
Rob wrote:
I want to resize the height of a form without resizing the width,
Private Sub Form1_Resize(By Val sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Resize
Me.Width = 226
End Sub
However this causes a lot of flickering on my form.
Fix the width of the form using MinimumSize and MaximumSize:

Me.MinimumSize = New Size( 226, 0 )
Me.MaximumSize = New Size( 226, 600 ) ' say

Better still, get the current screen size and use that for the maximum
height instead - I can't' remember the code just at the moment.

HTH,
Phill W.
Aug 1 '07 #3
Better still, get the current screen size and use that for the maximum
height instead - I can't' remember the code just at the moment.
I'm guessing you're referring to either
Screen.PrimaryS creen.Bounds.He ight or
Screen.PrimaryS creen.WorkingAr ea.Height

Thanks,

Seth Rowe

Aug 1 '07 #4
rowe_newsgroups wrote:
>Better still, get the current screen size and use that for the maximum
height instead - I can't' remember the code just at the moment.

I'm guessing you're referring to either
Screen.PrimaryS creen.Bounds.He ight or
Screen.PrimaryS creen.WorkingAr ea.Height
That's the ones!

WorkingArea is the better of the two, taking into account those awkward
people (like me) who move the Start bar around the screen and make it a
different size ... ;-)

Regards,
Phill W.
Aug 2 '07 #5

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

Similar topics

1
2347
by: Roger | last post by:
Hi All, I have an app where I change the size of the form at run time using controls and I do not want the user to be able to resize the form, I have removed the min and max buttons. I have tried to set the min and max size to what I want but now the form will not resize when they should be, it looks like I could change the min and max size everytime I want to resize the form but this seems a little cumbersome - - any easy way of doing...
3
3271
by: Z D | last post by:
Hello, BACKGROUND: ============== I've created a Windows User Control that contains an Image Control (among other controls). The user control handles the picture resize event. Whenever the parent that holds my user control is resized, I resize my image so that it uses the maximum available space. Note: It takes about 2 seconds to regenerate the
1
3133
by: Diogo Alves - Software Developer | last post by:
Hi there, Since my last questions wasn't very clear, I will do it in a different way. I want to resize my app but while resizing I dont want to see content of the form, I just want to see the window border, then on release, the form reappears, just like when we use "Show window contents while dragging" on the windowsXP appearance settings... Any Ideas in how to do it?
4
3492
by: Rob Richardson | last post by:
Greetings! I have a form with a listview, a menu, and a few text boxes, labels and command buttons. I want to resize the listview when the form is resized to that the widths of the spaces between the borders of the listview and the borders of the form remain constant. I am finding this to be unexpectedly hard. For one thing, I initialized some values in the form's Load event, and I'm doing the control resizing in the form's Resize...
2
1508
by: DraguVaso | last post by:
Hi, I have to DataGrid's on a form, one on the top of my form, the other at the bottom, but they though each other somewhere in the middle. What I want now is that, when I resize the form, they resize in the same proportions: So when I resize the Form with 50%, they each have to resize with 50%. The maximum what I can achieve now is that one of them resizes, and the other keeps the same height, if I don't do it like that one of the...
8
6388
by: nirdeshonline | last post by:
Hi, I have added a simple listbox in windows form under c# 2.0. It contains a collection of approx 10 strings as list items. Now when i resize the form whole listbox flickers. Please tell me any feasible solution, i need to use a checked listbox which also has same flickering problem on resize. Thanks & Regards
11
3478
by: Ajith Menon | last post by:
I have created a windows application in which the form needs to be resized on the MouseMove event. The windows resize function takes a lot of CPU cycles. And as the resize function is called on the MouseMove, the form is resized around a 30-100 times in one second. This leads to a high CPU utilization and all other application comes to a stand still. The form does not have any controls i.e. buttons, text boxes etc. It is completely...
2
3365
by: Smitty | last post by:
Did a search & found nothing on this. VB6 did a resize on form load according to what I've read. I Resized screen under vista & now the text box doesn't resize to form's clientarea. Code exists under form1.resize_click Works when I resize the form and also when I include a call to resize under form load event Is this due to vs2005, vista or some other querk?
1
5609
by: Bob Alston | last post by:
I have a system where many subforms are used. Often the size of the subform had to be larger than could be displayed without scrolling. I set the height of the subform to the typical height appropriate for the typical screen resolution they were using. Now some users have decided to use higher screen resolutions, up to 1280/1024. When they maximize the form, that of course works but the size of the main form control containing the...
10
44092
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their screen. I used to write code in Java a few years ago (2005), and you could stretch a form with the mouse and all the controls and fonts would resize to larger or smaller size. Does .Net framework 3.5 support this kind of functionality? Or -...
0
9722
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
10644
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
10379
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
10393
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
10124
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
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4334
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
3015
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.