473,382 Members | 1,441 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,382 software developers and data experts.

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


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

--

Have you ever noticed that if something is advertised as 'amusing' or
'hilarious', it usually isn't?
Jul 17 '07 #1
3 2464
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

On Jul 17, 12:53 pm, Enkidu <enkidu....@com.cliffp.comwrote:
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

--

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

Jul 17 '07 #2
On Tue, 17 Jul 2007 04:52:06 -0700, Bram <b.*****@gmail.comwrote:
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
Jul 17 '07 #3
Peter Duniho wrote:
On Tue, 17 Jul 2007 04:52:06 -0700, Bram <b.*****@gmail.comwrote:
>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.
Thanks guys!

Cheers,

Cliff

--

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

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

Similar topics

44
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
2
by: phknox | last post by:
Due to a HD crash, I had to reinstall VS.net 2002. Now when I build my c# project, the controls on my windows form shrink. Each time I build, the controls shrink. I can resize them, but they...
0
by: dantheman | last post by:
Hi, i'm doing a programe in a few languages so i've found this code that iterates tru the forms controls and returns there names but the problem is after re-parenting the controls to optimize...
0
by: blue_nirvana | last post by:
Hello, I have a treeview, groupbox with some controls, and a datagrid on a form. The treeview is on the left of the form, the groupbox is at the top of the form, and the datagrid is below the...
7
by: RichG | last post by:
I want to lock all controls except the buttons on a form. I sometimes need the form to call lockForms(Me). public sub lockControls(frm as form) for each ctrl as control in frm if...
2
by: RichG | last post by:
With the help of Cor Ligthert in a pryor post I was able to make this sub: Public Sub disableControls(ByVal frm As Form) 'this is to create a read only form that has active buttons Dim x As...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
4
by: shilpichaudhry | last post by:
Hi: I need to have controls in groupBox, which should not be clipped as per the size of the group box. so if they are longer, the control like a text box should appear (unclipped) Thanks,...
7
by: RBrowning1958 | last post by:
here's an easy one for you guys - .NET form designer generates this: private System.ComponentModel.IContainer components = null; but I don't see it used anywhere in the generated code - what's...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.