• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.POINT类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



POINT类属于System.Windows.Forms命名空间,在下文中一共展示了POINT类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetControl

        //should I only make automationElement and actionListener once?
        public static UIItem GetControl(Point point)
        {
            POINT point1 = new POINT(point.X, point.Y);
            IntPtr myIntPtr = WindowFromPoint(point1);

            AutomationElement automationElement = AutomationElement.FromHandle(myIntPtr);

            automationElement = GetChildControl(point, automationElement) ?? automationElement;

            TreeWalker walker = TreeWalker.ControlViewWalker;

            AutomationElement parentElement = walker.GetParent(automationElement);
            if (parentElement != null && parentElement.Current.LocalizedControlType == "button")
                automationElement = parentElement;

            int delNum;

            while(((string.IsNullOrEmpty(automationElement.Current.Name)
                        && string.IsNullOrEmpty(automationElement.Current.AutomationId))
                        || int.TryParse(automationElement.Current.AutomationId, out delNum)))
            {
                automationElement = walker.GetParent(automationElement);
            }

            ActionListener actionListener = new NullActionListener();
            return new UIItem(automationElement, actionListener);
        }
开发者ID:philt5252,项目名称:GoldenHorse,代码行数:28,代码来源:ExternalAppInfoManager.cs


示例2: ShowContextMenu

        public static void ShowContextMenu(ContextMenuStrip contextMenu, DTE dte)
        {
            try
            {
                var serviceProvider = new ServiceProvider(dte as IServiceProvider);

                IVsUIShellOpenDocument sod = (IVsUIShellOpenDocument)serviceProvider.GetService(typeof(SVsUIShellOpenDocument));
                IVsUIHierarchy targetHier;
                uint[] targetId = new uint[1];
                IVsWindowFrame targetFrame;
                int isOpen;
                Guid viewId = new Guid(LogicalViewID.Primary);
                sod.IsDocumentOpen(null, 0, dte.ActiveWindow.Document.FullName,
                                   ref viewId, 0, out targetHier, targetId,
                                   out targetFrame, out isOpen);

                IVsTextView textView = VsShellUtilities.GetTextView(targetFrame);
                TextSelection selection = (TextSelection)dte.ActiveWindow.Document.Selection;
                Microsoft.VisualStudio.OLE.Interop.POINT[] interopPoint = new Microsoft.VisualStudio.OLE.Interop.POINT[1];
                textView.GetPointOfLineColumn(selection.ActivePoint.Line, selection.ActivePoint.LineCharOffset, interopPoint);

                POINT p = new POINT(interopPoint[0].x, interopPoint[0].y);

                ClientToScreen(textView.GetWindowHandle(), p);

                contextMenu.Show(new Point(p.x, p.y));
            }
            catch (Exception)
            {
                contextMenu.Show();
            }
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:32,代码来源:VsContextMenuManager.cs


示例3: SnapperWindow

        public SnapperWindow(int x, int y, int width, int height)
            : base("Snap N Share", 10, 10, 640, 480)
        {
            // Show a form so we can capture the desired group IP and port number
            ServerForm groupForm = new ServerForm();
            //IPAddress randomAddress = NewTOAPIA.Net.Utility.GetRandomMulticastAddress();
            //groupForm.groupAddressField.Text = randomAddress.ToString();
            groupForm.ShowDialog();

            // Get the address and port from the form
            fUseGray = groupForm.checkBox1.Checked;
            string groupIP = groupForm.groupAddressField.Text;
            int groupPort = int.Parse(groupForm.groupPortField.Text);
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            // Set our title to the address specified so the user
            // can easily identify their session.
            Title = "SnapNShare - " + ipep.ToString();
            
            fSnapper = new ScreenSnapper();

            fClientOrigin = new POINT();
            int pwidth = ClientRectangle.Width;
            int pheight = ClientRectangle.Height;
            fScreenImage = new GDIDIBSection(width, height, BitCount.Bits24);
            fGrayImage = new PixelArray<Lumb>(width, height,fScreenImage.Orientation, new Lumb());

            BackgroundColor = RGBColor.White;
            this.Opacity = 0.5;

            // Create the MultiSession object so we can send stuff out to a group
            //fSession = new MultiSession(Guid.NewGuid().ToString(), ipep);
            fSession = new MultiSession(ipep, Guid.NewGuid().ToString(), "William", true, true, null);

            // Add the channel for graphics commands
            PayloadChannel payloadChannel = fSession.CreateChannel(PayloadType.dynamicPresentation);
            fCommandDispatcher = new GraphPortChunkEncoder(payloadChannel);

            fUserIOChannel = fSession.CreateChannel(PayloadType.xApplication2);
            //fUserIOEncoder = new UserIOChannelEncoder(fUserIOChannel);
            //fUserIODecoder = new UserIOChannelDecoder(fUserIOChannel);
            //fUserIODecoder.MouseActivityEvent += new MouseActivityEventHandler(fUserIODecoder_MouseActivityEvent);
            //fUserIODecoder.KeyboardActivityEvent += new KeyboardActivityEventHandler(fUserIODecoder_KeyboardActivityEvent);

            // Start the thread that will take snapshots of the screen
            fGlobalTimer = new PrecisionTimer();
            fFrameRate = 2; // Frames per second
            fSnapperRunning = true;
            snapperThread = new Thread(RunSnaps);
            snapperThread.Start();
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:51,代码来源:MiniSnapper.cs


示例4: SendMessage

 static extern IntPtr SendMessage(IntPtr hWnd, int wMsg, out POINT wParam, IntPtr lParam);
开发者ID:AHorak,项目名称:vs-window-title-changer,代码行数:1,代码来源:ColorizedPlainTextBox.cs


示例5: WndProc

        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case WM_MOUSEWHEEL:
                    if (m_SmoothScroll)
                        break;
                    int delta = ((int)m.WParam >> 16) / 120;
                    IntPtr msg = delta < 0 ? (IntPtr)SB_LINEDOWN : (IntPtr)SB_LINEUP;
                    if (delta < 0)
                        delta = -delta;
                    for (int i = 0; i < delta; ++i)
                        SendMessage(m.HWnd, WM_VSCROLL, msg, IntPtr.Zero);
                    m.Result = IntPtr.Zero;
                    return;
                case WM_PAINT:
                    if (VerticalScrollPosChanged != null)
                    {
                        // Handling the VScroll event wasn't enough: When the user scrolls the scrollbar by grabbing the thumb of the
                        // scrollbar then if you hold the thumb in one position for 1-2 seconds then the text is automatically scrolled
                        // to a whole line vertically without sending any events. We have to know about every single Y scroll pos change
                        // in order to correctly redraw the line number control.
                        POINT scroll_pos = new POINT();
                        SendMessage(Handle, EM_GETSCROLLPOS, IntPtr.Zero, ref scroll_pos);
                        if (scroll_pos.Y != m_PrevScrollPos.Y)
                        {
                            m_PrevScrollPos = scroll_pos;
                            VerticalScrollPosChanged(this);
                        }
                    }

                    if (PostPaint == null)
                        break;
                    // HACK: couldn't get it work otherwise...
                    Invalidate();
                    base.WndProc(ref m);
                    using (Graphics g = CreateGraphics())
                        PostPaint(this, g);
                    return;
            }
            base.WndProc(ref m);
        }
开发者ID:AHorak,项目名称:vs-window-title-changer,代码行数:42,代码来源:ColorizedPlainTextBox.cs


示例6: ScreenToClient

 static extern bool ScreenToClient(IntPtr hWnd, ref POINT lpPoint);
开发者ID:finalstream,项目名称:FinalstreamCommons.Core,代码行数:1,代码来源:GlobalMouseHook.cs


示例7: SendMessage

 private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, POINT lParam);
开发者ID:newyorknight,项目名称:jabber.net,代码行数:1,代码来源:BottomScrollRichText.cs


示例8: Win32MoveToEx

		internal extern static bool Win32MoveToEx(IntPtr hdc, int x, int y, ref POINT lpPoint);
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:1,代码来源:XplatUIWin32.cs


示例9: Win32ClientToScreen

		private extern static bool Win32ClientToScreen(IntPtr hWnd, ref POINT pt);
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:1,代码来源:XplatUIWin32.cs


示例10: WindowFromPoint

 static extern IntPtr WindowFromPoint(POINT Point);
开发者ID:schnapple,项目名称:SplitScreenWindows,代码行数:1,代码来源:SnapOn.cs


示例11: UpdateLayeredWindow

 public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst,
     ref POINT pptDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pptSrc, uint crKey,
     [In] ref BLENDFUNCTION pblend, uint dwFlags);
开发者ID:Andy-Yin,项目名称:MY_OA_RM,代码行数:3,代码来源:NativeMethods.cs


示例12: GetCursorPos

 private static extern bool GetCursorPos(out POINT lpPoint);
开发者ID:jcaillon,项目名称:YamuiFramework,代码行数:1,代码来源:Classic.cs


示例13: SnapClientArea

        //IntPtr fUserIODecoder_KeyboardActivityEvent(object sender, KeyboardActivityArgs ke)
        //{
        //    if (!fAllowRemoteControl)
        //        return IntPtr.Zero;

        //    Console.WriteLine("Received Key Event: {0}  {1}  {2}", InputSimulator.KeyEvents, ke.AcitivityType, ke.VirtualKeyCode);

        //    InputSimulator.SimulateKeyboardActivity(ke.VirtualKeyCode, ke.AcitivityType);

        //    return IntPtr.Zero;
        //}

        //void fUserIODecoder_MouseActivityEvent(object sender, MouseActivityArgs me)
        //{
        //    if (fAllowRemoteControl)
        //    {
        //        // What we've received are window relative coordinates.
        //        // First we need to convert them to screen relative coordinates
        //        POINT aPoint = new POINT(me.X, me.Y);
        //        User32.ClientToScreen(Handle, ref aPoint);

        //        // Now for input simulation, we need to turn the screen 
        //        // point into a normalized range of 0 to 65535
        //        // Normalize the point
        //        Screen myScreen = Screen.FromHandle(Handle);
        //        Rectangle screenRect = myScreen.Bounds;

        //        float xFrac = (float)aPoint.X / screenRect.Width;
        //        float yFrac = (float)aPoint.Y / screenRect.Height;

        //        int normalizedX = (int)(xFrac * 65535);
        //        int normalizedY = (int)(yFrac * 65535);
                
        //        // And finally, send the input
        //        InputSimulator.SimulateMouseActivity(normalizedX, normalizedY, me.Delta, me.ButtonActivity);
        //    }
        //}
        #endregion


        void SnapClientArea()
        {
            Rectangle cRect = ClientRectangle;

            // If we have resized since last picture, then 
            // resize the capture buffer before taking
            // the next snapshot.
            if (fNeedsResize)
            {
                fScreenImage = new GDIDIBSection(cRect.Width, cRect.Height, BitCount.Bits24);
                fGrayImage = new PixelArray<Lumb>(cRect.Width, cRect.Height, fScreenImage.Orientation, new Lumb());

                fNeedsResize = false;
            }

            // To take a snapshot, we need to convert the client area's upper left corner
            // to screen space, as the device context we're using is for the whole screen.
            // So, we get the origin, and make the User32 call to convert that to screen space.
            fClientOrigin = new POINT(0, 0);
            User32.ClientToScreen(Handle, ref fClientOrigin);

            // Now we actually take the snapshot.
            // We pass in the client area, based in screen coordinates
            // and the PixelBuffer object to capture into.
            fSnapper.SnapAPicture(new Rectangle(fClientOrigin.X, fClientOrigin.Y, fScreenImage.Width, fScreenImage.Height), fScreenImage);

        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:67,代码来源:MiniSnapper.cs


示例14: SendMessage

 static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, POINT point);
开发者ID:catb0t,项目名称:heron-language,代码行数:1,代码来源:CodeEditControl.cs


示例15: DrawReversibleRectangle

		internal override void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
			IntPtr		hdc;
			IntPtr		pen;
			IntPtr		oldpen;
			POINT		pt;

			pt = new POINT();
			pt.x = 0;
			pt.y = 0;
			Win32ClientToScreen(handle, ref pt);

			// If we want the standard hatch pattern we would
			// need to create a brush

			// Grab a pen
			pen = Win32CreatePen(PenStyle.PS_SOLID, line_width, IntPtr.Zero);

			hdc = Win32GetDC(IntPtr.Zero);
			Win32SetROP2(hdc, ROP2DrawMode.R2_NOT);
			oldpen = Win32SelectObject(hdc, pen);

			Control c = Control.FromHandle (handle);
			if (c != null) {
				RECT window_rect;
				Win32GetWindowRect (c.Handle, out window_rect);
				Region r = new Region (new Rectangle(window_rect.left, window_rect.top, window_rect.right - window_rect.left, window_rect.bottom - window_rect.top));
				Win32ExtSelectClipRgn(hdc, r.GetHrgn (Graphics.FromHdc (hdc)), (int) ClipCombineMode.RGN_AND);
			}

			Win32MoveToEx(hdc, pt.x + rect.Left, pt.y + rect.Top, IntPtr.Zero);
			if ((rect.Width > 0) && (rect.Height > 0)) {
				Win32LineTo(hdc, pt.x + rect.Right, pt.y + rect.Top);
				Win32LineTo(hdc, pt.x + rect.Right, pt.y + rect.Bottom);
				Win32LineTo(hdc, pt.x + rect.Left, pt.y + rect.Bottom);
				Win32LineTo(hdc, pt.x + rect.Left, pt.y + rect.Top);
			} else {
				if (rect.Width > 0) {
					Win32LineTo(hdc, pt.x + rect.Right, pt.y + rect.Top);
				} else {
					Win32LineTo(hdc, pt.x + rect.Left, pt.y + rect.Bottom);
				}
			}

			Win32SelectObject(hdc, oldpen);
			Win32DeleteObject(pen);
			if (c != null)
				Win32ExtSelectClipRgn(hdc, IntPtr.Zero, (int) ClipCombineMode.RGN_COPY);

			Win32ReleaseDC(IntPtr.Zero, hdc);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:50,代码来源:XplatUIWin32.cs


示例16: Win32ScreenToClient

		private extern static bool Win32ScreenToClient(IntPtr hWnd, ref POINT pt);
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:1,代码来源:XplatUIWin32.cs


示例17: RtlMoveMemory

 private extern static int RtlMoveMemory(ref POINT Destination, ref RECT Source, int Length);
开发者ID:JackWangCUMT,项目名称:winform-control-lib,代码行数:1,代码来源:WSNToolTip.cs


示例18: Win32GetCursorPos

		private extern static bool Win32GetCursorPos(out POINT lpPoint);
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:1,代码来源:XplatUIWin32.cs


示例19: GetCursorPos

 public static extern int GetCursorPos(ref POINT lpPoint);
开发者ID:coastcdl,项目名称:autotester,代码行数:1,代码来源:Win32.cs


示例20: SetIMEWindowLocation

    public void SetIMEWindowLocation(int x, int y)
    {
      if (disableIME || hIMEWnd == IntPtr.Zero) return;

      POINT p = new POINT();
      p.x = x;
      p.y = y;

      COMPOSITIONFORM lParam = new COMPOSITIONFORM();
      lParam.dwStyle = CFS_POINT;
      lParam.ptCurrentPos = p;
      lParam.rcArea = new RECT();

      try
      {
        SendMessage(hIMEWnd, WM_IME_CONTROL, new IntPtr(IMC_SETCOMPOSITIONWINDOW), lParam);
      }
      catch (AccessViolationException ex)
      {
        Handle(ex);
      }
    }
开发者ID:sanyaade-fintechnology,项目名称:SquareOne,代码行数:22,代码来源:Ime.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.Padding类代码示例发布时间:2022-05-26
下一篇:
C# Forms.OpenFileDialog类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap