C# 我运行一个界面,截面中有一图片 怎么让它可以移动,看鼠标经过有十字图表 MouseMove事件中InvalidatePaint事件中以当前鼠标点为中心,绘制一大十字 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果图片是在PictureBox中的话,设置该控件的光标为十字光标就可以了。//PictureBox pictureBox1;pictureBox1.Cursor = Cursors.CrossCursor; winform在程序运行中,鼠标选中控件,控件呈选中状态,并能拖动拖动鼠标改变控件大小和位置,如从工具箱中? 把窗体拖动事件改成PictureBox的拖动事件..附上一个窗体拖动事件..把这个时间复制进去..拿图片的对应事件调用这3个事件就行private bool mousedown=false; private bool threadstrat = true; private Point mouseOffset; private bool flag = true; Label[] lb = new Label[6]; Thread[] ts = new Thread[6];private void Form1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.mouseOffset = new Point(-e.X, -e.Y); mousedown = true; } } private void Form1_MouseMove(object sender, MouseEventArgs e) { if (mousedown) { Point mousePos = Control.MousePosition; mousePos.Offset(mouseOffset.X, mouseOffset.Y); Location = mousePos; } } private void Form1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { mousedown = false; } } 十字图标只要在属性里设置移动到PictureBox上的鼠标指针样式就行.. 引用第三方DLL问题,DllImport Mdi窗体如何主子窗体总是显示在父窗体的居中或居右上角 用C#做一个答题器. 问个正则表达式的问题 求助 @符号到底是什么,本质? 客户讲讲,现在c#和vb.net各占的比例是多大呀?据说vb.net市场萎缩得很快,是不是真的呀? 求助北京程序员(散分)! c#如何打包winform程序 我想在.net制作安装程序中,加入一个注册表项,记录程序的安装路径,怎么办,谢谢 C#+数据库 急!无法调试!
//PictureBox pictureBox1;
pictureBox1.Cursor = Cursors.CrossCursor;
附上一个窗体拖动事件..把这个时间复制进去..拿图片的对应事件调用这3个事件就行private bool mousedown=false;
private bool threadstrat = true;
private Point mouseOffset;
private bool flag = true;
Label[] lb = new Label[6];
Thread[] ts = new Thread[6];
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.mouseOffset = new Point(-e.X, -e.Y);
mousedown = true;
}
} private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (mousedown)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(mouseOffset.X, mouseOffset.Y);
Location = mousePos;
}
} private void Form1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mousedown = false;
}
}