Blacktempel
Blacktempel

Reputation: 3995

Dynamically expanding scrollbar?

So, I have been searching this on Stackoverflow, CodeProject, Google, Microsoft, [...] for the past few hours. I cannot seem to find this.

How can I re-size my CScrollBar dynamically, to expand (horizontally and vertically) to fit the content being drawn/added in it ? (CButton, CEdit, etc. are added inside at run-time).

All attempts with ->MoveWindow and ->SetWindowPos have failed.
I have tried various times overloading the OnSize and OnVScroll functions... low success.

Does the CFormView may cause the problem ? Should I rather draw the CScrollBar in CDialogEx ? Would that work ? It's my first time using CFormView, I'm not very familiar with it...

Upvotes: 0

Views: 300

Answers (1)

ScottMcP-MVP
ScottMcP-MVP

Reputation: 10425

The scrollbar size should be set to match the maximum extent of the window contents, i.e. the range of image that the user can see by scrolling. This is independent of the size of the window. See the documentation for CScrollView::SetScrollSizes

Upvotes: 1

Related Questions