• Announcements

Archived

This topic is now archived and is closed to further replies.

A scroll bar mystery

Recommended Posts

savagerx    122
Hi, I''ve been trying to work with this scroll bar but it seems that it does not repaint properly ie. all I get are scrabbled letters. I have hereby attached my WM_PAINT for advice.

case WM_PAINT:
si.cbSize = sizeof(si);
GetScrollInfo(hwnd,SB_VERT,&si);
iVScrollPos = si.nPos;
si.cbSize = sizeof(si);
GetScrollInfo(hwnd,SB_HORZ,&si);
iHScrollPos = si.nPos;

hdc = BeginPaint(hwnd,&ps);
iPaintBeg = min(NUMLINES-1,iVScrollPos +
(ps.rcPaint.top/icychar));
iPaintEnd = max(0,iVScrollPos + (ps.rcPaint.bottom/icychar));

for(i=iPaintBeg;i<=iPaintEnd;i++)
{
x = (icxchar * (1-iHScrollPos));
y = (icychar * (i-iVScrollPos));
TextOut(hdc,x,y,SYSMET2[i].szTag,
lstrlen(SYSMET2[i].szTag));
TextOut(hdc,(x+(icxcap*20)),y,SYSMET2[i].szDescription,
lstrlen(SYSMET2[i].szDescription));
SetTextAlign(hdc,TA_TOP|TA_RIGHT);
TextOut(hdc,(x+(icxcap*20)+(icxchar*40)),y,szBuffer,
wsprintf(szBuffer,"%5d",
GetSystemMetrics(SYSMET2[i].nIndex)));
SetTextAlign(hdc,TA_TOP|TA_LEFT);
}
EndPaint(hwnd,&ps);
return 0;


Share on other sites
Guest Anonymous Poster
???

Share on other sites
rrrrriiigghtt.. (Dr. Evil voice )

---------------------------------------------------------------------------------------------------------------------------------------
"With my feet upon the ground I move myeslf between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - TOOL
---------------------------------------------------------------------------------------------------------------------------------------
[TheBlackJester]

Share on other sites
Guest Anonymous Poster
"Savagerx", do you make an effort to look for answers yourself @ MSDN? Even though this is a beginner section, it does not mean that you can get easy answers without breaking a sweat. Go work for it!

MSDN offers quite a number of valuable information for Windows Programming.

ANNOY

  switch (...){    case 1:    {        int var = 2;        ...;        break;    }    case 2:    {        int yet_another_var = 3;        ...;        break;    }}