The same sprite as
this topic's about.
now, i want to drag the sprite..
we (fire2burn and me) have bin working for 2 houres now to get this fixed.
we got the following code:
public void OnPaint(Device device, string title, string text)
{
// if mouse down and drag window, x and y pos changes
cMouse muis = new cMouse();
muis.Update();
if (muis.LeftButtonDown)
{
int curx = cTools.FormHandle.PointToClient(Cursor.Position).X;
int cury = cTools.FormHandle.PointToClient(Cursor.Position).Y;
if (cTools.FormHandle.PointToClient(Cursor.Position).X > xx &&
cTools.FormHandle.PointToClient(Cursor.Position).X <= 350 + xx &&
cTools.FormHandle.PointToClient(Cursor.Position).Y >= yy &&
cTools.FormHandle.PointToClient(Cursor.Position).Y <= 150 + yy)
{
if (!Dragger)
{
tempx = cTools.FormHandle.PointToClient(Cursor.Position).X;
tempy = cTools.FormHandle.PointToClient(Cursor.Position).Y;
Dragger = true;
}
else
{
xx = curx - tempx; //curx = tempx
yy = cury - tempy; // cury = tempy
}
}
}
else
{
Dragger = false;
}
frmSprite.OnPaint(device,xx,yy,350,150); // 350, 150
frmButton.OnPaint(cTools.FormHandle, new System.Drawing.PointF((xx + 350) - 110, yy + 97), new System.Drawing.SizeF(87, 29), "OK");
frmCaption.OnPaint(title, xx + 40, yy + 13, System.Drawing.Color.White);
frmText.OnPaint(xx.ToString() + "," + tempy.ToString(), xx + 25, yy + 40, System.Drawing.Color.Black);
//frmText.OnPaint(text, xx + 25, yy + 40, System.Drawing.Color.Black);
}
we have problems with these 2 lines
xx = curx - tempx; //curx = tempx
yy = cury - tempy; // cury = tempy
cuz, cury and tempy have the same value..
same with curx and tempx..
Kind regards
djnevs and Fire2Burn