本文整理汇总了C#中Form.PointToScreen方法的典型用法代码示例。如果您正苦于以下问题:C# Form.PointToScreen方法的具体用法?C# Form.PointToScreen怎么用?C# Form.PointToScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form.PointToScreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public static Rectangle Draw(Pen pen, Form parent)
{
sPen = pen;
// Record the start point
mPos = parent.PointToClient(Control.MousePosition);
// Create a transparent form on top of the parent form
mMask = new Form();
mMask.FormBorderStyle = FormBorderStyle.None;
mMask.BackColor = Color.Magenta;
mMask.TransparencyKey = mMask.BackColor;
mMask.ShowInTaskbar = false;
mMask.StartPosition = FormStartPosition.Manual;
mMask.Size = parent.ClientSize;
mMask.Location = parent.PointToScreen(Point.Empty);
mMask.MouseMove += MouseMove;
mMask.MouseUp += MouseUp;
mMask.Paint += PaintRectangle;
mMask.Load += DoCapture;
// Display the overlay
mMask.ShowDialog(parent);
// Clean-up and calculate return value
mMask.Dispose();
mMask = null;
Point pos = parent.PointToClient(Control.MousePosition);
int x = Math.Min(mPos.X, pos.X);
int y = Math.Min(mPos.Y, pos.Y);
int w = Math.Abs(mPos.X - pos.X);
int h = Math.Abs(mPos.Y - pos.Y);
return new Rectangle(x, y, w, h);
}