Click here to Skip to main content
16,004,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC - Changing text color Pin
Alessandra777-Feb-07 12:41
Alessandra777-Feb-07 12:41 
AnswerRe: MFC - Changing text color Pin
Mark Salsbery7-Feb-07 12:57
Mark Salsbery7-Feb-07 12:57 
AnswerRe: MFC - Changing text color Pin
Alessandra777-Feb-07 13:13
Alessandra777-Feb-07 13:13 
QuestionRe: MFC - Changing text color Pin
Alessandra777-Feb-07 13:28
Alessandra777-Feb-07 13:28 
AnswerRe: MFC - Changing text color Pin
Alessandra777-Feb-07 13:31
Alessandra777-Feb-07 13:31 
QuestionRe: MFC - Changing text color Pin
Mark Salsbery7-Feb-07 13:35
Mark Salsbery7-Feb-07 13:35 
AnswerRe: MFC - Changing text color Pin
Alessandra777-Feb-07 13:38
Alessandra777-Feb-07 13:38 
GeneralRe: MFC - Changing text color Pin
Mark Salsbery7-Feb-07 14:08
Mark Salsbery7-Feb-07 14:08 
You may be doing something similar already...

This is pseudocode for one way to handle it
Member variables:
   CPoint BasePoint;
   bool fInCapture;
   CRect TextRect;  // bounding rect of text (in client coordinates)
 
void CMyWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
   if TextRect.PtInRect(point)
   {
      BasePoint = point;
      ::SetCapture(*this);
      fInCapture = true;
   }
}
 
void CMyWnd::OnMouseMove(UINT nFlags, CPoint point)
{
   if (fInCapture)
   {
      if (point != BasePoint)
      {
          TextRect.OffsetRect(point.x - BasePoint.x, point.y - BasePoint.y)
          Invalidate(TRUE);
          UpdateWindow();
          BasePoint = point;
      }
   }
}
 
void CMyWnd::OnLButtonUp(UINT nFlags, CPoint point)
{
   if (fInCapture)
   {
      fInCapture = false;
      ::ReleaseCapture();
   }
}

AnswerRe: MFC - Changing text color Pin
Mark Salsbery7-Feb-07 13:32
Mark Salsbery7-Feb-07 13:32 
GeneralRe: MFC - Changing text color Pin
Alessandra777-Feb-07 13:39
Alessandra777-Feb-07 13:39 
QuestionHelp with simple Visual C++ HTTP Client Pin
drows7-Feb-07 11:42
drows7-Feb-07 11:42 
AnswerRe: Help with simple Visual C++ HTTP Client Pin
Ravi Bhavnani7-Feb-07 14:11
professionalRavi Bhavnani7-Feb-07 14:11 
AnswerRe: Help with simple Visual C++ HTTP Client Pin
ThatsAlok7-Feb-07 20:05
ThatsAlok7-Feb-07 20:05 
QuestionPython to C++ Pin
kerthy_297-Feb-07 9:59
kerthy_297-Feb-07 9:59 
QuestionRe: Python to C++ Pin
David Crow7-Feb-07 10:24
David Crow7-Feb-07 10:24 
AnswerRe: Python to C++ Pin
kerthy_297-Feb-07 12:07
kerthy_297-Feb-07 12:07 
GeneralRe: Python to C++ Pin
Jörgen Sigvardsson7-Feb-07 12:44
Jörgen Sigvardsson7-Feb-07 12:44 
GeneralRe: Python to C++ Pin
kerthy_297-Feb-07 12:53
kerthy_297-Feb-07 12:53 
GeneralRe: Python to C++ Pin
Jörgen Sigvardsson7-Feb-07 13:04
Jörgen Sigvardsson7-Feb-07 13:04 
GeneralRe: Python to C++ Pin
Garth J Lancaster7-Feb-07 14:24
professionalGarth J Lancaster7-Feb-07 14:24 
QuestionDLL renaming Pin
act_x7-Feb-07 9:37
act_x7-Feb-07 9:37 
AnswerRe: DLL renaming Pin
Hamid_RT7-Feb-07 18:29
Hamid_RT7-Feb-07 18:29 
AnswerRe: DLL renaming Pin
prasad_som7-Feb-07 18:39
prasad_som7-Feb-07 18:39 
QuestionMFC or VB.net Pin
Member 38045467-Feb-07 7:51
Member 38045467-Feb-07 7:51 
AnswerRe: MFC or VB.net Pin
Hamid_RT7-Feb-07 8:18
Hamid_RT7-Feb-07 8:18 

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.