本文整理汇总了C#中System.Windows.Forms.Form.RectangleToClient方法的典型用法代码示例。如果您正苦于以下问题:C# Form.RectangleToClient方法的具体用法?C# Form.RectangleToClient怎么用?C# Form.RectangleToClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.RectangleToClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTrackerRect
public virtual void DrawTrackerRect(Rectangle Rect, Form ClipToFrm,Graphics gs,Control frm)
{
Rectangle rect = Rect;
// convert to client coordinates
if (ClipToFrm != null)
{
rect=ClipToFrm.RectangleToScreen(rect);
rect=ClipToFrm.RectangleToClient(rect);
}
Size size=new Size(0, 0);
if (!m_bFinalErase)
{
// otherwise, size depends on the style
if ((m_nStyle & StyleFlags.hatchedBorder)!=0)
{
size.Width = size.Height = Math.Max(1, GetHandleSize(rect)-1);
rect.Inflate(size);
}
else
{
size.Width = CX_BORDER;
size.Height = CY_BORDER;
}
}
if (m_bFinalErase || !m_bErase)
{
Rectangle rcScreen = frm.RectangleToScreen(rect);
Rectangle rcLast = frm.RectangleToScreen(m_rectLast);
DrawDragRect(gs,rcScreen,rcLast);
}
// remember last rectangles
m_rectLast = rect;
m_sizeLast = size;
}
示例2: TestPublicMethods
public void TestPublicMethods ()
{
// Public Methods that force Handle creation:
// - CreateGraphics ()
// - GetChildAtPoint ()
// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
// - PointToClient ()
// - PointToScreen ()
// - RectangleToClient ()
// - RectangleToScreen ()
// - Select ()
// - Show (IWin32Window)
// Notes:
// - CreateControl does NOT force Handle creation!
Form c = new Form ();
c.BringToFront ();
Assert.IsFalse (c.IsHandleCreated, "A1");
c.Contains (new Form ());
Assert.IsFalse (c.IsHandleCreated, "A2");
c.CreateControl ();
Assert.IsFalse (c.IsHandleCreated, "A3");
c = new Form ();
Graphics g = c.CreateGraphics ();
g.Dispose ();
Assert.IsTrue (c.IsHandleCreated, "A4");
c.Dispose ();
c = new Form ();
c.Dispose ();
Assert.IsFalse (c.IsHandleCreated, "A5");
c = new Form ();
// This is weird, it causes a form to appear that won't go away until you move the mouse over it,
// but it doesn't create a handle??
//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
//Assert.IsFalse (c.IsHandleCreated, "A6");
//Assert.AreEqual (DragDropEffects.None, d, "A6b");
//Bitmap b = new Bitmap (100, 100);
//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
//Assert.IsFalse (c.IsHandleCreated, "A7");
//b.Dispose ();
c.FindForm ();
Assert.IsFalse (c.IsHandleCreated, "A8");
c.Focus ();
Assert.IsFalse (c.IsHandleCreated, "A9");
c.GetChildAtPoint (new Point (10, 10));
Assert.IsTrue (c.IsHandleCreated, "A10");
c.Dispose ();
c = new Form ();
c.GetContainerControl ();
Assert.IsFalse (c.IsHandleCreated, "A11");
c.Dispose ();
c = new Form ();
c.GetNextControl (new Control (), true);
Assert.IsFalse (c.IsHandleCreated, "A12");
c.GetPreferredSize (Size.Empty);
Assert.IsFalse (c.IsHandleCreated, "A13");
c.Hide ();
Assert.IsFalse (c.IsHandleCreated, "A14");
c.Invalidate ();
Assert.IsFalse (c.IsHandleCreated, "A15");
//c.Invoke (new InvokeDelegate (InvokeMethod));
//Assert.IsFalse (c.IsHandleCreated, "A16");
c.PerformLayout ();
Assert.IsFalse (c.IsHandleCreated, "A17");
c.PointToClient (new Point (100, 100));
Assert.IsTrue (c.IsHandleCreated, "A18");
c.Dispose ();
c = new Form ();
c.PointToScreen (new Point (100, 100));
Assert.IsTrue (c.IsHandleCreated, "A19");
c.Dispose ();
c = new Form ();
//c.PreProcessControlMessage ???
//c.PreProcessMessage ???
c.RectangleToClient (new Rectangle (0, 0, 100, 100));
Assert.IsTrue (c.IsHandleCreated, "A20");
c.Dispose ();
c = new Form ();
c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
Assert.IsTrue (c.IsHandleCreated, "A21");
c.Dispose ();
c = new Form ();
c.Refresh ();
//.........这里部分代码省略.........