5个回答
推荐于2016-08-13 · 知道合伙人互联网行家
关注
展开全部
直接使用代码即可做到。
1 2 3 4 5 6 7 8 9 10 11 12 13 | [DllImportAttribute( "user32.dll" )] private extern static bool ReleaseCapture(); [DllImportAttribute( "user32.dll" )] private extern static int SendMessage(IntPtr handle, int m, int p, int h); private void panelEx4_MouseDown( object sender, MouseEventArgs e) { DevComponents.DotNetBar.PanelEx p=(DevComponents.DotNetBar.PanelEx)sender; if (e.Button == MouseButtons.Left) { this .Cursor = Cursors.SizeAll; ReleaseCapture(); SendMessage(p.Handle, 0xA1, 0x2, 0); this .Cursor = Cursors.Default; } } |
2013-08-04
展开全部
可以跟据鼠标的当前位置来确定鼠标下的DataGrid是哪一行哪一列,然后由行和列来确定当前行和列的坐标来确定出你的菜单显示的位置,参考如下代码:
Point m_CurPoint = 当前鼠标位置;
if (this.HitTest(m_CurPoint).Type != System.Windows.Forms.DataGrid.HitTestType.Cell)
{
Console.WriteLine(this.HitTest(m_CurPoint).Row);//所在的行号
Console.WriteLine(this.HitTest(m_CurPoint).Column);//所在的列号
}
Point m_CurPoint = 当前鼠标位置;
if (this.HitTest(m_CurPoint).Type != System.Windows.Forms.DataGrid.HitTestType.Cell)
{
Console.WriteLine(this.HitTest(m_CurPoint).Row);//所在的行号
Console.WriteLine(this.HitTest(m_CurPoint).Column);//所在的列号
}
2013-08-04
展开全部
Winform下楼上几个
Asp.Net 下:
<style>
html,body {height:100%;overflow:hidden;}
#actor {background:#C30;position:absolute;left:0;top:0;width:20px;height:20px;}
</style>
<script>
keyMove={
bind:function(UI){
var D=document,I=this;
this.keys=[];
this.len=10;
this.UI=document.getElementById(UI);
D.onkeydown=function (event){var e = window.event || event;I.addKey(e.keyCode);};
D.onkeyup=function (event){var e = window.event || event;I.delKey(e.keyCode);};
this.move();
},
addKey:function(key){for(var i=0;i<this.keys.length;i++){if(key==this.keys[i]){return;}}this.keys.push(key);},
delKey:function(key){for(var i=0;i<this.keys.length;i++){if(key==this.keys[i]){this.keys.splice(i,1);break;}}},
css:function(k,v){with(this.UI)style[k]=(parseInt(style[k])||0)+v+"px";},
move:function(){
var $=this;
setInterval(function(){
var data={37:["left",-1],39:["left",1],38:["top",-1],40:["top",1]};
for(var i=0;i<$.keys.length;i++){if(/^[34][0789]$/.test($.keys[i])){var val=data[$.keys[i]];$.css(val[0],$.len*val<br><br>[1])}}
},10);
}
}
onload=function(){keyMove.bind("actor");}
</script>
<body>
<div id="actor"></div>
</body>
测试通过,兼容FF,IE
Asp.Net 下:
<style>
html,body {height:100%;overflow:hidden;}
#actor {background:#C30;position:absolute;left:0;top:0;width:20px;height:20px;}
</style>
<script>
keyMove={
bind:function(UI){
var D=document,I=this;
this.keys=[];
this.len=10;
this.UI=document.getElementById(UI);
D.onkeydown=function (event){var e = window.event || event;I.addKey(e.keyCode);};
D.onkeyup=function (event){var e = window.event || event;I.delKey(e.keyCode);};
this.move();
},
addKey:function(key){for(var i=0;i<this.keys.length;i++){if(key==this.keys[i]){return;}}this.keys.push(key);},
delKey:function(key){for(var i=0;i<this.keys.length;i++){if(key==this.keys[i]){this.keys.splice(i,1);break;}}},
css:function(k,v){with(this.UI)style[k]=(parseInt(style[k])||0)+v+"px";},
move:function(){
var $=this;
setInterval(function(){
var data={37:["left",-1],39:["left",1],38:["top",-1],40:["top",1]};
for(var i=0;i<$.keys.length;i++){if(/^[34][0789]$/.test($.keys[i])){var val=data[$.keys[i]];$.css(val[0],$.len*val<br><br>[1])}}
},10);
}
}
onload=function(){keyMove.bind("actor");}
</script>
<body>
<div id="actor"></div>
</body>
测试通过,兼容FF,IE
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询