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
 
 
 
 
 
TitleSet a form's client area size in Visual Basic .NET
DescriptionThis example shows how to set a form's client area size in Visual Basic .NET.
Keywordssize, client area, ClientSize, form, VB.NET
CategoriesControls, VB.NET, Graphics
 
When you click the radio buttons, the program sets the form's ClientSize to a new Size value. It saves the new client width and height in variables and invalidates the form. The Paint event handler then draws an ellipse that touches the edges of the client area.
 
Dim m_Wid As Integer
Dim m_Hgt As Integer

Private Sub rad300x200_CheckedChanged(...) Handles _
    rad300x200.CheckedChanged
    Me.ClientSize = New Size(300, 200)

    m_Wid = 300
    m_Hgt = 200
    Me.Invalidate()
End Sub

Private Sub rad400x400_CheckedChanged(...) Handles _
    rad400x400.CheckedChanged
    Me.ClientSize = New Size(400, 400)

    m_Wid = 400
    m_Hgt = 400
    Me.Invalidate()
End Sub

Private Sub Form1_Paint(...) Handles MyBase.Paint
    e.Graphics.DrawEllipse(Pens.Red, 0, 0, m_Wid - 1, m_Hgt _
        - 1)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated