473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Resize dialog

I am new in VB.Net, I need some help.

I want to resize my dialogs dynamically (so that a dialog made for
1280x1024 screens shows properly on 800x640 screen. I make the
calculation in the Handles MyBase.Load event sub Everything works fine,
except if the original screen exceeds the size of the new screen. Some
debugging shows that

frm.Height = CType((frm.Height - bgtl) * heightRatio + bgtl, Integer)

with

frm.Height = 798, bgtl = 22, heightRatio = 2.0

results 1036, instead of the 1574 (in a 1280 x 1024 screen) . Apparently
the set height is cut off artificially (I set Maximum Size 2000,2000,
w/o involving the case).

Is there any variable in form, where I can find the set size.

What is the reason to cut off my set?

Independent question: Why is the size and Location integer instead of
Single?

I am using VB.NET 2003 Professional edition on Windows XP Professional
Nov 21 '05 #1
5 5610
Hi,

I am not sure if you have to do calculations at all using .NET. You need to
design your dialog to fit in the smallest resolution, say, 800x600, and then
you decide which controls on your dialog can be expanded and in which
direction(s) when the dialog is resized. Then, you can use the Anchor and
Dock properties of controls and .NET does this automatically when the user
resizes your dialog. Initially you present the dialog to the user in the
original size, but if you set the SizeGripStyle of the form to true, a
visual clue is shown to the user in the bottom-right corner of the dialog
and he will realize that he can resize it. Then, when the user unloads the
dialog you save its size and you use it the next time.

About the other question, Size and Location are integers, no need for
decimals, and the capacity of an Integer in .NET (32 bits) is enough to hold
the value.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"gilgames" <Gl***@netscape.net> escribió en el mensaje
news:vl*****************@newssvr31.news.prodigy.co m...
I am new in VB.Net, I need some help.

I want to resize my dialogs dynamically (so that a dialog made for
1280x1024 screens shows properly on 800x640 screen. I make the calculation
in the Handles MyBase.Load event sub Everything works fine, except if the
original screen exceeds the size of the new screen. Some debugging shows
that

frm.Height = CType((frm.Height - bgtl) * heightRatio + bgtl, Integer)

with

frm.Height = 798, bgtl = 22, heightRatio = 2.0

results 1036, instead of the 1574 (in a 1280 x 1024 screen) . Apparently
the set height is cut off artificially (I set Maximum Size 2000,2000, w/o
involving the case).

Is there any variable in form, where I can find the set size.

What is the reason to cut off my set?

Independent question: Why is the size and Location integer instead of
Single?

I am using VB.NET 2003 Professional edition on Windows XP Professional

Nov 21 '05 #2
"gilgames" <Gl***@netscape.net> wrote in message
news:vl*****************@newssvr31.news.prodigy.co m...
I want to resize my dialogs dynamically (so that a dialog made for
1280x1024 screens shows properly on 800x640 screen.
First problem - you're trying to work the wrong way around.
/Build/ on 8x6, /allow/ for bigger (if only because the numbers scale
/up/ far better than they scale down.

Secondly, VB.Net has some nice features for Anchor'ing and
Dock'ing controls together that make arranging your form far easier.
I just hope that VB.2005 gets them working properly with /inherited/
Forms!

Thirdly (and this is a personal observation) I /wouldn't/ want your
application to do this anyway. I run at higher resolutions so I can
get more applications side-by-side on the same screen real estate,
not to have a dialog that fills the screen at 8x6 /still/ fill the screen
at a higher resolution.
Is there any variable in form, where I can find the set size.
Oddly, the Size property (and MinimumSize and MaximumSize,
as well, if you want).
Independent question: Why is the size and Location integer
instead of Single?


Because .Net measures everything in Pixels and fractions of a
pixel are pretty meaningless, another reason to multiply up for
bigger screens, rather than deividing down for smaller ones.

HTH,
Phill W.
Nov 21 '05 #3
<<
I am not sure if you have to do calculations at all using .NET. You need
to design your dialog to fit in the smallest resolution, say, 800x600,
and then you decide which controls on your dialog can be expanded and in
which direction(s) when the dialog is resized.


I have vison problem. The opera browser provides an easy resolution: I
can resize the fonts on the loded page interactively.

I want to implement the same feature in VB net, I want people with worse
vision increase the size of the dialog until they see it properly. For
the same reason would I need the Single size type, not the length but
the precision is the problem: 1% change is not followed by integers
Nov 21 '05 #4
Gilgames,
As Carlos suggested I would design the form at the minimum size, the scale
it up.

Increasing a form by 1%, even with integers should be easy.

However!

Charles Petzold's book "Programming Microsoft Windows With Microsoft Visual
Basic .NET - Core Reference" from MS Press includes a sample on using the
Control.Scale method to dynamically change the size of all controls on the
form to a "fixed" size.

Simplifying Charles' example, if you want simple increase/decrease the
"zoom" factor try:

Private Sub ZoomIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ZoomIn.Click
Scale(1.1F)
End Sub

Private Sub ZoomOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ZoomOut.Click
Scale(0.9F)
End Sub

Where ZoomIn & ZoomOut are buttons on your form, clicking ZoomIn will
increase the form by 10%, clicking ZoomOut will decrease the form by 10%.

I would recommend you review Charles' code if you want to zoom to fixed
amounts (such as zoom to 100%, or 120%)...

Hope this helps
Jay
"gilgames" <Gl***@netscape.net> wrote in message
news:n%******************@newssvr33.news.prodigy.c om...
<<
I am not sure if you have to do calculations at all using .NET. You need
to design your dialog to fit in the smallest resolution, say, 800x600, and
then you decide which controls on your dialog can be expanded and in which
direction(s) when the dialog is resized.


I have vison problem. The opera browser provides an easy resolution: I can
resize the fonts on the loded page interactively.

I want to implement the same feature in VB net, I want people with worse
vision increase the size of the dialog until they see it properly. For the
same reason would I need the Single size type, not the length but the
precision is the problem: 1% change is not followed by integers

Nov 21 '05 #5
Doh!
Also review Charles' code to see how to get the Font to scale as well...

Something like:

Private Sub ZoomIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ZoomIn.Click
Zoom(1.1F)
End Sub

Private Sub ZoomOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ZoomOut.Click
Zoom(0.9F)
End Sub

Private Sub Zoom(ByVal ratio As Single)
Scale(ratio)
Font = New Font(Font.FontFamily, Font.Size * ratio)
End Sub
Hope this helps
Jay
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:u2*************@TK2MSFTNGP14.phx.gbl...
Gilgames,
As Carlos suggested I would design the form at the minimum size, the scale
it up.

Increasing a form by 1%, even with integers should be easy.

However!

Charles Petzold's book "Programming Microsoft Windows With Microsoft
Visual Basic .NET - Core Reference" from MS Press includes a sample on
using the Control.Scale method to dynamically change the size of all
controls on the form to a "fixed" size.

Simplifying Charles' example, if you want simple increase/decrease the
"zoom" factor try:

Private Sub ZoomIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ZoomIn.Click
Scale(1.1F)
End Sub

Private Sub ZoomOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ZoomOut.Click
Scale(0.9F)
End Sub

Where ZoomIn & ZoomOut are buttons on your form, clicking ZoomIn will
increase the form by 10%, clicking ZoomOut will decrease the form by 10%.

I would recommend you review Charles' code if you want to zoom to fixed
amounts (such as zoom to 100%, or 120%)...

Hope this helps
Jay
"gilgames" <Gl***@netscape.net> wrote in message
news:n%******************@newssvr33.news.prodigy.c om...
<<
I am not sure if you have to do calculations at all using .NET. You need
to design your dialog to fit in the smallest resolution, say, 800x600,
and then you decide which controls on your dialog can be expanded and in
which direction(s) when the dialog is resized.
>>


I have vison problem. The opera browser provides an easy resolution: I
can resize the fonts on the loded page interactively.

I want to implement the same feature in VB net, I want people with worse
vision increase the size of the dialog until they see it properly. For
the same reason would I need the Single size type, not the length but the
precision is the problem: 1% change is not followed by integers


Nov 21 '05 #6

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

Similar topics

17
by: Alex Blekhman | last post by:
Hello, I'm experienced Windows programmer, however, I'm quite novice in HTML technologies. Recently I was assigned a task to write small utility for internal use in our development team. I...
2
by: Mark B | last post by:
2nd post: Does anyone know how to set the height of a form passed the inbuilt limit? I want to set the height of a form so that it will fill a portrait page when printing. When the screen...
0
by: Tony | last post by:
Hello everyone, I am using a Help.ShowHelp to provide help files for my windows application, but the help dialog it pops up is a bit too small for my help file, but i have no idea how to resize it...
1
by: Lucas Dalmasso | last post by:
How do i do to resize a dialog box??? thanks
0
by: Abubakar | last post by:
Hi, I'm working on a SDI application using MFC ( vc2k5). I have a class that inherits from CDialogBar and is called CDlgbar2. Inside this bar I place a dialog that has a label and a dropdown...
3
by: CJMHotmail | last post by:
Hi, How can I resize the RichTextBox with a dialog window? When I maximum the dialog window, the RichTextBox is not resized. Any one can help?? Thanks. cjm
3
by: JT | last post by:
have a VB6 project that on the form I have set the BorderStile to 2 - sizable and created a function to resize the form and its controls min or max. Although, I am trying to find a way to...
1
by: traviscoop | last post by:
I have a modal dialog that opens up a url with my content in an iframe, I do this so the content can post back to itself, etc., I want the modal dialog to only be as big as it needs to be to show all...
5
by: rahulnag22 | last post by:
Hi, Is there a way to resize the width of the "tkMessageBox.askyesno" dialog box, so that the text does not wrap to the next line. Thanks Rahul
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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,...
0
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
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.