本文整理匯總了C#中System.Windows.Forms.Form.DesktopBounds屬性的典型用法代碼示例。如果您正苦於以下問題:C# Form.DesktopBounds屬性的具體用法?C# Form.DesktopBounds怎麽用?C# Form.DesktopBounds使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.DesktopBounds屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MoveMyForm
public void MoveMyForm()
{
// Create a Rectangle object that will be used as the bound of the form.
Rectangle tempRect = new Rectangle(50,50,100,100);
// Set the bounds of the form using the Rectangle object.
this.DesktopBounds = tempRect;
}
示例2: Main
//引入命名空間
using System;
using System.Drawing;
using System.Windows.Forms;
class FormSize: Form
{
public static void Main()
{
Application.Run(new FormSize());
}
public FormSize()
{
BackColor = Color.White;
}
protected override void OnMove(EventArgs ea)
{
Invalidate();
}
protected override void OnResize(EventArgs ea)
{
Invalidate();
}
protected override void OnPaint(PaintEventArgs pea)
{
Graphics graphics = pea.Graphics;
string str = "Location: " + Location + "\n" +
"Size: " + Size + "\n" +
"Bounds: " + Bounds + "\n" +
"Width: " + Width + "\n" +
"Height: " + Height + "\n" +
"Left: " + Left + "\n" +
"Top: " + Top + "\n" +
"Right: " + Right + "\n" +
"Bottom: " + Bottom + "\n\n" +
"DesktopLocation: " + DesktopLocation + "\n" +
"DesktopBounds: " + DesktopBounds + "\n\n" +
"ClientSize: " + ClientSize + "\n" +
"ClientRectangle: " + ClientRectangle;
graphics.DrawString(str, Font, Brushes.Black, 0, 0);
}
}