当前位置: 首页>>代码示例>>C#>>正文


C# Control.PointToClient方法代码示例

本文整理汇总了C#中System.Windows.Forms.Control.PointToClient方法的典型用法代码示例。如果您正苦于以下问题:C# Control.PointToClient方法的具体用法?C# Control.PointToClient怎么用?C# Control.PointToClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Control的用法示例。


在下文中一共展示了Control.PointToClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetRelativePosition

	    public System.Drawing.PointF GetRelativePosition(Control c) {
	    	System.Drawing.Point relPoint;
	    	System.Drawing.PointF relPointF;
	    	relPoint = c.PointToClient(new System.Drawing.Point((int)ScreenX,(int)ScreenY));
	    	relPointF = new System.Drawing.PointF(relPoint.X + ScreenX - (float)((int)ScreenX),
	    	                                      relPoint.Y + ScreenY - (float)((int)ScreenY));
	    	return relPointF;
	    }
开发者ID:sanyaade-g2g-repos,项目名称:knack,代码行数:8,代码来源:TabletForm.cs

示例2: FindTopControl

 public static Control FindTopControl(Control parent, Point screen_pt)
 {
     Control c = parent.GetChildAtPoint(parent.PointToClient(screen_pt));
     if (c == null) {
         if (parent.RectangleToScreen(new Rectangle(0, 0, parent.Width, parent.Height)).Contains(screen_pt))
             return parent;
         else
             return null;
     }
     else
         return FindTopControl(c, screen_pt);
 }
开发者ID:FNKGino,项目名称:poderosa,代码行数:12,代码来源:WinFormsUtil.cs

示例3: GetVisibleChildAtDesktopPoint

 private static Control GetVisibleChildAtDesktopPoint( Control topControl, Point desktopPoint )
 {
     Control foundControl = topControl.GetChildAtPoint( topControl.PointToClient( desktopPoint ) );
     if (foundControl != null)
     {
         if (foundControl.HasChildren)
         {
             foreach (Control control in foundControl.Controls)
             {
                 foundControl = GetVisibleChildAtDesktopPoint(control, desktopPoint);
                 if (foundControl != null && foundControl.Visible)
                     break;
             }
         }
     }
     return foundControl ?? topControl;
 }
开发者ID:UtrsSoftware,项目名称:ATMLWorkBench,代码行数:17,代码来源:UTRSFormUtilities.cs

示例4: requestColorDialog

        public static Color requestColorDialog(Control sender)
        {
            Color res = Color.Empty;
            ContextMenuStrip cm = new ContextMenuStrip();
            var ColorDic = new Dictionary<string, Color>();

            ColorDic.Add("Red", Color.Red);
            ColorDic.Add("Blue", Color.Blue);
            ColorDic.Add("Yellow", Color.Yellow);
            ColorDic.Add("Green", Color.Green);
            ColorDic.Add("Transparent", Color.FromArgb(0, 255, 255, 255));

            foreach ( KeyValuePair<string, Color> pair in ColorDic)
            {
                Bitmap bmp = new Bitmap(10, 10);
                for(int k = 0; k < bmp.Width; k++)
                {
                    for(int v = 0; v < bmp.Height; v++)
                    {
                        bmp.SetPixel(k, v, pair.Value);
                    }
                }
                cm.Items.Add(new ToolStripMenuItem(pair.Key, bmp, (s, e) => { res = pair.Value; }));
            }
            cm.Items.Add(new ToolStripMenuItem("Custom...", new Bitmap(1, 1), (s, e) => { res = oldDialogPicker(); }));

            cm.Show(sender, sender.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y)));
            cm.Focus();
            while (cm.Visible == true) { Application.DoEvents(); }
            return res;
        }
开发者ID:Enoz,项目名称:InfiniPad,代码行数:31,代码来源:Globals.cs

示例5: Input

        public Input(Control control)
        {
            Control = control;

            _keysDown = new List<Keys>();
            _keysPressed = new List<Keys>();
            _keysReleased = new List<Keys>();
            _mousePoint = control.PointToClient(Cursor.Position);
            _mouseWheelDelta = 0;
        }
开发者ID:raiker,项目名称:BulletSharp,代码行数:10,代码来源:Input.cs

示例6: ShowForScope

 public void ShowForScope(Control control, Point pos)
 {
     List<Rectangle> rects = textBox.GetSurroundingRects(scope);
     Point screenPoint = control.PointToScreen(pos);
     Point clientPoint = control.PointToClient(screenPoint);
     Rectangle hitTest = new Rectangle(clientPoint, new Size(4,4));
     if(rects.Count>0)
     {
     //                ShowUnderScopeRect(rects[0], control.PointToScreen(pos), control);
         foreach (Rectangle rect in rects)
         {
             if(rect.IntersectsWith(hitTest))
             {
                 ShowUnderScopeRect(rect, control.PointToScreen(pos), control);
                 return;
             }
         }
         base.Show(control, pos);
     }
     else
     {
         base.Show(control, pos);
     }
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:24,代码来源:SmartContextMenu.cs

示例7: RenderControlBgImage

 public static void RenderControlBgImage(this Control destination, Control source, PaintEventArgs e)
 {
     var loc = source.PointToClient((destination.Parent ?? Program.MainWindow).PointToScreen(destination.Location));
     if (source.BackgroundImage != null) e.Graphics.DrawImage(source.BackgroundImage, e.ClipRectangle, loc.X + e.ClipRectangle.X, loc.Y + e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height, GraphicsUnit.Pixel);
 }
开发者ID:GoogleFrog,项目名称:Zero-K-Infrastructure,代码行数:5,代码来源:Utils.cs

示例8: FormIsHit

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// finds the potential dockhost control at the specified location
		/// </summary>
		/// ------------------------------------------------------------------------------------
		internal bool FormIsHit(Control c, Point pt)
		{
			if (c == null)
				return false;

			Point pc = c.PointToClient(pt);
			bool hit = c.ClientRectangle.IntersectsWith(new Rectangle(pc, new Size(1, 1))); //.TopLevelControl; // this is tricky
			return hit;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:DockExtender.cs

示例9: method_1

 private void method_1(Control container, Control control, Graphics g, Rectangle bounds)
 {
     if (container.ClientRectangle.Width > 0 && container.ClientRectangle.Height > 0 && bounds.Width > 0 && bounds.Height > 0)
     {
         var p1 = control.PointToClient(container.PointToScreen(new Point(0, 0)));
         var p2 = control.PointToClient(container.PointToScreen(new Point(container.ClientRectangle.Right, 0)));
         using (var brush = new LinearGradientBrush(p1, p2, LayoutBackgroundColor1, LayoutBackgroundColor2))
             g.FillRectangle(brush, bounds);
     }
 }
开发者ID:javagg,项目名称:DemoDock,代码行数:10,代码来源:ThemeAwareRendererBase.cs

示例10: GetMouseEventArgs

 /// <summary>
 /// Returns NShapeMouseEventArgs extracted from information provided by the <see cref="T:System.Windows.Forms.Control" /> class.
 /// </summary>
 public static MouseEventArgsDg GetMouseEventArgs(Control control, MouseEventType eventType, int clicks, int delta)
 {
     Point mousePos = control.PointToClient(Control.MousePosition);
     return GetMouseEventArgs(eventType, Control.MouseButtons, clicks, mousePos.X, mousePos.Y, delta, control.Bounds);
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:8,代码来源:WinFormHelpers.cs

示例11: Show

        public void Show(Control control, Rectangle area)
        {
            if (control == null)
            {
                throw new ArgumentNullException("Parent control could not be null");
            }
            SetOwnerItem(control);

            Point location = control.PointToScreen(new Point(area.Left, area.Top + area.Height));
            Rectangle screen = Screen.FromControl(control).WorkingArea;
            if (location.X + Size.Width > (screen.Left + screen.Width))
            {
                location.X = (screen.Left + screen.Width) - Size.Width;
            }
            if (location.Y + Size.Height > (screen.Top + screen.Height))
            {
                location.Y -= Size.Height + area.Height;
            }
            location = control.PointToClient(location);
            Show(control, location, ToolStripDropDownDirection.BelowRight);
        }
开发者ID:e-Deniska,项目名称:easyMoney,代码行数:21,代码来源:Popup.cs

示例12: UpdateTargetState

        /// <summary>
        /// Set the correct visual state of the target.
        /// </summary>
        /// <param name="c">Owning control.</param>
        protected void UpdateTargetState(Control c)
        {
            // Check we have a valid control to convert coordinates against
            if ((c != null) && !c.IsDisposed)
            {
                // Ensure control is inside a visible top level form
                Form f = c.FindForm();
                if ((f != null) && f.Visible)
                {
                    UpdateTargetState(c.PointToClient(Control.MousePosition));
                    return;
                }
            }

            UpdateTargetState(new Point(int.MaxValue, int.MaxValue));
        }
开发者ID:yp25,项目名称:Krypton,代码行数:20,代码来源:GalleryItemController.cs

示例13: PointToClientLeftUpperCorner

 private Point PointToClientLeftUpperCorner(Control client)
 {
     return client.PointToClient(new Point(0, 0));
 }
开发者ID:ShumWengSang,项目名称:bombers-reborn,代码行数:4,代码来源:MineBomberEngine.cs

示例14: Show

        /// <summary>
        /// Shows pop-up window below the specified area of specified control.
        /// </summary>
        /// <param name="control">
        /// The control used to compute screen location of specified area.
        /// </param>
        /// <param name="area">
        /// The area of control below which the pop-up will be shown.
        /// </param>
        /// <remarks>
        /// When there is no space below specified area, the pop-up control is shown above it.
        /// </remarks>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="control"/> is 
        /// <code>
        /// null
        /// </code>
        /// .
        /// </exception>
        public void Show(Control control, Rectangle area)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            this.SetOwnerItem(control);
            this.resizableTop = this.resizableRight = false;
            Point location = control.PointToScreen(new Point(area.Left, area.Top + area.Height));
            Rectangle screen = Screen.FromControl(control).WorkingArea;
            if (location.X + this.Size.Width > (screen.Left + screen.Width))
            {
                this.resizableRight = true;
                location.X = (screen.Left + screen.Width) - this.Size.Width;
            }

            if (location.Y + this.Size.Height > (screen.Top + screen.Height))
            {
                this.resizableTop = true;
                location.Y -= this.Size.Height + area.Height;
            }

            location = control.PointToClient(location);
            this.Show(control, location, ToolStripDropDownDirection.BelowRight);
        }
开发者ID:tu-tran,项目名称:FareLiz,代码行数:45,代码来源:Popup.cs

示例15: DragOver

 public static void DragOver(Control owner, DragEventArgs e)
 {
     Point p = new Point(e.X, e.Y);
     Point point2 = owner.PointToClient(p);
     ImageList_DragMove(point2.X, point2.Y);
     if (Helper != null)
     {
         Helper.DragOver(ref p, (uint) e.Effect);
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:10,代码来源:DragImage.cs


注:本文中的System.Windows.Forms.Control.PointToClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。