Click here to Skip to main content
15,919,749 members
Home / Discussions / C#
   

C#

 
QuestionRe: Documentation [modified] Pin
jojoba201113-Mar-10 6:52
jojoba201113-Mar-10 6:52 
AnswerRe: Documentation Pin
Not Active13-Mar-10 7:10
mentorNot Active13-Mar-10 7:10 
QuestionLat/long to mils Pin
v17.poornima13-Mar-10 6:06
v17.poornima13-Mar-10 6:06 
AnswerRe: Lat/long to mils Pin
Saksida Bojan13-Mar-10 6:17
Saksida Bojan13-Mar-10 6:17 
QuestionMoving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 5:56
boreland13-Mar-10 5:56 
AnswerRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Saksida Bojan13-Mar-10 6:11
Saksida Bojan13-Mar-10 6:11 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 6:25
boreland13-Mar-10 6:25 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Saksida Bojan13-Mar-10 6:38
Saksida Bojan13-Mar-10 6:38 
The problem with this code is, that Location is screen based cordinate and e.x, e.y are client based cordinates.

it gees like this:

private int x;
private int y;
private bool first = true;

void Form1_MouseMove(object sender, MouseEventArgs e)
{ 
   if (first)
   {
      x=e.X;
      y=e.Y;
      return;
   }
   int aX = x-e.X;
   int aY = y-e.Y;
   
   // I do not remeber if it shoud be + or -
   this.Location = new Point(this.Location.X-aX, this.Location.Y-aY);
   x = e.X;
   y = e.Y;
}


for flickering issue try setting Double Buffer.

this.SetStyle(
            ControlStyles.UserPaint |
            ControlStyles.AllPaintingInWmPaint |
            ControlStyles.DoubleBuffer, true);


ps: I am coding from memory without actualy testing for errors
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 6:48
boreland13-Mar-10 6:48 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Saksida Bojan13-Mar-10 6:54
Saksida Bojan13-Mar-10 6:54 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. [modified] Pin
boreland13-Mar-10 8:18
boreland13-Mar-10 8:18 
AnswerRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Luc Pattyn13-Mar-10 9:03
sitebuilderLuc Pattyn13-Mar-10 9:03 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
OriginalGriff13-Mar-10 9:24
mveOriginalGriff13-Mar-10 9:24 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Luc Pattyn13-Mar-10 9:30
sitebuilderLuc Pattyn13-Mar-10 9:30 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 9:33
boreland13-Mar-10 9:33 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Luc Pattyn13-Mar-10 9:45
sitebuilderLuc Pattyn13-Mar-10 9:45 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 9:32
boreland13-Mar-10 9:32 
AnswerRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Luc Pattyn13-Mar-10 9:45
sitebuilderLuc Pattyn13-Mar-10 9:45 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 10:07
boreland13-Mar-10 10:07 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Luc Pattyn13-Mar-10 10:53
sitebuilderLuc Pattyn13-Mar-10 10:53 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 10:58
boreland13-Mar-10 10:58 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Luc Pattyn13-Mar-10 11:01
sitebuilderLuc Pattyn13-Mar-10 11:01 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
boreland13-Mar-10 11:11
boreland13-Mar-10 11:11 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
Luc Pattyn13-Mar-10 11:16
sitebuilderLuc Pattyn13-Mar-10 11:16 
GeneralRe: Moving (animating) a form using mouse coordinates similar to a tooltip. Pin
OriginalGriff13-Mar-10 21:46
mveOriginalGriff13-Mar-10 21:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.