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

Center a Label in a form/panel

Is there any easy way of centering a label in a form or panel?
I can dock, and anchor but not get my label to stay centered,
short of resorting to playing with the top and left properties of
the label each time the form is resized or the label changed.

Cheers
Chris.

Jun 25 '07 #1
2 50142

"theinvisibleGhost" <th***************@yahoo.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
Is there any easy way of centering a label in a form or panel?
I can dock, and anchor but not get my label to stay centered,
short of resorting to playing with the top and left properties of
the label each time the form is resized or the label changed.
I assume you Dock.Fill and turn AutoSize off in your label, and then set
your text alignment to be Middle.

Haven't tried it myself though.

Kev
Jun 25 '07 #2
On Jun 25, 12:00 pm, "Mantorok" <n...@none.comwrote:
"theinvisibleGhost" <theinvisibleGh...@yahoo.comwrote in message

news:11**********************@k79g2000hse.googlegr oups.com...
Is there any easy way of centering a label in a form or panel?
I can dock, and anchor but not get my label to stay centered,
short of resorting to playing with the top and left properties of
the label each time the form is resized or the label changed.

I assume you Dock.Fill and turn AutoSize off in your label, and then set
your text alignment to be Middle.

Haven't tried it myself though.

Kev
Ah that's got it, I had the autosize turned to on.
Cheers =)

Jun 25 '07 #3

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

Similar topics

2
by: Alexander | last post by:
Hi, I have a simple Problem. I want to center a dialog on a panel of an application. I do the following: public class MyDialog : System.Windows.Forms.Form { private Panel m_ParentPanel; ...
2
by: Burstock | last post by:
I have a page that uses a Panel server control with a vertical scroll bar. It is in a table on the page that uses a Master page for it basic layout. Occasionally, when the page displays in IE (not...
2
by: Dinesh | last post by:
Dear All, Can u tell me how to center align a div (Panel) in Asp.Net 2.0. If we use align="center" then it will be converted to text-align:center which will align all the content of the div's...
4
by: x taol | last post by:
i want to display the image in center of form wherever the image located in the form using vba or and so on. *** Sent via Developersdex http://www.developersdex.com ***
12
by: Adil Akram | last post by:
I'm using VS 2005, .net 2.0 for a desktop application (Window Form app). I can't set ZOrder of Panel control neither at design time by toolbar/menu command "Bring to Front"/"Sent to Back" nor at...
4
by: Phillip Vong | last post by:
Using VS2005 / VB.NET / ASP.NET Newbie trying to learn. I have a simple label and I want to center this on the page, but I can not. When I hightlight this in VS2005 and say to center it, it...
4
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
I have a usercontrol that has a panel as a band across the width of the user control When the usercontrol is diaplayed the button is not centered. If I anchor the button to the panel...
1
by: Tbone | last post by:
I am designing my web forms around a 640x480 display resolution. How can I center my form horizontally so it is not crammed into the left corner on larger displays?
5
by: Mahyog | last post by:
Hello everyone, I want to dynamically change location of button, label and panel within the form that can be automatically appear when I restore and maximize the form. Please guys help me. ...
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
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
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
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
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,...

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.