473,387 Members | 1,721 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,387 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 5607
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...

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.