Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / July 2007

Tip: Looking for answers? Try searching our database.

Beginner question: How do I position controls in a GroupBox?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Enkidu - 17 Jul 2007 11:53 GMT
I'm trying to add TextBoxes in a square 'array' into a GroupBox. It
looks like I have to, for each TextBox, get the size of the GroupBox,
calculate position of each TextBox, set the Location of the TextBox to a
new Location object with the calculated coordinates and the TextBox
should then be located in the correct position. I'd much rather say, for
example, left gap equals x%, top gap = y%, draw the TextBox, dimensions
a% by b%, move right z%, draw the next TextBox and so on.

What I'm aiming for is a square of TextBoxes which form a playing grid,
much like a chessboard.

I guess the answer to the question is "I wouldn't do it that way, and I
suggest you do it this way...." sort of thing.

Any help would be appreciated.

Cheers,

Cliff

Signature

Have you ever noticed that if something is advertised as 'amusing' or
'hilarious', it usually isn't?

Bram - 17 Jul 2007 12:52 GMT
Hi Enkidu,

The control you are looking for is the TableLayoutPanel. This .NET 2.0
control allows you to do exactly what you want to do.

Cheers,
Bram

> I'm trying to add TextBoxes in a square 'array' into a GroupBox. It
> looks like I have to, for each TextBox, get the size of the GroupBox,
[quoted text clipped - 20 lines]
> Have you ever noticed that if something is advertised as 'amusing' or
> 'hilarious', it usually isn't?
Peter Duniho - 17 Jul 2007 19:03 GMT
> The control you are looking for is the TableLayoutPanel. This .NET 2.0
> control allows you to do exactly what you want to do.

Alternatively, depending on the exact behavior desired, the  
FlowLayoutPanel may be preferable.

In either case, just put the panel inside the GroupBox, then add your  
TextBox instances to the ...LayoutPanel programmatically as necessary.

Pete
Enkidu - 18 Jul 2007 09:52 GMT
>> The control you are looking for is the TableLayoutPanel. This .NET 2.0
>> control allows you to do exactly what you want to do.
[quoted text clipped - 4 lines]
> In either case, just put the panel inside the GroupBox, then add your
> TextBox instances to the ...LayoutPanel programmatically as necessary.

Thanks guys!

Cheers,

Cliff

Signature

Have you ever noticed that if something is advertised as 'amusing' or
'hilarious', it usually isn't?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.