Click here to Skip to main content
15,888,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box [modified] Pin
John50219-Feb-09 7:02
John50219-Feb-09 7:02 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson19-Feb-09 7:10
professionalStuart Dootson19-Feb-09 7:10 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John50219-Feb-09 8:28
John50219-Feb-09 8:28 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson19-Feb-09 9:03
professionalStuart Dootson19-Feb-09 9:03 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John50219-Feb-09 9:18
John50219-Feb-09 9:18 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson19-Feb-09 9:59
professionalStuart Dootson19-Feb-09 9:59 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John50219-Feb-09 10:10
John50219-Feb-09 10:10 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson20-Feb-09 2:17
professionalStuart Dootson20-Feb-09 2:17 
Here's the entirety of my OnPaint code. image1_ and image2_ are both member variables of type CImage. baseSize_ (also a member variable) is the initial size of the dialog. offset_ (also a member variable) is a CPoint holding the offset from the top-left point of the area on which I draw to the top-left of the visible area (i.e. the offset due to scrolling). slider_ is a member variable of type CSliderCtrl.

PAINTSTRUCT ps;
CDC* paintDC = BeginPaint(&ps);
CRect rcImage1(baseSize_);
rcImage1.bottom /= 2;
CRect rcImage2;
rcImage2.SubtractRect(baseSize_, rcImage1);
rcImage1.right -=100;
rcImage2.right -=100;
rcImage1.OffsetRect(-offset_);
rcImage2.OffsetRect(-offset_);
image1_.StretchBlt(*paintDC, rcImage1, SRCCOPY);
image2_.StretchBlt(*paintDC, rcImage2, SRCCOPY);


CPen redPen(PS_SOLID|PS_GEOMETRIC, 2, RGB(0xff, 0, 0));
CPen* oldPen = paintDC->SelectObject(&redPen);
CRect rcThumb;
slider_.GetThumbRect(&rcThumb);
slider_.MapWindowPoints(this, &rcThumb);
CPoint start(rcThumb.CenterPoint().x, rcThumb.bottom);
CPoint end(rcThumb.CenterPoint().x, rcImage2.bottom);
paintDC->MoveTo(start);
paintDC->LineTo(end);
paintDC->SelectObject(oldPen);
EndPaint(&ps);


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John50222-Feb-09 1:32
John50222-Feb-09 1:32 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John5021-Mar-09 19:07
John5021-Mar-09 19:07 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson1-Mar-09 20:56
professionalStuart Dootson1-Mar-09 20:56 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John5021-Mar-09 21:58
John5021-Mar-09 21:58 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson1-Mar-09 22:06
professionalStuart Dootson1-Mar-09 22:06 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John5021-Mar-09 22:28
John5021-Mar-09 22:28 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson1-Mar-09 23:14
professionalStuart Dootson1-Mar-09 23:14 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John5022-Mar-09 0:13
John5022-Mar-09 0:13 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
Stuart Dootson2-Mar-09 0:39
professionalStuart Dootson2-Mar-09 0:39 
GeneralRe: Need help on how to create image on child window and have to move along with vertical scroll bar to my dialog box Pin
John50212-Feb-09 1:13
John50212-Feb-09 1:13 
QuestionHeap corruption probelm when i try to return std::string from function in dll Pin
dhpatil15-Feb-09 1:54
dhpatil15-Feb-09 1:54 
AnswerRe: Heap corruption probelm when i try to return std::string from function in dll Pin
Stuart Dootson5-Feb-09 2:47
professionalStuart Dootson5-Feb-09 2:47 
QuestionHow to execute other programs at the given time? Pin
fantasy12155-Feb-09 1:46
fantasy12155-Feb-09 1:46 
QuestionRe: How to execute other programs at the given time? Pin
CPallini5-Feb-09 2:02
mveCPallini5-Feb-09 2:02 
GeneralRe: How to execute other programs at the given time? Pin
fantasy12155-Feb-09 2:17
fantasy12155-Feb-09 2:17 
GeneralRe: How to execute other programs at the given time? [modified] Pin
CPallini5-Feb-09 2:39
mveCPallini5-Feb-09 2:39 
GeneralRe: How to execute other programs at the given time? Pin
Stuart Dootson5-Feb-09 2:42
professionalStuart Dootson5-Feb-09 2:42 

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.