CaptureItPlus/Capturemodes/FixedRegion.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace CaptureItPlus.Capturemodes
{
using System;
using System.Drawing;
using System.Windows.Forms;
class FixedRegion : Panel
{
private const int HTBOTTOMRIGHT = 17;
private const int WM_NCHITTEST = 0x84;
private const int WM_SIZE = 0x05;
private int _x;
private int _y;
public event EventHandler CaptureImage;
public FixedRegion()
{
MouseDoubleClick += new MouseEventHandler(FixedRegion_MouseDoubleClick);
MouseDown += new MouseEventHandler(FixedRegion_MouseDown);
MouseMove += new MouseEventHandler(FixedRegion_MouseMove);
MouseUp += new MouseEventHandler(FixedRegion_MouseUp);
BackColor = Color.SkyBlue;
}
void FixedRegion_MouseUp(object sender, MouseEventArgs e)
{
Cursor = Cursors.Default;
}
void FixedRegion_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Left = (Left + e.X) - _x;
Top = (Top + e.Y) - _y;
}
}
void FixedRegion_MouseDown(object sender, MouseEventArgs e)
{
_x = e.X;
_y = e.Y;
Cursor = Cursors.Hand;
}
void FixedRegion_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (CaptureImage != null)
{
CaptureImage(this, e);
}
}
protected override void OnPaint(PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics, ClientRectangle, Color.Black, ButtonBorderStyle.Dashed);
ControlPaint.DrawSizeGrip(e.Graphics, BackColor, Width - 16, Height - 16, 16, 16);
var info = string.Format("Width : {0} Height : {1}", Width, Height);
var size = Size.Round(e.Graphics.MeasureString(info, Font));
ControlPaint.DrawStringDisabled(e.Graphics, info, Font, Color.Red, new Rectangle(new Point(4, 4), size), StringFormat.GenericDefault);
base.OnPaint(e);
后面还有 28 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
