C
chinaplate
Unregistered / Unconfirmed
GUEST, unregistred user!
我用 ControlPaint.DrawReserverLine(P1,P2,Color.Black)绘制直线橡皮筋效果。效果确实出来了,但在绘制橡皮筋的过程中,擦除直线后,确在留下了FORM上留下了斑斑点点,象麻子脸,我对比了每一次画线和擦线的坐标值,擦线操作确实能把画线操作给异或掉。而且,我把DrawReversibleLine改为DrawReversibleFrame操作,这次却擦的干干净净。为什么会这样,我该怎样处理?
bool isDragging=false;
Point startP;
Point lastP;
private void Form2_Load(object sender, System.EventArgs e)
{
startP=new Point();
lastP=new Point();
}
private void Form2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
isDragging=true;
startP.X=e.X;
startP.Y=e.Y;
lastP.X=-1;
lastP.Y=-1;
this.Capture=true;
}
private void Form2_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (isDragging)
{
Point p1;
Point p2;
if (lastP.X!=-1)
{
p1=PointToScreen(startP);
p2=PointToScreen(lastP);
ControlPaint.DrawReversibleLine(p1,p2,Color.Black);
}
lastP.X=e.X;
lastP.Y=e.Y;
p1=PointToScreen(startP);
p2=PointToScreen(lastP);
ControlPaint.DrawReversibleLine(p1,p2,Color.Black);
}
}
---------------------------------------
哎,M$不在C#中提供SetRop2,处理起来,好麻烦呀。
bool isDragging=false;
Point startP;
Point lastP;
private void Form2_Load(object sender, System.EventArgs e)
{
startP=new Point();
lastP=new Point();
}
private void Form2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
isDragging=true;
startP.X=e.X;
startP.Y=e.Y;
lastP.X=-1;
lastP.Y=-1;
this.Capture=true;
}
private void Form2_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (isDragging)
{
Point p1;
Point p2;
if (lastP.X!=-1)
{
p1=PointToScreen(startP);
p2=PointToScreen(lastP);
ControlPaint.DrawReversibleLine(p1,p2,Color.Black);
}
lastP.X=e.X;
lastP.Y=e.Y;
p1=PointToScreen(startP);
p2=PointToScreen(lastP);
ControlPaint.DrawReversibleLine(p1,p2,Color.Black);
}
}
---------------------------------------
哎,M$不在C#中提供SetRop2,处理起来,好麻烦呀。