[program-l] Re: VB: Laying out items

  • From: "Corbett, James" <James.Corbett@xxxxxxxxxxxxxxx>
  • To: "'program-l@xxxxxxxxxxxxx'" <program-l@xxxxxxxxxxxxx>
  • Date: Thu, 22 Sep 2005 10:12:35 -0400

David:

Don't go away mad, just go away! <smile> Hey that gives me an idea, what do
you think of JFW.net?

Jim 

-----Original Message-----
From: David Lant [mailto:david.lant@xxxxxxxxxxxx]
Sent: September 22, 2005 10:05 AM
To: 'program-l@xxxxxxxxxxxxx'
Subject: [program-l] Re: VB: Laying out items


Hi Jim,

Ah, but you can code in COBOL and RPG in .NET now, so the same techniques
apply even there these days. <grin>

David Lant

I.T. Consultant 
Consultancy & Development
ICT Services
Tel: (01392) 382464

Devon County Council accepts no legal responsibility for the contents of
this message. The views expressed do not reflect those of Devon County
Council.


-----Original Message-----
From: Corbett, James [mailto:James.Corbett@xxxxxxxxxxxxxxx] 
Sent: 22 September 2005 14:56
To: 'program-l@xxxxxxxxxxxxx'
Subject: [program-l] Re: VB: Laying out items


David and Mark:

What has happened to the good old days when all programmers were anal
retentive and coded everything by hand because they were all control
freaks... I give up and I am going back to COBOL and RPG.

Jim 

-----Original Message-----
From: David Lant [mailto:david.lant@xxxxxxxxxxxx]
Sent: September 22, 2005 9:45 AM
To: 'program-l@xxxxxxxxxxxxx'
Subject: [program-l] Re: VB: Laying out items


There is, in the meantime, the Docking and Anchoring feature that should
enable a fair bit of resizing and moving of controls in a form when it is
resized.  I don't think it covers all beans, but it should take care of the
basics at least.  It's not as intuitive as the control grid sounds though.

David Lant

I.T. Consultant 
Consultancy & Development
ICT Services
Tel: (01392) 382464

Devon County Council accepts no legal responsibility for the contents of
this message. The views expressed do not reflect those of Devon County
Council.


-----Original Message-----
From: Mark Long [mailto:Mark.Long@xxxxxxxxxxxxx] 
Sent: 22 September 2005 14:29
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: VB: Laying out items


Actually, I would say that it is good practice. We have features to allow
controls to "stick" to one of the form boundaries to automate this process
to some degree.

The version of VB after VS.NET 2005 is Orca and that will support control
grids where controls can be assigned to a grid position and will
automatically resize and move as required when the form size changes. If you
place and size your controls in code, you will be several years ahead of the
curve in a sense.

Mark

-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx]
On Behalf Of Will Pearson
Sent: 22 September 2005 14:06
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: VB: Laying out items

Hi Che,

Yes, there's nothing wrong in sizing your controls using code, even creating

controls on your form using code.  It's often common place for someone to at

least modify the initial sizes and locations of controls in response to 
various events the user invokes, say resizing a form, and creating controls 
dynamically using code allows someone to modify the display in response to 
the current state of the application.

Within the code there's various properties to modify positions and
sizes:
Height
Width
Top
Bottom
Left
Right
Size
Location

Plus there's some more that are useful if you are creating your own 
controls, i.e.. you're not using the system supplied control classes such as

button controls, edit controls, etc.

Sizing controls in code offers one advantage over the Windows Forms 
designer, at least for a blind person.  You can use:
System.Drawing.Graphics.MeasureString
to work out the height and width of a text string.  This allows you to 
determine what the height and width of a control should be in order to fit 
in a text string that you wish to have as a label, item, etc.  You can then 
add any spacing you wish to have between the text and the control's border, 
and you have then worked out the size for the control.  One tip that I have 
if you decide to take the code route, is to use math to work out where each 
control should be located and it's size.  Position your first control 
relative to a point on the form, and then each control's location should be 
relative to other controls that you have already positioned on the form.

This formulaic approach is useful if you want to reposition your controls 
when the user resizes the form, as all you have to do is alter a few 
variables in the calculation and then re-run the algorithm.  When a user

resizes a form you can do one of three things:
1. Not allow them to resize the form, i.e.. have it at a constant fixed size
2. Reposition, and maybe resize, your controls to fit them into the new area

of the form
3. Leave the control's positions and sizes as they were originally, covering

up any non-visible areas if they shrink the form's size, or leaving a margin

of whitespace should they expand the form's size beyond the original size
which one is appropriate is up to how you want to design your application.

If you want to use the Windows Forms designer, then once you've selected the

control you wish to move or resize, select properties from the context menu 
and alter the properties associated with the location and size.  Using the 
Windows Forms designer can be a quicker method to using code, and has the 
advantage of allowing you to show the form's design to someone and getting 
their feedback on whether it looks OK without having to put in all the code 
to create and successfully compile the code for the form.

Working in the field of human computer interaction, I would encourage you to

layout a form according to the needs and expectations of your target users. 
A couple of useful tricks are not to cram too many things close together, as

this hinders a user's ability to quickly visually differentiate between the 
different controls, e.g.. two buttons placed very close together could be 
perceived as one big button if they are too close together.  The second 
trick is to group controls that have similar functionality, or perform 
actions on the same object, together by having less spacing between these 
controls than you would controls that have very distinctive functionality 
from one another, something that again is a trick that leverages perceptual 
psychology.

Will
----- Original Message ----- 
From: "Che" <che@xxxxxxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Wednesday, September 21, 2005 8:44 PM
Subject: [program-l] VB: Laying out items


>  So how do blind programmers lay out their design form in studio?  I
know 
> you can move items with the arrow keys and all, but how do you tell if

> things are laid out properly, or lined up and so forth.  For instance,
how 
> do you line up labels with appropriate text fields?
>  Thanks for any advice,
>  Signed,
>  Slowly making progress
> ** To leave the list, click on the immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
> ** If this link doesn't work then send a message to:
> ** program-l-request@xxxxxxxxxxxxx
> ** and in the Subject line type
> ** unsubscribe
> ** For other list commands such as vacation mode, click on the
> ** immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
> ** or send a message, to
> ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
> 


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: