[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Center groupbox in panel

Posted on 2008-10-13
3
Medium Priority
?
1,923 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

649 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