Change Form ClientSize : Form Properties « GUI Windows Forms « C# / CSharp Tutorial

C# / CSharp Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statement
5. String
6. struct
7. Class
8. Operator Overload
9. delegate
10. Attribute
11. Data Structure
12. Assembly
13. Date Time
14. Development
15. File Directory Stream
16. Preprocessing Directives
17. Regular Expression
18. Generic
19. Reflection
20. Thread
21. I18N Internationalization
22. GUI Windows Forms
23. 2D
24. Design Patterns
25. Windows
26. XML
27. ADO.Net
28. Network
29. Directory Services
30. Security
31. unsafe
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / CSharp Tutorial » GUI Windows Forms » Form Properties 
22. 5. 1. Change Form ClientSize
Change Form ClientSize
using System;
using System.Drawing;
using System.Windows.Forms;

public class FormClientSize : Form
{
  private Button btnShow;
  private Button btnChange;
  private Label lbl;

  public FormClientSize()
  {
    BackColor = Color.LightBlue;
    ForeColor = Color.DarkBlue;
    ClientSize = new Size(350,200);
    Width = 350;
    Height = 200;

    btnShow = new Button();
    btnShow.Location = new Point(50,50);
    btnShow.Size = new Size(100,23);
    btnShow.Text = "Show";
    btnShow.Click += new System.EventHandler(btnShow_Click);
    btnShow.Parent = this;

    btnChange = new Button();
    btnChange.Location = new Point(200,50);
    btnChange.Size = new Size(100,23);
    btnChange.Text = "Change";
    btnChange.Click += new System.EventHandler(btnChange_Click);
    btnChange.Parent = this;

    lbl = new Label();
    lbl.Text = "Control Size and Location";
    lbl.Size = new Size(400,25);
    lbl.Parent = this;
  }

  static void Main() 
  {
    Application.Run(new FormClientSize());
  }

  private void btnShow_Click(object sender, EventArgs e)
  {
    Console.WriteLine("Button Bottom:" + btnShow.Bottom.ToString());
    Console.WriteLine("Button Top:" + btnShow.Top.ToString() );
    Console.WriteLine("Button Left:" + btnShow.Left.ToString() );
    Console.WriteLine("Button Right:" + btnShow.Right.ToString() );
    Console.WriteLine("Button Location:" + btnShow.Location.ToString() );
    Console.WriteLine("Button Width:" + btnShow.Width.ToString() )
    Console.WriteLine("Button Height:" + btnShow.Height.ToString() );
    Console.WriteLine("Button Size:" + btnShow.Size.ToString() );
    Console.WriteLine("Button ClientSize:" + btnShow.ClientSize.ToString() );
    Console.WriteLine("Form Size:" this.Size.ToString() );
    Console.WriteLine("Form ClientSize:" this.ClientSize.ToString());
  }

  private void btnChange_Click(object sender, EventArgs e)
  {
    this.Size = new Size(800,200);
  }
}
22. 5. Form Properties
22. 5. 1. Change Form ClientSizeChange Form ClientSize
22. 5. 2. Form.StartPosition
22. 5. 3. Form with Maximize BoxForm with Maximize Box
22. 5. 4. Form without MinimizeBox and MaximizedBoxForm without MinimizeBox and MaximizedBox
22. 5. 5. Set form background colorSet form background color
22. 5. 6. Set form captionSet form caption
22. 5. 7. Set Form sizeSet Form size
22. 5. 8. Set Form Height
22. 5. 9. Set Form Width
22. 5. 10. Set FormBorderStyle
22. 5. 11. Center Form to the screenCenter Form to the screen
22. 5. 12. Resize redraw form: get/set Form styleResize redraw form: get/set Form style
22. 5. 13. Form Bounds SettingForm Bounds Setting
22. 5. 14. Form Opacity setting
22. 5. 15. Use Form.DialogResult
w_w___w__.__j__av_a2_s_._c_o___m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.