如何实现类似鼠标在桌面上的效果? 就是希望实现那个鼠标在我的桌面上的那种效果,选择的时候有个框 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 设置background属性a.hov:{background-color:#0000FF;}对于链接,就<a onclick="this.className='hov';"> 这样试试: public partial class Form1 : Form { private Point m_StartPoint; private Point m_LastPoint; public Form1() { InitializeComponent(); } protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); this.m_StartPoint = e.Location; m_LastPoint = this.m_StartPoint; } protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); Point endPoint = e.Location; int l = m_LastPoint.X > this.m_StartPoint.X ? this.m_StartPoint.X : m_LastPoint.X; int t = m_LastPoint.Y > this.m_StartPoint.Y ? this.m_StartPoint.Y : m_LastPoint.Y; int r = m_LastPoint.X > this.m_StartPoint.X ? m_LastPoint.X : this.m_StartPoint.X; int b = m_LastPoint.Y > this.m_StartPoint.Y ? m_LastPoint.Y : this.m_StartPoint.Y; Rectangle rect = Rectangle.FromLTRB(l, t, r, b); ControlPaint.DrawReversibleFrame(this.RectangleToScreen(rect), SystemColors.Highlight, FrameStyle.Dashed); } protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == MouseButtons.Left) { Point endPoint = e.Location; int l = m_LastPoint.X > this.m_StartPoint.X ? this.m_StartPoint.X : m_LastPoint.X; int t = m_LastPoint.Y > this.m_StartPoint.Y ? this.m_StartPoint.Y : m_LastPoint.Y; int r = m_LastPoint.X > this.m_StartPoint.X ? m_LastPoint.X : this.m_StartPoint.X; int b = m_LastPoint.Y > this.m_StartPoint.Y ? m_LastPoint.Y : this.m_StartPoint.Y; Rectangle rect = Rectangle.FromLTRB(l, t, r, b); ControlPaint.DrawReversibleFrame(this.RectangleToScreen(rect), SystemColors.Highlight, FrameStyle.Dashed); int _l = endPoint.X > this.m_StartPoint.X ? this.m_StartPoint.X : endPoint.X; int _t = endPoint.Y > this.m_StartPoint.Y ? this.m_StartPoint.Y : endPoint.Y; int _r = endPoint.X > this.m_StartPoint.X ? endPoint.X : this.m_StartPoint.X; int _b = endPoint.Y > this.m_StartPoint.Y ? endPoint.Y : this.m_StartPoint.Y; Rectangle _rect = Rectangle.FromLTRB(_l, _t, _r, _b); ControlPaint.DrawReversibleFrame(this.RectangleToScreen(_rect), SystemColors.Highlight, FrameStyle.Dashed); m_LastPoint = endPoint; } } } 我是楼主------------------------WINFORM ,谢谢 hbxtlhx(平民百姓-自已动手,丰衣足食) ( ) 信誉:112 基本实现了需要的功能,谢谢!!!结贴了!!!-----如果大家觉得有更好的办法请发送到我邮箱[email protected],同样开帖给分,谢谢! asp.net中c# 怎么做当上传打文件时提示上传文件太大不能上次 gridview 整行字变色 问题 如何将一篇英文文章打散成单词集合 关于 System.Net.Mail 邮件发送异常,请教高手 导入问题!(从EXECEL取值,有的取不到) MP3文件读取的问题,如何读取最后128Byte的内容? 睡不着觉~问个小问题 gridview 列求和 想做一个象Sqlserver创建视图一样的东西。 急!asp.net双重循环问题???加分!!! 请教DataGrid超标数据,设置成红色问题 哪位仁兄可以帮忙的,大家都来看一看哦,就算帮不了也来看一下.
a.hov:{background-color:#0000FF;}
对于链接,就<a onclick="this.className='hov';">
{
private Point m_StartPoint;
private Point m_LastPoint;
public Form1()
{
InitializeComponent();
} protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
this.m_StartPoint = e.Location;
m_LastPoint = this.m_StartPoint;
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
Point endPoint = e.Location;
int l = m_LastPoint.X > this.m_StartPoint.X ? this.m_StartPoint.X : m_LastPoint.X;
int t = m_LastPoint.Y > this.m_StartPoint.Y ? this.m_StartPoint.Y : m_LastPoint.Y;
int r = m_LastPoint.X > this.m_StartPoint.X ? m_LastPoint.X : this.m_StartPoint.X;
int b = m_LastPoint.Y > this.m_StartPoint.Y ? m_LastPoint.Y : this.m_StartPoint.Y; Rectangle rect = Rectangle.FromLTRB(l, t, r, b);
ControlPaint.DrawReversibleFrame(this.RectangleToScreen(rect), SystemColors.Highlight, FrameStyle.Dashed);
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.Button == MouseButtons.Left)
{
Point endPoint = e.Location;
int l = m_LastPoint.X > this.m_StartPoint.X ? this.m_StartPoint.X : m_LastPoint.X;
int t = m_LastPoint.Y > this.m_StartPoint.Y ? this.m_StartPoint.Y : m_LastPoint.Y;
int r = m_LastPoint.X > this.m_StartPoint.X ? m_LastPoint.X : this.m_StartPoint.X;
int b = m_LastPoint.Y > this.m_StartPoint.Y ? m_LastPoint.Y : this.m_StartPoint.Y; Rectangle rect = Rectangle.FromLTRB(l, t, r, b);
ControlPaint.DrawReversibleFrame(this.RectangleToScreen(rect), SystemColors.Highlight, FrameStyle.Dashed); int _l = endPoint.X > this.m_StartPoint.X ? this.m_StartPoint.X : endPoint.X;
int _t = endPoint.Y > this.m_StartPoint.Y ? this.m_StartPoint.Y : endPoint.Y;
int _r = endPoint.X > this.m_StartPoint.X ? endPoint.X : this.m_StartPoint.X;
int _b = endPoint.Y > this.m_StartPoint.Y ? endPoint.Y : this.m_StartPoint.Y; Rectangle _rect = Rectangle.FromLTRB(_l, _t, _r, _b);
ControlPaint.DrawReversibleFrame(this.RectangleToScreen(_rect), SystemColors.Highlight, FrameStyle.Dashed);
m_LastPoint = endPoint;
}
}
}
------------------------
WINFORM ,谢谢
结贴了!!!
-----如果大家觉得有更好的办法请发送到我邮箱[email protected],同样开帖给分,谢谢!