PC Review


Reply
Thread Tools Rate Thread

Re: smooth resize

 
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Apr 2004
Hi Jim,

There are great properties for that in VB.net.

The Dock, that resizes smoothly with your form (you have only to set
probably a lot of panels)
The Anchor with wich you can do the same by the way, achoring it to let say
to the right and the top, and than the length goes smootly with your form.

I hope this helps?

Cor


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      12th Apr 2004
* "Cor Ligthert" <(E-Mail Removed)> scripsit:
> The Anchor with wich you can do the same by the way, achoring it to let say
> to the right and the top, and than the length goes smootly with your form.


How to resize the space between the controls and keep the size constant?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Apr 2004
Hi Herfried,

You make me always so happy when I can help you with your code

I hope this helps

(You understand I did not type this in, it is all changed from the designer)

:-))

Cor

\\\
Dim TextBox1 As New TextBox
Dim Panel1 As New Panel
Dim Panel2 As New Panel
Dim Panel3 As New Panel
Dim TextBox2 As New TextBox
TextBox1.Anchor = CType(((AnchorStyles.Top Or AnchorStyles.Left) _
Or AnchorStyles.Right), AnchorStyles)
TextBox1.Location = New System.Drawing.Point(0, 8)
TextBox1.Size = New System.Drawing.Size(192, 20)
Panel1.Controls.Add(TextBox1)
Panel1.Dock = DockStyle.Left
Panel1.Location = New System.Drawing.Point(0, 0)
Panel1.Size = New System.Drawing.Size(200, 374)
Panel2.Dock = DockStyle.Fill
Panel2.Location = New System.Drawing.Point(200, 0)
Panel2.Size = New System.Drawing.Size(408, 374)
Panel3.Controls.Add(TextBox2)
Panel3.Dock = DockStyle.Right
Panel3.Location = New System.Drawing.Point(384, 0)
Panel3.Name = "Panel3"
Panel3.Size = New System.Drawing.Size(224, 374)
Panel3.TabIndex = 3
TextBox2.Anchor = CType(((AnchorStyles.Top Or AnchorStyles.Left) _
Or AnchorStyles.Right), AnchorStyles)
TextBox2.Location = New System.Drawing.Point(0, 8)
TextBox2.Size = New System.Drawing.Size(224, 20)
AutoScaleBaseSize = New System.Drawing.Size(5, 13)
ClientSize = New System.Drawing.Size(608, 374)
Controls.Add(Panel3)
Controls.Add(Panel2)
Controls.Add(Panel1)
///


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      12th Apr 2004
Cor,

* "Cor Ligthert" <(E-Mail Removed)> scripsit:
> You make me always so happy when I can help you with your code
>
> I hope this helps
>
> (You understand I did not type this in, it is all changed from the designer)


Your code works, but it doesn't exactly do what I wanted to to:

+##################+
| |
| XXXXXX XXXXXX |
| |
| XXXXXX XXXXXX |
| |
+------------------+

=>

+########################+
| |
| |
| XXXXXX XXXXXX |
| |
| |
| XXXXXX XXXXXX |
| |
| |
+------------------------+

I want to be able to do that without any panels with any number of controls.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
=?Utf-8?B?SmltVA==?=
Guest
Posts: n/a
 
      12th Apr 2004
Thanx, Cor

I copied your example and tried it. The two text boxes stayed anchored to the edges of their panels. I added a button to panel2, and when I resized, the button stretched. Checked the function of "AnchorStyles" and changed to "none." When I resized, the button moved as I wanted it to, but it didn't stretch

Like Herfried, I would now like to either get rid of the panels altogether, or create a single panel co-extant with the form

I'm off to make another spearmint

Thanx again

JimT
 
Reply With Quote
 
=?Utf-8?B?SmltVA==?=
Guest
Posts: n/a
 
      12th Apr 2004
The spearmint was a limited success. I put a bunch of buttons on the form and set their anchor properties to "none". When I resized, all the buttons moved as a group, keeping their relative positions constant. When I maximized the screen there was this little cluster of buttons in the middle of a vast wasteland. It's close, but not exactly what I intended

I must admit, however, that the resizing is as smooth as silk

Now, how do I get the space between the buttons to expand without expanding the buttons themselves

Thanx

JimT
 
Reply With Quote
 
Peter Huang
Guest
Posts: n/a
 
      13th Apr 2004
Hi Jim,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to resize the form and
reposition the controls on the forms according to the original layout.(i.e.
maintain the proportion)
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think so far VS.NET did not provide the feature to maintain the controls
layout proportion on the form when resizing. Usually we use the method as
Cor said.
Here is two articles about use the Anchor and panel to do the job.
Designing Resizable Windows Forms in Visual Studio .NET
http://www.devx.com/dotnet/Article/6964/1954?pf=true

Planning the form layout in VB.NET
http://www.codeproject.com/vb/net/pflvb7.asp

If you do not want to use the above method, I think we may have to do the
computation of the controls layout ourselves.
e.g.
We can set he location of the controls in the Layout event.

Me.Button1.Location = New Point(0.1 * Me.Width, 0.2 * Me.Height)
Me.Button2.Location = New Point(0.5 * Me.Width, 0.2 * Me.Height)

If you still have any concern on this issue, please feel free to let me
know.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Peter Huang
Guest
Posts: n/a
 
      15th Apr 2004
Hi Jim,

Did my suggestion help you?
If you still have any concern on this issue, please feel free to post here
and I will work on you with it.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How does Excel smooth chart data when smooth option is selected? =?Utf-8?B?TGFycnk=?= Microsoft Excel Charting 1 19th Apr 2007 05:40 AM
I could NOT resize the axis title but excel allows me to resize gr =?Utf-8?B?SXdhbiBTZXRpeW9ubyBLbw==?= Microsoft Excel Charting 4 6th Jun 2006 04:46 AM
RESIZE PROPERTY: is it possible to resize "up" and "to the left"? Myles Microsoft Excel Programming 1 22nd Mar 2006 05:57 AM
I could NOT resize the axis title but excel allows me to resize gr =?Utf-8?B?SXdhbiBTZXRpeW9ubyBLbw==?= Microsoft Excel Charting 0 15th Mar 2006 11:34 AM
Riddle me this: Mdi FormBorderStyle.none code resize vs. border resize Bob Microsoft Dot NET Framework Forms 0 9th Aug 2004 03:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:51 AM.