Solved

Center groupbox in panel

Posted on 2008-10-13
3
1,882 Views
Last Modified: 2013-12-17
VS2008 - Winforms - C#

I am trying to center a groupbox within a panel... what isn't right in this code?


// Center horizontally.
this.grpLogin.Left = (this.panel1.Width - this.grpLogin.Width) \ 2;

// Center vertically.
this.grpLogin.Top = (this.panel1.Height - this.grpLogin.Height) \ 2;
0
Comment
Question by:conrad2010
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 22706717
Try this way instead:
// Center horizontally.

this.grpLogin.Left = (this.panel1.Width - this.grpLogin.Width) / 2;
 

// Center vertically.

this.grpLogin.Top = (this.panel1.Height - this.grpLogin.Height) / 2;

Open in new window

0
 

Author Closing Comment

by:conrad2010
ID: 31505681
I *am* in need of some coffee!
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22707030
It's Monday :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
No row return after calling the fillschema method 4 40
Open a word document 23 33
Error on link 14 39
How can my static class become undefined?? 8 21
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now