-
January 21st, 2015, 11:21 PM
#1
Problem with ScrollBar on SDI application
Hi All,
I have created a SDI application. It have a horizontal splitter in middle for getting two views.
There is one dialog is attached to the lower view for adding few controls like static control, edit box, combo box etc.
My Lower view class is inherited from CFormView class.
As I move the splitter downwards, automatically the vertical scrollBar appears.
I want to create my custom scroll bar instead of that MFC ScrollBar.
So I have two questions to ask:
1. How can I stop this appearance of this default scrollBar on moving of splitter?
2. How can I add my custom ScrollBar to my view.
Please guide.
Thanks in Advance,
Mayank
-
January 22nd, 2015, 02:33 AM
#2
Re: Problem with ScrollBar on SDI application
Modifying the existing scrollbar could be an option ?
-
January 22nd, 2015, 03:39 AM
#3
Re: Problem with ScrollBar on SDI application
Originally Posted by mesajflaviu
Modifying the existing scrollbar could be an option ?
Yes ofcourse.
But I am not able to find which function gets called as I move my splitter downwards and suddenly the scroll bar gets appeared.
Which message create the scrollbar?
Please can you guide me how to proceed for modifying the existing scrollbar.
Thanks in Advance,
Mayank
-
January 22nd, 2015, 03:59 AM
#4
Re: Problem with ScrollBar on SDI application
Originally Posted by mayank_3103
But I am not able to find which function gets called as I move my splitter downwards and suddenly the scroll bar gets appeared.
Which message create the scrollbar?
It happens because the size of the frame around your formview (in your case - the height) became smaller than the size of the form itself.
To remove the scrollbar(s) try to call
CScrollView::SetScaleToFitSize
or
CScrollView::SetScrollSizes
Victor Nijegorodov
-
January 22nd, 2015, 05:58 AM
#5
Re: Problem with ScrollBar on SDI application
Originally Posted by VictorN
It happens because the size of the frame around your formview (in your case - the height) became smaller than the size of the form itself.
To remove the scrollbar(s) try to call
CScrollView::SetScaleToFitSize
or
CScrollView::SetScrollSizes
Actually my requirement is to use my ScrollBar instead of that default ScrollBar. I have a dll in which the custom drawn ScrollBar is implemented. And that Custom drawn scrollBar I am not able to apply on my SDI application. the default scrollBar is appearing everytime.
Please guide how can I implement my scrollBar in SDI application instead of default one.
Thanks.
-
January 22nd, 2015, 06:30 AM
#6
Re: Problem with ScrollBar on SDI application
Have a look at this Q&A in MSJ
Victor Nijegorodov
-
January 22nd, 2015, 07:22 AM
#7
Re: Problem with ScrollBar on SDI application
I just work on the same task, I give you what I have done already: (my task is to modify the scrollbar color and style to CGridCtrl) .... my trial is to work on VisualStyle:
https://msdn.microsoft.com/en-us/lib...85).aspx<br />
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
in OnDraw:
Code:
void CGridCtrlExt::OnDraw(CDC* pDC)
{
// draw the grid and after that:
HTHEME hTheme = OpenThemeData(m_hWnd, L"WINDOW");
// HTHEME hTheme = OpenThemeData(m_hWnd, L"MFCGridCtrl");
if(NULL != hTheme)
{
CScrollBar* pScrollbar = GetScrollBarCtrl(SB_VERT);
if(NULL != pScrollbar->GetSafeHwnd()) // <-- is always null
{
CRect rect;
pScrollbar->GetWindowRect(&rect);
pDC->FillSolidRect(&rect, RGB(255, 255, 0));
DrawThemeBackground(hTheme, pDC->GetSafeHdc(), WP_VERTSCROLL, VSS_NORMAL, &rect, NULL);
}
CloseThemeData(hTheme);
}
}
-
January 22nd, 2015, 07:25 AM
#8
Re: Problem with ScrollBar on SDI application
Soon as I finish my task, I will give you the solution ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|