急!实现类似windows鼠标选择多个文件的功能!
简单的说就是鼠标左键先按下,然后移动鼠标,就会出现一个矩形的以选择范围,就像windows里的操作一样,现在我已经基本可以实现这个功能,就是用GDI+画的那个矩形的边框一直在闪,我已经用了如双缓冲等技术,但还是闪的利害,请各位高手帮帮忙!
基本代码如下:
bool isChoose;
int mouseX;
int mouseY;
Graphics myGraphics;
Image bitmap;
public FrmAG()
{
InitializeComponent();
bitmap = new Bitmap(this.Width, this.Height);
myGraphics = Graphics.FromImage(bitmap);
this.DoubleBuffered = true;
SetStyle(ControlStyles.ResizeRedraw, true);
}
private void FrmAG_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isChoose = true;
mouseX = e.X;
mouseY = e.Y;
}
}
private void FrmAG_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isChoose = false;
Invalidate();
}
}
private void FrmAG_MouseMove(object sender, MouseEventArgs e)
{