Click here to Skip to main content
15,892,298 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralText adding to "Tip of the day " Pin
25-Feb-02 23:11
suss25-Feb-02 23:11 
GeneralRe: Text adding to "Tip of the day " Pin
Roger Allen26-Feb-02 1:04
Roger Allen26-Feb-02 1:04 
GeneralCFileDialog().. Pin
Neha25-Feb-02 23:04
Neha25-Feb-02 23:04 
GeneralRe: CFileDialog().. Pin
Fredrik Skog26-Feb-02 0:57
Fredrik Skog26-Feb-02 0:57 
GeneralFocus rect Pin
alex.barylski25-Feb-02 22:55
alex.barylski25-Feb-02 22:55 
GeneralRe: Focus rect Pin
Roger Allen26-Feb-02 1:09
Roger Allen26-Feb-02 1:09 
GeneralRe: Focus rect Pin
alex.barylski26-Feb-02 6:48
alex.barylski26-Feb-02 6:48 
GeneralRe: Focus rect Pin
Josh Knox (disabled)26-Feb-02 4:42
Josh Knox (disabled)26-Feb-02 4:42 
I had to do this once, and there's probably a better way, but here's how I remember doing it off the top of my head(Pardon my pseudocode):

OnMouseDown-
Get the start CPoint, call it pt1
Set a flag to indicate drawing of the rect
moveto(pt1.x, pt1.y)

OnMouseMove-
Check flag to see if drawing a selection rect.
Get the current CPoint, called pt2
DrawRect(pt1, pt2)
{
lineto(pt2.x, pt1.y)
lineto(pt2.x, pt2.y)
lineto(pt1.x, pt2.y)
lineto(pt1.x, pt1.y)
}
Erase any previous rect with XOR.
This requires having saved the previous position of the mouse.

Redraw the rect once the way you want it to appear.
Save the current point as the previous point to so you can erase the old rect on the next mouse move.

OnMouseUp
Check extents of rect and select anything inside.
Set flag to indicate end of drawing selection rect.




Josh Knox
that-guy.net

"Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown
GeneralXML TO PDF Pin
Özgür25-Feb-02 21:47
Özgür25-Feb-02 21:47 
GeneralRe: XML TO PDF Pin
Bill Wilson26-Feb-02 6:22
Bill Wilson26-Feb-02 6:22 
QuestionHow to Redraw the toolbar's gripper. Pin
datablader25-Feb-02 19:07
datablader25-Feb-02 19:07 
AnswerRe: How to Redraw the toolbar's gripper. Pin
alex.barylski25-Feb-02 22:26
alex.barylski25-Feb-02 22:26 
GeneralHIJRI GHAMARI ---> HIJRI SHAMSI Pin
Hadi Rezaee25-Feb-02 19:02
Hadi Rezaee25-Feb-02 19:02 
GeneralRe: HIJRI GHAMARI ---> HIJRI SHAMSI Pin
Nish Nishant25-Feb-02 20:12
sitebuilderNish Nishant25-Feb-02 20:12 
GeneralRe: HIJRI GHAMARI ---> HIJRI SHAMSI Pin
Hadi Rezaee26-Feb-02 0:47
Hadi Rezaee26-Feb-02 0:47 
GeneralRe: HIJRI GHAMARI ---> HIJRI SHAMSI Pin
Mazdak26-Feb-02 1:17
Mazdak26-Feb-02 1:17 
GeneralRe: HIJRI GHAMARI ---> HIJRI SHAMSI Pin
Hadi Rezaee26-Feb-02 18:09
Hadi Rezaee26-Feb-02 18:09 
Generalnaming conventions and standards Pin
Roman Nurik25-Feb-02 18:03
Roman Nurik25-Feb-02 18:03 
GeneralRe: naming conventions and standards Pin
Bill Wilson26-Feb-02 6:28
Bill Wilson26-Feb-02 6:28 
GeneralMFC list view control question.... Pin
David Z25-Feb-02 17:35
David Z25-Feb-02 17:35 
GeneralRe: MFC list view control question.... Pin
Nish Nishant25-Feb-02 18:15
sitebuilderNish Nishant25-Feb-02 18:15 
GeneralRe: MFC list view control question.... Pin
Ravi Bhavnani25-Feb-02 18:27
professionalRavi Bhavnani25-Feb-02 18:27 
GeneralRe: MFC list view control question.... Pin
David Z25-Feb-02 18:35
David Z25-Feb-02 18:35 
GeneralRe: MFC list view control question.... Pin
Nish Nishant25-Feb-02 18:41
sitebuilderNish Nishant25-Feb-02 18:41 
GeneralRe: MFC list view control question.... Pin
Ravi Bhavnani25-Feb-02 18:53
professionalRavi Bhavnani25-Feb-02 18:53 

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.