窗体和客户区的常用属性

FormSize.cs
1 using System;
2  using System.Drawing;
3 using System.Windows.Forms;
4
5 class FormSize: Form
6 {
7 public static void Main()
8 {
9 Application.Run(new FormSize());
10 }
11 public FormSize()
12 {
13 Text = "Form Size";
14 BackColor = Color.White;
15 }
16 protected override void OnMove(EventArgs ea)
17 {
18 Invalidate();
19 }
20 protected override void OnResize(EventArgs ea)
21 {
22 Invalidate();
23 }
24 protected override void OnPaint(PaintEventArgs pea)
25 {
26 Graphics grfx = pea.Graphics;
27 string str = "Location: " + Location + "\n" +
28 "Size: " + Size + "\n" +
29 "Bounds: " + Bounds + "\n" +
30 "Width: " + Width + "\n" +
31 "Height: " + Height + "\n" +
32 "Left: " + Left + "\n" +
33 "Top: " + Top + "\n" +
34 "Right: " + Right + "\n" +
35 "Bottom: " + Bottom + "\n\n" +
36 "DesktopLocation: " + DesktopLocation + "\n" +
37 "DesktopBounds: " + DesktopBounds + "\n\n" +
38 "ClientSize: " + ClientSize + "\n" +
39 "ClientRectangle: " + ClientRectangle;
40
41 grfx.DrawString(str, Font, Brushes.Black, 0, 0);
42 }
43 }

 

posted @ 2011-01-09 11:07  ebusi2010  阅读(244)  评论(0编辑  收藏  举报