473,657 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keeping controls centered

This is not actually a C# question but I'm not sure which newsgroup is
appropriate for
this question. My apologies if I'm being "off-topic".

I'm writing and application that has a group box that contains a bunch of
radio buttons
and wish to keep this group box and its buttons centered when the width of
the window
is changed. I do know how to accomplish this using code but I wonder if
there is a
simpler method? I'm using Visual Studio 2005 to write this application.

Regards
Chris Saunders
Feb 4 '07 #1
9 2053
On Feb 3, 9:57 pm, "Chris Saunders" <e...@mountainc able.netwrote:
This is not actually a C# question but I'm not sure which newsgroup is
appropriate for
this question. My apologies if I'm being "off-topic".

I'm writing and application that has a group box that contains a bunch of
radio buttons
and wish to keep this group box and its buttons centered when the width of
the window
is changed. I do know how to accomplish this using code but I wonder if
there is a
simpler method? I'm using Visual Studio 2005 to write this application.
You may be stuck doing this in code. The best chance you have for
doing it using layout containers would be the standard
TableLayoutPane l, but even that doesn't let you center things easily.
You could make a 3 x 3 table and put your control in the center. You
could then set the second row's RowStyle to Absolute, and the second
column's ColumnStyle to Absolute, and set the others to 50 Percent.

http://msdn2.microsoft.com/en-us/lib...rowstyles.aspx

If you're lucky, this will cause the center cell to stay the size you
want it, while allocating half the remaining space to the top and
bottom rows, and the right and left columns of the table layout. I
make no promises though: I haven't tried it myself. :-)

Also, check out the following;

http://msdn2.microsoft.com/en-us/library/ms171691.aspx
Feb 4 '07 #2
Chris Saunders wrote:
This is not actually a C# question but I'm not sure which newsgroup
is appropriate for this question. My apologies if I'm being
"off-topic".

I'm writing and application that has a group box that contains a
bunch of radio buttons and wish to keep this group box and its
buttons centered when the width of the window is changed. I do know
how to accomplish this using code but I wonder if there is a simpler
method? I'm using Visual Studio 2005 to write this application.
Simply anchor it only to the bottom of the form while pre-centering it
in the designer. Then when you resize the window, the groupbox will
stay centered.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Feb 4 '07 #3
On Feb 4, 2:07 am, "Frans Bouma [C# MVP]"
<perseus.usenet NOS...@xs4all.n lwrote:
Chris Saunders wrote:
This is not actually a C# question but I'm not sure which newsgroup
is appropriate for this question. My apologies if I'm being
"off-topic".
I'm writing and application that has a group box that contains a
bunch of radio buttons and wish to keep this group box and its
buttons centered when the width of the window is changed. I do know
how to accomplish this using code but I wonder if there is a simpler
method? I'm using Visual Studio 2005 to write this application.

Simply anchor it only to the bottom of the form while pre-centering it
in the designer. Then when you resize the window, the groupbox will
stay centered.
Really! I had no idea!

Does that work in 1.1 as well as 2.0? Or is it a WPF thing?

Feb 4 '07 #4
"Bruce Wood" <br*******@cana da.comwrote in message
news:11******** **************@ a34g2000cwb.goo glegroups.com.. .
On Feb 4, 2:07 am, "Frans Bouma [C# MVP]"
<perseus.usenet NOS...@xs4all.n lwrote:
>Chris Saunders wrote:
This is not actually a C# question but I'm not sure which newsgroup
is appropriate for this question. My apologies if I'm being
"off-topic".
I'm writing and application that has a group box that contains a
bunch of radio buttons and wish to keep this group box and its
buttons centered when the width of the window is changed. I do know
how to accomplish this using code but I wonder if there is a simpler
method? I'm using Visual Studio 2005 to write this application.

Simply anchor it only to the bottom of the form while
pre-centering it
in the designer. Then when you resize the window, the groupbox will
stay centered.

Really! I had no idea!

Does that work in 1.1 as well as 2.0? Or is it a WPF thing?
It's a .Net 2.0 Framework thing. It's easier in WPF (but it's about the
only thing that is). ;-)

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
Feb 4 '07 #5
RobinS wrote:
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.

Too funny

http://malaysia.answers.yahoo.com/qu...7140330AA2L1AQ
Feb 4 '07 #6
RobinS wrote:
"Bruce Wood" <br*******@cana da.comwrote in message
news:11******** **************@ a34g2000cwb.goo glegroups.com.. .
On Feb 4, 2:07 am, "Frans Bouma [C# MVP]"
<perseus.usenet NOS...@xs4all.n lwrote:
Chris Saunders wrote:
This is not actually a C# question but I'm not sure which
newsgroup >>is appropriate for this question. My apologies if I'm
being >>"off-topic".
>
I'm writing and application that has a group box that contains a
bunch of radio buttons and wish to keep this group box and its
buttons centered when the width of the window is changed. I do
know >>how to accomplish this using code but I wonder if there is a
simpler >>method? I'm using Visual Studio 2005 to write this
application.
>
Simply anchor it only to the bottom of the form while
pre-centering it
in the designer. Then when you resize the window, the groupbox
will stay centered.
Really! I had no idea!

Does that work in 1.1 as well as 2.0? Or is it a WPF thing?

It's a .Net 2.0 Framework thing. It's easier in WPF (but it's about
the only thing that is). ;-)

Nonsense, it works since .NET 1.0.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Feb 5 '07 #7
Bruce Wood wrote:
On Feb 4, 2:07 am, "Frans Bouma [C# MVP]"
<perseus.usenet NOS...@xs4all.n lwrote:
Chris Saunders wrote:
This is not actually a C# question but I'm not sure which
newsgroup is appropriate for this question. My apologies if I'm
being "off-topic".
I'm writing and application that has a group box that contains a
bunch of radio buttons and wish to keep this group box and its
buttons centered when the width of the window is changed. I do
know how to accomplish this using code but I wonder if there is a
simpler method? I'm using Visual Studio 2005 to write this
application.
Simply anchor it only to the bottom of the form while
pre-centering it in the designer. Then when you resize the window,
the groupbox will stay centered.

Really! I had no idea!

Does that work in 1.1 as well as 2.0? Or is it a WPF thing?
It works since .NET 1.0 :)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Feb 5 '07 #8

"Frans Bouma [C# MVP]" <pe************ ******@xs4all.n lwrote in message
news:xn******** *******@news.mi crosoft.com...
RobinS wrote:
>"Bruce Wood" <br*******@cana da.comwrote in message
news:11******* *************** @a34g2000cwb.go oglegroups.com. ..
On Feb 4, 2:07 am, "Frans Bouma [C# MVP]"
<perseus.usene tNOS...@xs4all. nlwrote:
Chris Saunders wrote:
This is not actually a C# question but I'm not sure which
newsgroup >>is appropriate for this question. My apologies if I'm
being >>"off-topic".
>
I'm writing and application that has a group box that contains a
bunch of radio buttons and wish to keep this group box and its
buttons centered when the width of the window is changed. I do
know >>how to accomplish this using code but I wonder if there is a
simpler >>method? I'm using Visual Studio 2005 to write this
application.
>
Simply anchor it only to the bottom of the form while
pre-centering it
in the designer. Then when you resize the window, the groupbox
will stay centered.

Really! I had no idea!

Does that work in 1.1 as well as 2.0? Or is it a WPF thing?

It's a .Net 2.0 Framework thing. It's easier in WPF (but it's about
the only thing that is). ;-)


Nonsense, it works since .NET 1.0.

FB
I stand corrected! Thanks!
Robin S.
Feb 5 '07 #9
My thanks to all who responded to this question. I've been ill so I didn't
see the responses until today.
The group box I wanted to stay centered was at the top of the window so I
anchored it to the top alone
and this worked fine. Thanks again.

Regards
Chris Saunders

"Frans Bouma [C# MVP]" <pe************ ******@xs4all.n lwrote in message
news:xn******** *******@news.mi crosoft.com...
Chris Saunders wrote:
>This is not actually a C# question but I'm not sure which newsgroup
is appropriate for this question. My apologies if I'm being
"off-topic".

I'm writing and application that has a group box that contains a
bunch of radio buttons and wish to keep this group box and its
buttons centered when the width of the window is changed. I do know
how to accomplish this using code but I wonder if there is a simpler
method? I'm using Visual Studio 2005 to write this application.

Simply anchor it only to the bottom of the form while pre-centering it
in the designer. Then when you resize the window, the groupbox will
stay centered.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------

Feb 6 '07 #10

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

Similar topics

8
11093
by: Freek te Water | last post by:
Hi, Hope no-one is offended by my probably noob question... Context: I have a web page design, which always centres in the middle of the screen (using a 100%*100% HTML-table). Now I also use layers, that get visible when something is clicked. All works fine. Problem:
17
6882
by: No One | last post by:
Is there a way to keep a control centered inside a form without having to recalculate everytime the form is resized?
3
1351
by: Ryan Wade | last post by:
If the user resizes IE I want the webform controls to be automatically repositioned in the center of the form. How can I accomplish this? Ryan
15
2173
by: Arpan | last post by:
Consider the following code which retrieves data from a SQL Server 2005 DB table & displays it in a DataGrid: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Dim dSet As DataSet Dim sqlConn As SqlConnection Dim sqlDapter As SqlDataAdapter sqlConn = New SqlConnection("Data Source=AD\SQLEXPRESS;Initial
7
2011
by: TheLongshot | last post by:
I just recently converted a few pages of my application to using master pages. Problem is, in all of my content pages, the contents are centered. I can't figure out why. The markup in the content page seems to ignore any attempts to manually align right. So what's the deal?
0
8407
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8512
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8612
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.