當前位置: 首頁>>代碼示例>>C#>>正文


C# PictureBox.PointToScreen方法代碼示例

本文整理匯總了C#中System.Windows.Forms.PictureBox.PointToScreen方法的典型用法代碼示例。如果您正苦於以下問題:C# PictureBox.PointToScreen方法的具體用法?C# PictureBox.PointToScreen怎麽用?C# PictureBox.PointToScreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.PictureBox的用法示例。


在下文中一共展示了PictureBox.PointToScreen方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: joystickMouseMoveHandler

 private void joystickMouseMoveHandler(MouseEventArgs e, Point location, PictureBox box, Action<int, int> stickObserver) {
     if (MathLibrary.isPointInCircle(e.X, e.Y, joystickR, joystickR, joystickR))
     {
         location = e.Location;
         box.Invalidate();
         if (enabledStick)
         {
             stickObserver((int)Math.Floor((e.X - joystickR) / ((double)joystickR / 100)), (int)Math.Floor((e.Y - joystickR) / ((double)joystickR / 100)));
         }
     }
     else
     {
         Cursor.Position = box.PointToScreen(MathLibrary.convertPointToCircle(e.X, e.Y, joystickR, joystickR, joystickR - 2));
     }
 }
開發者ID:Brzobohaty,項目名稱:Robot,代碼行數:15,代碼來源:ControllView.cs

示例2: Clip

        public static void Clip(Processor processor)
        {
            Control.CheckForIllegalCrossThreadCalls = false;

            var clipForm = new Form
            {
                FormBorderStyle = FormBorderStyle.None,
                BackColor = Color.Black,
                Opacity = 0.25,
                ShowInTaskbar = false,
                TopMost = true
            };

            Label sizeLabel;
            clipForm.Controls.Add(sizeLabel = new Label
            {
                AutoSize = false,
                Size = new Size(90, 13),
                Left = clipForm.Width - 75,
                Top = clipForm.Height - 55,
                Anchor = (AnchorStyles.Bottom | AnchorStyles.Right),
                ForeColor = Color.White
            });

            List<Form> forms = new List<Form>();
            foreach (Screen screen in Screen.AllScreens)
            {
                var screenForm = new Form
                {
                    Bounds = screen.Bounds,
                    StartPosition = FormStartPosition.Manual,
                    WindowState = FormWindowState.Maximized,
                    FormBorderStyle = FormBorderStyle.None,
                    Opacity = 0.01,
                    Cursor = Cursors.Cross,
                    ShowInTaskbar = false,
                    TopMost = true
                };
                PictureBox screenImage;
                screenForm.Controls.Add(screenImage = new PictureBox
                {
                    Dock = DockStyle.Fill,
                    Image = GetScreenshot(screen),
                });
                screenForm.Show();
                screenForm.Focus();
                forms.Add(screenForm);

                new Thread(() =>
                {
                    Thread.Sleep(50);
                    screenForm.Opacity = 1.0;
                }).Start();

                screenImage.MouseDown += (s, e) =>
                {
                    var cursorColor = GetColor(screenImage, e.Location);
                    clipForm.BackColor = cursorColor.ToArgb() > Color.Black.ToArgb() / 2 ? Color.Black : Color.White;
                    sizeLabel.ForeColor = cursorColor.ToArgb() > Color.Black.ToArgb() / 2 ? Color.White : Color.Black;
                };

                screenImage.MouseDown += (s, e) =>
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        _selectingArea = true;
                        _startPoint = screenImage.PointToScreen(e.Location);
                        clipForm.Location = _startPoint;
                        clipForm.Size = new Size(1, 1);
                        clipForm.Show();
                    }
                };

                screenImage.MouseMove += (s, e) =>
                {
                    if (_selectingArea)
                    {
                        var newPoint = screenImage.PointToScreen(e.Location);
                        var point = new Point(Math.Min(newPoint.X, _startPoint.X), Math.Min(newPoint.Y, _startPoint.Y));
                        var size = new Size(Math.Max(newPoint.X, _startPoint.X) - point.X, Math.Max(newPoint.Y, _startPoint.Y) - point.Y);
                        if (clipForm.Location != point) clipForm.Location = point;
                        clipForm.Size = size;
                        sizeLabel.Text = size.Width + " x " + size.Height;
                    }
                };

                screenImage.MouseUp += (s, e) =>
                {
                    _selectingArea = false;
                    clipForm.Close();

                    forms.ForEach(f => f.Visible = false); // uncomment for debug

                    Bitmap bitmap;
                    if (screen.Bounds.Contains(clipForm.Bounds))
                        bitmap = GetClip(screenImage.Image, new Rectangle(screenForm.PointToClient(clipForm.Location), clipForm.Size));
                    else bitmap = Collage(forms, clipForm.Location, clipForm.Size);

                    forms.ForEach(f => f.Close());

//.........這裏部分代碼省略.........
開發者ID:topharley,項目名稱:scrns.ru,代碼行數:101,代碼來源:Clipper.cs

示例3: DrawReversibleLine

 private void DrawReversibleLine(PictureBox picBox, int x1, int y1, int x2, int y2, Color color)
 {
     ControlPaint.DrawReversibleLine(picBox.PointToScreen(new Point(x1, y1)), picBox.PointToScreen(new Point(x2, y2)), picBox.BackColor);
 }
開發者ID:vanloc0301,項目名稱:mychongchong,代碼行數:4,代碼來源:SMFlowChart.cs


注:本文中的System.Windows.Forms.PictureBox.PointToScreen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。