PaPa Bango Posted April 7, 2011 Posted April 7, 2011 (edited) Hi every one, I'm trying to code a nfo viewer with a scrolling effect for the text. I followed the exemple of Jowy (irc nfo viewer v2) but i've a problem that i don't manage to find. When the top of the text is touching the top of the Dialog, it scrolls back, so i can't see the whole text...i'd like (of course )that the text continues for the bottom of the text arrives at the top of the dialog. Here 's the code of the scrolling i did : invoke GetClientRect,hWnd,ADDR NfoRect mov hdc,FUNC(GetDC,hWnd) mov chdc,FUNC(CreateCompatibleDC,hdc) mov hbmp,FUNC(CreateCompatibleBitmap,hdc,NfoRect.right,NfoRect.bottom) invoke SelectObject,chdc,hbmp m2m rClientNfo.right,NfoRect.right m2m rClientNfo.bottom,NfoRect.bottom sub rClientNfo.bottom,210 dec rClientNfo.right invoke FrameRect,chdc,ADDR rClientNfo,hpen invoke SetTextColor,chdc,Cyan invoke SetBkColor,chdc,TRANSPARENT invoke IntersectClipRect,chdc,rClientNfo.left,rClientNfo.top,rClientNfo.right,rClientNfo.bottom invoke SelectObject,hdc,hNFOFont invoke DrawText,hdc,ADDR hViewMap,-1,ADDR rScroll,DT_CALCRECT + DT_NOPREFIX + DT_TOP + DT_NOCLIP m2m rScroll.right,rClientNfo.right sub rScroll.right,5 add rScroll.top,GETV(rClientNfo.bottom) add rScroll.bottom,eax invoke ReleaseDC,hWnd,hdc mov TimerID,FUNC(SetTimer,hWnd,IDC_TIMER,SCROLLSPEED,NULL) mov ID,1 .elseif uMsg == WM_PAINT invoke BeginPaint,hWnd,addr ps mov hdc,eax invoke SelectObject,chdc,hNFOFont invoke DrawText,chdc,hViewMap,-1,ADDR rScroll, DT_TOP + DT_NOPREFIX + DT_NOCLIP invoke BitBlt,hdc,220,210,NfoRect.right,NfoRect.bottom,chdc,0,0,SRCCOPY invoke EndPaint,hWnd,addr ps .elseif uMsg == WM_TIMER add rScroll.top,GETV(ScrollOffset) add rScroll.bottom,eax .if SDWORD PTR rScroll.top >= GETV(rClientNfo.bottom) mov ScrollOffset,-1 .ELSE .if SDWORD PTR rScroll.bottom <= GETV(rClientNfo.top) mov ScrollOffset,1 .endif .endif invoke InvalidateRect,hWnd,NULL,FALSE .elseif uMsg==WM_CTLCOLORDLG return hBrush ret Could you see what do i wrong? Thanks for your Help Regards. Edited April 7, 2011 by papa bango
wunder Posted May 22, 2011 Posted May 22, 2011 Hi every one, I'm trying to code a nfo viewer with a scrolling effect for the text. I followed the exemple of Jowy (irc nfo viewer v2) but i've a problem that i don't manage to find. When the top of the text is touching the top of the Dialog, it scrolls back, so i can't see the whole text...i'd like (of course )that the text continues for the bottom of the text arrives at the top of the dialog. Here 's the code of the scrolling i did : invoke GetClientRect,hWnd,ADDR NfoRect mov hdc,FUNC(GetDC,hWnd) mov chdc,FUNC(CreateCompatibleDC,hdc) mov hbmp,FUNC(CreateCompatibleBitmap,hdc,NfoRect.right,NfoRect.bottom) invoke SelectObject,chdc,hbmp m2m rClientNfo.right,NfoRect.right m2m rClientNfo.bottom,NfoRect.bottom sub rClientNfo.bottom,210 dec rClientNfo.right invoke FrameRect,chdc,ADDR rClientNfo,hpen invoke SetTextColor,chdc,Cyan invoke SetBkColor,chdc,TRANSPARENT invoke IntersectClipRect,chdc,rClientNfo.left,rClientNfo.top,rClientNfo.right,rClientNfo.bottom invoke SelectObject,hdc,hNFOFont invoke DrawText,hdc,ADDR hViewMap,-1,ADDR rScroll,DT_CALCRECT + DT_NOPREFIX + DT_TOP + DT_NOCLIP m2m rScroll.right,rClientNfo.right sub rScroll.right,5 add rScroll.top,GETV(rClientNfo.bottom) add rScroll.bottom,eax invoke ReleaseDC,hWnd,hdc mov TimerID,FUNC(SetTimer,hWnd,IDC_TIMER,SCROLLSPEED,NULL) mov ID,1 .elseif uMsg == WM_PAINT invoke BeginPaint,hWnd,addr ps mov hdc,eax invoke SelectObject,chdc,hNFOFont invoke DrawText,chdc,hViewMap,-1,ADDR rScroll, DT_TOP + DT_NOPREFIX + DT_NOCLIP invoke BitBlt,hdc,220,210,NfoRect.right,NfoRect.bottom,chdc,0,0,SRCCOPY invoke EndPaint,hWnd,addr ps .elseif uMsg == WM_TIMER add rScroll.top,GETV(ScrollOffset) add rScroll.bottom,eax .if SDWORD PTR rScroll.top >= GETV(rClientNfo.bottom) mov ScrollOffset,-1 .ELSE .if SDWORD PTR rScroll.bottom <= GETV(rClientNfo.top) mov ScrollOffset,1 .endif .endif invoke InvalidateRect,hWnd,NULL,FALSE .elseif uMsg==WM_CTLCOLORDLG return hBrush ret Could you see what do i wrong? Thanks for your Help Regards. yup, I used the same source and when I messed with this part: mov hdc,FUNC(GetDC,hWnd) that exact same thing happened, but it does not seem like you touched that... May I suggest that you post the whole .exe source next time... since something else is effecting that ...you need to show the whole source But I can Help you.... here is that original source (in the About): http://forum.tuts4yo...showtopic=19575 I am not sure if it's this person "Jowy" or not but the above member posted it 3 years ago... and it works like a charm ..... let me know how you make out
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now