没有合适的资源?快使用搜索试试~ 我知道了~
包含拖动位置,拖动大小,简单的属性设置等等。 适合于用于自定义窗体应用。
资源推荐
资源详情
资源评论
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace ControlEditClass
{
public class ControlEdit
{
#region//字段
private Point mouse_offset;
private Point mouse_downPoint;
private string CurrentControl;
Point realpoint;
int CursorLenth = 7;//光标敏感度
int minisize = 20;//控件最小度
bool rightDown = false;
public string CurrentControlName;
#endregion
Control parent = null;
public Control currentControl = null;
public ControlEdit(Control c)
{
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace ControlEditClass
{
public class ControlEdit
{
#region//字段
private Point mouse_offset;
private Point mouse_downPoint;
private string CurrentControl;
Point realpoint;
int CursorLenth = 7;//光标敏感度
int minisize = 20;//控件最小度
bool rightDown = false;
public string CurrentControlName;
#endregion
Control parent = null;
public Control currentControl = null;
public ControlEdit(Control c)
{
parent = c;
}
private void edit_MouseDown(object sender, MouseEventArgs e)
{
/// mousePointToSrceen = Control.MousePosition;
if (e.Button == MouseButtons.Left)
{
mouse_offset = new Point(-e.X, -e.Y);
mouse_downPoint = new Point(e.X, e.Y);
}
else
{
}
}
private void edit_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
try
{
if (((Control)sender).Cursor == Cursors.NoMove2D)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(mouse_offset.X, mouse_offset.Y);
((Control)sender).Location = ((Control)sender).Parent.PointToClient(mousePos);
((Control)sender).Parent.Refresh();
}
private void edit_MouseDown(object sender, MouseEventArgs e)
{
/// mousePointToSrceen = Control.MousePosition;
if (e.Button == MouseButtons.Left)
{
mouse_offset = new Point(-e.X, -e.Y);
mouse_downPoint = new Point(e.X, e.Y);
}
else
{
}
}
private void edit_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
try
{
if (((Control)sender).Cursor == Cursors.NoMove2D)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(mouse_offset.X, mouse_offset.Y);
((Control)sender).Location = ((Control)sender).Parent.PointToClient(mousePos);
((Control)sender).Parent.Refresh();
剩余18页未读,继续阅读
资源评论
大光呢
- 粉丝: 45
- 资源: 50
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功