Closed Thread
Results 1 to 4 of 4

Thread: OnMouseMove problems

  1. #1
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30

    OnMouseMove problems

    Hello,
    I have an Image Box that has a grid on it which displays an icon. When a user clicks the left mouse button and drags it over the picture box it fills in the pixel with the select color.

    The problem is this, when a user moves the mouse to fast it misses pixels. If the mouse is moved moderatly fast it will miss about every third, if it is fast then it will miss around 4 then draw one.

    So it looks like this:
    - - -- - --
    Where the - are representing filled in spaces when a user drags fast in a straight line.

    The method I use is dc.FillSolidRect(...). When the mouse is dragged slow, this problem doesn't occur. I think that the OnMouseMove commands are not completing (or that is the way it seems).

    Any ideas on how to make this work? I've created a DoEvents class and added that which didn't help.
    Here is the code:

    if (m_bDragging == true) {
    mDC->FillSolidRect(lastCol * space + 1, lastRow * hSpace,space - 1, hSpace - 1, ForeColor);
    }

    lastCol represents the previous x (I.E. 4)
    lostRow is previous y (I.E. 3)

    Space and hspace are the width of the block (for zooming, can be anywhere from 5-30 in size)

    I've tried setting the current row and pixel to the color with the same effect.

    Any help?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Void's Avatar
    Void is offline Programming Expert
    Join Date
    Jun 2006
    Posts
    410
    Rep Power
    23
    Use a projected line to draw the pixels.

    If user starts a E3 and ends at G3 draw a line. Using this method you can also draw as the user moves real fast.
    Void

  4. #3
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    So, what you are saying Void, is that I should create an algorithm to draw the line so that when the user moves fast I will not miss pixels?

  5. #4
    Void's Avatar
    Void is offline Programming Expert
    Join Date
    Jun 2006
    Posts
    410
    Rep Power
    23
    Yes, have an algorithm to draw a straight line from point A to point B. Draw an eclipse or circle otherwise. I once created a graphics program that had this same problem and that is how I resolved it. I no longer have the code or I would post it here. Let me know if you have any more problems with it though.
    Void

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Help] I got problems
    By Pagn in forum C and C++
    Replies: 3
    Last Post: 07-28-2010, 09:21 AM
  2. General Problems with PDP-11
    By lego69 in forum Assembly
    Replies: 0
    Last Post: 04-26-2010, 08:51 PM
  3. SQL Problems in VB.NET
    By hbombhazza in forum Visual Basic Programming
    Replies: 1
    Last Post: 11-05-2009, 09:52 AM
  4. DNS Problems
    By MrGamma in forum Hosting and Registrars
    Replies: 0
    Last Post: 11-11-2008, 09:35 PM
  5. DLL Problems
    By Ronin in forum Visual Basic Programming
    Replies: 1
    Last Post: 12-20-2007, 06:29 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts