本文整理汇总了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));
}
}
示例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());
//.........这里部分代码省略.........
示例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);
}