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


C# Form.PointToScreen方法代码示例

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


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

示例1: Draw

        public static Point[] 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;
            var pos = parent.PointToClient(Control.MousePosition);

            return new[] {mPos, pos};
        }
开发者ID:Khanchai,项目名称:Paint,代码行数:28,代码来源:LineTools.cs

示例2: YamuiSmokeScreen

        public YamuiSmokeScreen(Form owner, Rectangle pageRectangle)
        {
            SetStyle(ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.ResizeRedraw |
                ControlStyles.OptimizedDoubleBuffer, true);

            _pageRectangle = pageRectangle;
            FormBorderStyle = FormBorderStyle.None;
            ControlBox = false;
            ShowInTaskbar = false;
            StartPosition = FormStartPosition.Manual;
            Location = owner.PointToScreen(_pageRectangle.Location);
            _sizeDifference = new Point(owner.Width - _pageRectangle.Width, owner.Height - _pageRectangle.Height);
            ClientSize = new Size(owner.Width - _sizeDifference.X, owner.Height - _sizeDifference.Y);
            owner.LocationChanged += Cover_LocationChanged;
            owner.ClientSizeChanged += Cover_ClientSizeChanged;
            owner.VisibleChanged += Cover_OnVisibleChanged;

            // Disable Aero transitions, the plexiglass gets too visible
            if (Environment.OSVersion.Version.Major >= 6) {
                int value = 1;
                DwmApi.DwmSetWindowAttribute(owner.Handle, DwmApi.DwmwaTransitionsForcedisabled, ref value, 4);
            }

            base.Opacity = 0d;
            Show(owner);
            owner.Focus();
        }
开发者ID:jcaillon,项目名称:YamuiFramework,代码行数:29,代码来源:YamuiSmokeScreen.cs

示例3: MaskedDialog

 private MaskedDialog(Form parent, UserControl ucDialog)
 {
     this.ucDialog = ucDialog;
     this.FormBorderStyle = FormBorderStyle.None;
     this.BackColor = System.Drawing.Color.Black;
     this.Opacity = 0.50;
     this.ShowInTaskbar = false;
     this.StartPosition = FormStartPosition.Manual;
     this.Size = parent.ClientSize;
     this.Location = parent.PointToScreen(System.Drawing.Point.Empty);
     parent.Move += AdjustPosition;
     parent.SizeChanged += AdjustPosition;
 }
开发者ID:tridipkolkata,项目名称:SampleRepo,代码行数:13,代码来源:MaskedDialog.cs

示例4: DimmerMask

 public DimmerMask(Form parent)
 {
     //InitializeComponent();
     this.FormBorderStyle = FormBorderStyle.None;
     this.BackColor = Color.Black;
     this.Opacity = 0.70;
     this.ShowInTaskbar = false;
     this.StartPosition = FormStartPosition.Manual;
     this.Size = parent.ClientSize;
     this.Location = parent.PointToScreen(Point.Empty);
     parent.Move += AdjustPosition;
     parent.SizeChanged += AdjustPosition;
 }
开发者ID:noahsw,项目名称:highlight-hunter,代码行数:13,代码来源:DimmerMask.cs

示例5: Plexiglass

 public Plexiglass(Form tocover)
 {
     this.BackColor = Color.Black;
     this.Opacity = 0.5;      // Tweak as desired
     this.FormBorderStyle = FormBorderStyle.None;
     this.ControlBox = false;
     this.ShowInTaskbar = false;
     this.StartPosition = FormStartPosition.Manual;
     this.AutoScaleMode = AutoScaleMode.None;
     this.Location = tocover.PointToScreen(Point.Empty);
     this.ClientSize = tocover.ClientSize;
     tocover.LocationChanged += Cover_LocationChanged;
     tocover.ClientSizeChanged += Cover_ClientSizeChanged;
     this.Show(tocover);
     tocover.Focus();
 }
开发者ID:Razsiel,项目名称:INF1FB_1.4_Ontwikkeling,代码行数:16,代码来源:PlexiglassCover.cs

示例6: BackgroundDialogView

        public BackgroundDialogView(Form parent, Form dialog)
            : this()
        {
            this.Opacity = 0.70;
            this.StartPosition = FormStartPosition.Manual;
            this.Location = parent.PointToScreen(System.Drawing.Point.Empty);
            this.ClientSize = parent.ClientSize;
            this.Main = parent;

            parent.Move += AdjustPosition;
            parent.SizeChanged += AdjustPosition;

            dialog.FormClosed += Dialog_FormClosed;
            dialog.StartPosition = FormStartPosition.CenterParent;

            this.Show();
            dialog.ShowDialog();
        }
开发者ID:1337Steven1337,项目名称:KBS2G3,代码行数:18,代码来源:BackgroundDialogView.cs

示例7: ShowPictureBoxBalloon

        /// <summary>
        /// Shows the balloon tooltip on the electric bulb icon (pictureBox1)
        /// </summary>
        /// <param name="newText">The new text.</param>
        /// <param name="time">The time in milliseconds</param>
        /// <param name="parent">The generating form (since we redirect the controls)</param>
        /// <param name="permanent">if set to <c>true</c> the tooltip will come again</param>
        public void ShowPictureBoxBalloon(string newText, int time, Form parent, bool permanent)
        {
            balloonToolTipInfo.SetBalloonText(
                this.pbxIcon,
                newText
            );

            // ???
            Point point = parent.PointToScreen(pbxIcon.PointToScreen(pbxIcon.Location));
            point.X += 5;

            balloonToolTipInfo.Show(this.pbxIcon, point);

            timerToolTip.Interval = time;
            timerToolTip.Enabled = true;

            if (permanent)
            {
                _showPermanentText = newText;
                _showPermanentEntered = false;
                pbxIcon.MouseEnter += new EventHandler(pictureBox1_MouseEnter);
                pbxIcon.MouseLeave += new EventHandler(pictureBox1_MouseLeave);
            }
        }
开发者ID:JohannesHoppe,项目名称:clustered-neuronal-network,代码行数:31,代码来源:MasterForm.cs

示例8: CreateToolbar


//.........这里部分代码省略.........
                tslnudMagnifierPixelCount.Content.Maximum = RegionCaptureOptions.MagnifierPixelCountMaximum;
                tslnudMagnifierPixelCount.Content.Increment = 2;
                tslnudMagnifierPixelCount.Content.Value = Config.MagnifierPixelCount;
                tslnudMagnifierPixelCount.Content.ValueChanged = (sender, e) => Config.MagnifierPixelCount = (int)tslnudMagnifierPixelCount.Content.Value;
                tsddbOptions.DropDownItems.Add(tslnudMagnifierPixelCount);

                ToolStripLabeledNumericUpDown tslnudMagnifierPixelSize = new ToolStripLabeledNumericUpDown(Resources.ShapeManager_CreateContextMenu_Magnifier_pixel_size_);
                tslnudMagnifierPixelSize.Content.Minimum = RegionCaptureOptions.MagnifierPixelSizeMinimum;
                tslnudMagnifierPixelSize.Content.Maximum = RegionCaptureOptions.MagnifierPixelSizeMaximum;
                tslnudMagnifierPixelSize.Content.Value = Config.MagnifierPixelSize;
                tslnudMagnifierPixelSize.Content.ValueChanged = (sender, e) => Config.MagnifierPixelSize = (int)tslnudMagnifierPixelSize.Content.Value;
                tsddbOptions.DropDownItems.Add(tslnudMagnifierPixelSize);

                ToolStripMenuItem tsmiShowCrosshair = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Show_screen_wide_crosshair);
                tsmiShowCrosshair.Checked = Config.ShowCrosshair;
                tsmiShowCrosshair.CheckOnClick = true;
                tsmiShowCrosshair.Click += (sender, e) => Config.ShowCrosshair = tsmiShowCrosshair.Checked;
                tsddbOptions.DropDownItems.Add(tsmiShowCrosshair);

                ToolStripMenuItem tsmiFixedSize = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Fixed_size_region_mode);
                tsmiFixedSize.Checked = Config.IsFixedSize;
                tsmiFixedSize.CheckOnClick = true;
                tsmiFixedSize.Click += (sender, e) => Config.IsFixedSize = tsmiFixedSize.Checked;
                tsddbOptions.DropDownItems.Add(tsmiFixedSize);

                ToolStripDoubleLabeledNumericUpDown tslnudFixedSize = new ToolStripDoubleLabeledNumericUpDown(Resources.ShapeManager_CreateContextMenu_Width_,
                    Resources.ShapeManager_CreateContextMenu_Height_);
                tslnudFixedSize.Content.Minimum = 10;
                tslnudFixedSize.Content.Maximum = 10000;
                tslnudFixedSize.Content.Increment = 10;
                tslnudFixedSize.Content.Value = Config.FixedSize.Width;
                tslnudFixedSize.Content.Value2 = Config.FixedSize.Height;
                tslnudFixedSize.Content.ValueChanged = (sender, e) => Config.FixedSize = new Size((int)tslnudFixedSize.Content.Value, (int)tslnudFixedSize.Content.Value2);
                tsddbOptions.DropDownItems.Add(tslnudFixedSize);

                ToolStripMenuItem tsmiShowFPS = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Show_FPS);
                tsmiShowFPS.Checked = Config.ShowFPS;
                tsmiShowFPS.CheckOnClick = true;
                tsmiShowFPS.Click += (sender, e) => Config.ShowFPS = tsmiShowFPS.Checked;
                tsddbOptions.DropDownItems.Add(tsmiShowFPS);

                ToolStripMenuItem tsmiRememberMenuState = new ToolStripMenuItem("Remember menu state");
                tsmiRememberMenuState.Checked = Config.RememberMenuState;
                tsmiRememberMenuState.CheckOnClick = true;
                tsmiRememberMenuState.Click += (sender, e) => Config.RememberMenuState = tsmiRememberMenuState.Checked;
                tsddbOptions.DropDownItems.Add(tsmiRememberMenuState);

                #endregion Options
            }

            ToolStripLabel tslDragRight = new ToolStripLabel()
            {
                Alignment = ToolStripItemAlignment.Right,
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image = Resources.ui_radio_button_uncheck,
                Margin = new Padding(0, 0, 2, 0),
                Padding = new Padding(2)
            };

            tsMain.Items.Add(tslDragRight);

            tslDragLeft.MouseDown += TslDrag_MouseDown;
            tslDragRight.MouseDown += TslDrag_MouseDown;
            tslDragLeft.MouseEnter += TslDrag_MouseEnter;
            tslDragRight.MouseEnter += TslDrag_MouseEnter;
            tslDragLeft.MouseLeave += TslDrag_MouseLeave;
            tslDragRight.MouseLeave += TslDrag_MouseLeave;

            tsMain.ResumeLayout(false);
            tsMain.PerformLayout();
            menuForm.ResumeLayout(false);

            menuForm.Show(form);

            foreach (ToolStripItem tsi in tsMain.Items.OfType<ToolStripItem>())
            {
                if (!string.IsNullOrEmpty(tsi.Text))
                {
                    tsi.MouseEnter += (sender, e) =>
                    {
                        Point pos = CaptureHelpers.ScreenToClient(menuForm.PointToScreen(tsi.Bounds.Location));
                        pos.Y += tsi.Height + 8;
                        MenuTextAnimation.Position = pos;
                        MenuTextAnimation.Start(tsi.Text);
                    };

                    tsi.MouseLeave += TsMain_MouseLeave;
                }
            }

            UpdateMenu();

            CurrentShapeChanged += shape => UpdateMenu();
            CurrentShapeTypeChanged += shapeType => UpdateMenu();
            ShapeCreated += shape => UpdateMenu();

            ConfigureMenuState();

            form.Activate();
        }
开发者ID:L1Q,项目名称:ShareX,代码行数:101,代码来源:ShapeManagerMenu.cs

示例9: openGreyOutWindow

 public GreyOutWindow openGreyOutWindow(bool showBorder, Form parent)
 {
     if (!this.isPopupWindowCreated(this.m_greyOutWindow))
     {
         this.m_greyLogin = false;
         this.m_greyOutWindow = new GreyOutWindow();
         Size clientSize = parent.ClientSize;
         Point point = parent.PointToScreen(new Point(0, 0));
         this.m_greyOutWindow.Location = point;
         this.m_greyOutWindow.Size = clientSize;
         this.m_greyOutWindow.init(showBorder);
         this.m_greyOutWindow.Show(parent);
     }
     return this.m_greyOutWindow;
 }
开发者ID:Riketta,项目名称:Stronghold-Kingdoms,代码行数:15,代码来源:InterfaceMgr.cs

示例10: 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 ();
//.........这里部分代码省略.........
开发者ID:BrzVlad,项目名称:mono,代码行数:101,代码来源:FormHandleTest.cs

示例11: SetRoundedRegion

        public static void SetRoundedRegion(Form form, Size overrideSize)
        {
            int width, height;
            if (overrideSize == Size.Empty)
            {
                width = form.ClientSize.Width;
                height = form.ClientSize.Height;
            }
            else
            {
                width = overrideSize.Width;
                height = overrideSize.Height;
            }

            Region r = new Region(new Rectangle(3, 0, width - 6, height));
            r.Union(new Rectangle(2, 1, width - 4, height - 2));
            r.Union(new Rectangle(1, 2, width - 2, height - 4));
            r.Union(new Rectangle(0, 3, width, height - 6));

            RECT rect = new RECT();
            User32.GetWindowRect(form.Handle, ref rect);
            Point windowScreenPos = RectangleHelper.Convert(rect).Location;
            Point clientScreenPos = form.PointToScreen(new Point(0, 0));

            r.Translate(clientScreenPos.X - windowScreenPos.X, clientScreenPos.Y - windowScreenPos.Y);

            form.Region = r;
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:28,代码来源:FramelessManager.cs

示例12: CreateShadows

        public static void CreateShadows(ArrayList shadows, int shadowSize, bool canShow, Form form, Rectangle creatorRect1, Rectangle creatorRect2)
        {
            if (!canShow || !form.Visible || form.Bounds.IsEmpty || form.Disposing)
            {
                HideShadows(shadows);
                return;
            }
            Rectangle bounds = new Rectangle(form.PointToScreen(Point.Empty), form.ClientSize);
            Rectangle vertRect;
            Rectangle horzRect;
            FATopFormBase topForm = form as FATopFormBase;
            if (topForm == null) return;

            if (topForm.OwnerEdit.RightToLeft == RightToLeft.No)
            {
                vertRect = new Rectangle(bounds.Right, bounds.Top + shadowSize, shadowSize, bounds.Height);
                horzRect = new Rectangle(bounds.X + shadowSize, bounds.Bottom, bounds.Width - shadowSize, shadowSize);
            }
            else
            {
                vertRect = new Rectangle(bounds.Left - shadowSize, bounds.Top + shadowSize, shadowSize, bounds.Height);
                horzRect = new Rectangle(bounds.X, bounds.Bottom, bounds.Width - shadowSize, shadowSize);
            }

            if (shadows.Count == 0)
            {
                FAShadow vertShadow = new FAShadow(false, shadowSize, form);
                FAShadow horzShadow = new FAShadow(true, shadowSize, form);
                shadows.Add(vertShadow);
                shadows.Add(horzShadow);
            }

            //vertRect = CheckShadowRectangle(vertRect, creatorRect1, true);
            //vertRect = CheckShadowRectangle(vertRect, creatorRect2, true);
            //horzRect = CheckShadowRectangle(horzRect, creatorRect1, false);
            //horzRect = CheckShadowRectangle(horzRect, creatorRect2, false);
            (shadows[0] as FAShadow).RealBounds = vertRect;
            (shadows[1] as FAShadow).RealBounds = horzRect;

            UpdateShadows(shadows, creatorRect1, creatorRect2, shadowSize);
            ShowShadows(shadows);
        }
开发者ID:HEskandari,项目名称:FarsiLibrary,代码行数:42,代码来源:FAShadow.cs


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