Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
TitleFind the area in which you should place things in a GroupBox in VB .NET
KeywordsDisplayRectangle, ClientRectangle, GroupBox
CategoriesVB.NET, Controls
 
A control's ClientRectangle property gives a Rectangle representing the client area inside the control. This is not necessarily the same as the area in which you should draw or place things. The DisplayRectangle property gives that area. For example, in a GroupBox, the ClientRectangle includes the area used by the control's caption and borders.

This example makes two labels cover the ClientRectangle and DisplayRectangle in a GroupBox so you can see where they are.

 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
    e As System.EventArgs) Handles MyBase.Load
    lblClientRectangle.Bounds = GroupBox1.ClientRectangle
    lblDisplayRectangle.Bounds = GroupBox1.DisplayRectangle
End Sub
 
Note that these properties are inherited from the Control class so IntelliSense doesn't list them. You need to type them yourself.
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated