当前位置: 首页>>代码示例>>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;未经允许,请勿转载。