Scrollbars are shown incorrectly.
-
Hi. Well... I have a trouble with scrollbars. In my (developer) computer it all looks great! BUT in any other computer it looks incorrectly. The first time, when i create the window scrollbars are painted on the border of the dialog instead of the inside of the window. And when i resize it, it repaints the window correctly with the scrollbars inside. This i wrote in OnCreate
this->EnableScrollBar(SB\_VERT); this->EnableScrollBar(SB\_HORZ);
And this is at OnInit
this->SetScrollRange(SB\_HORZ,0,2\*STARTPIXELX+MAPSQUARE\*FIELDSIZE); this->SetScrollRange(SB\_VERT,0,2\*STARTPIXELY+MAPSQUARE\*FIELDSIZE); SCROLLINFO info; info.cbSize = sizeof(info); info.fMask = SIF\_ALL | SIF\_DISABLENOSCROLL; //SIF\_ALL info.nMin = 0; info.nMax = 2\*STARTPIXELY+MAPSQUARE\*FIELDSIZE; CRect rr; this->GetClientRect(&rr); info.nPage = rr.bottom-rr.top; info.nPos = 0; info.nTrackPos = 0; SetScrollInfo(SB\_VERT,&info); info.nPage = rr.right-rr.left; info.nMax = 2\*STARTPIXELX+MAPSQUARE\*FIELDSIZE; SetScrollInfo(SB\_HORZ,&info); this->ShowScrollBar(SB\_VERT); this->ShowScrollBar(SB\_HORZ);
My dialog has application window, Overlapped, resizing border styles. Pls help!
-
Hi. Well... I have a trouble with scrollbars. In my (developer) computer it all looks great! BUT in any other computer it looks incorrectly. The first time, when i create the window scrollbars are painted on the border of the dialog instead of the inside of the window. And when i resize it, it repaints the window correctly with the scrollbars inside. This i wrote in OnCreate
this->EnableScrollBar(SB\_VERT); this->EnableScrollBar(SB\_HORZ);
And this is at OnInit
this->SetScrollRange(SB\_HORZ,0,2\*STARTPIXELX+MAPSQUARE\*FIELDSIZE); this->SetScrollRange(SB\_VERT,0,2\*STARTPIXELY+MAPSQUARE\*FIELDSIZE); SCROLLINFO info; info.cbSize = sizeof(info); info.fMask = SIF\_ALL | SIF\_DISABLENOSCROLL; //SIF\_ALL info.nMin = 0; info.nMax = 2\*STARTPIXELY+MAPSQUARE\*FIELDSIZE; CRect rr; this->GetClientRect(&rr); info.nPage = rr.bottom-rr.top; info.nPos = 0; info.nTrackPos = 0; SetScrollInfo(SB\_VERT,&info); info.nPage = rr.right-rr.left; info.nMax = 2\*STARTPIXELX+MAPSQUARE\*FIELDSIZE; SetScrollInfo(SB\_HORZ,&info); this->ShowScrollBar(SB\_VERT); this->ShowScrollBar(SB\_HORZ);
My dialog has application window, Overlapped, resizing border styles. Pls help!
Well.. A found a solution.. I don't like it, but it works.
void MainDial::OnTimer(UINT_PTR nIDEvent)
{
if (theApp.First)
{
CRect rr;
this->GetWindowRect(&rr);
rr.right-=1;
rr.bottom-=1;
MainDial::MoveWindow(rr);
theApp.First=false;
}
}modified on Friday, October 23, 2009 6:53 PM
-
Well.. A found a solution.. I don't like it, but it works.
void MainDial::OnTimer(UINT_PTR nIDEvent)
{
if (theApp.First)
{
CRect rr;
this->GetWindowRect(&rr);
rr.right-=1;
rr.bottom-=1;
MainDial::MoveWindow(rr);
theApp.First=false;
}
}modified on Friday, October 23, 2009 6:53 PM
You could put this in
OnSize
and check.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
You could put this in
OnSize
and check.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)The problem is that after OnSize it shows all correct, that's why i use MoveWindow in my timer. But my problem is how to make that right after OnInit it draws correctly? I resolved it only with timer... And by the way.. WHY it's all working on MY computer and on any other not?!?! (I have VS2008 SP1 and Windows XP SP3)
-
The problem is that after OnSize it shows all correct, that's why i use MoveWindow in my timer. But my problem is how to make that right after OnInit it draws correctly? I resolved it only with timer... And by the way.. WHY it's all working on MY computer and on any other not?!?! (I have VS2008 SP1 and Windows XP SP3)
You can try another method. Create a custom message and map it to a handler using ON_MESSAGE[^]. In the
OnInitDialog
function to a PostMessage[^] for your custom message. In the message handler you could put the code that is in the timer.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
You can try another method. Create a custom message and map it to a handler using ON_MESSAGE[^]. In the
OnInitDialog
function to a PostMessage[^] for your custom message. In the message handler you could put the code that is in the timer.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
Solution found. LRESULT MainDial::OnMyMsg(WPARAM, LPARAM) { CRect rr; this->GetWindowRect(&rr); rr.bottom-=1; rr.right-=1; MainDial::MoveWindow(rr); return NULL; } with ON_MESSAGE use. Big thnx.
modified on Friday, October 23, 2009 8:30 PM
:thumbsup:
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)