Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-24-2006, 01:03 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default 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?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 06-25-2006, 06:12 PM
Void's Avatar   
Void Void is offline
Programming Expert
 
Join Date: Jun 2006
Posts: 411
Rep Power: 12
Void is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-27-2006, 02:20 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

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?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-27-2006, 04:42 PM
Void's Avatar   
Void Void is offline
Programming Expert
 
Join Date: Jun 2006
Posts: 411
Rep Power: 12
Void is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Joomla 1.5 problems dfeller ionFiles 0 06-16-2007 12:10 AM
Problems in GETMEM.INC with newer WinXP security updates. dima_q Pascal/Delphi 0 06-04-2007 10:17 AM
Problems in compiling D-ITG MietitoreDAnime C and C++ 2 02-15-2007 12:18 PM
Problems with Google? Void Marketing 4 07-23-2006 08:12 PM


All times are GMT -5. The time now is 05:43 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads