Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC6
Now,I can make the string rolling in the dialog of vc, but the problem is that it can't show very perfectly,when it rolling from the bottom to the top,where it rolling, a long line would following, the code is in function OnTimer(),a fraction of code as follows:
	m_nWidth+=5;            //defined in class
	CClientDC dc(this);
	TEXTMETRIC tm;
	dc.GetTextMetrics(&tm);
	CRect rect;
	rect.left=0;
	rect.top=200;
	rect.right=m_nWidth;
	rect.bottom=rect.top+tm.tmHeight;
	
	dc.SetTextColor(RGB(0,255,0));
	dc.SetBkColor(RGB(240,240,240));
	CString str;
	str.LoadString(IDS_STRING);
	
	rect.top=150;
	rect.bottom=rect.top+tm.tmHeight;
	dc.DrawText(str,rect,DT_RIGHT);
 
	CSize sz=dc.GetTextExtent(str);
    if(m_nWidth==sz.cx)
	{
		m_nWidth-=5;
		a--;
		if(a==-tm.tmHeight)
			a=150;
		rect.top=a;
		rect.bottom=a+tm.tmHeight;
		dc.DrawText(str,rect,DT_BOTTOM|DT_SINGLELINE);
	}
    CDialog::OnTimer(nIDEvent);
maybe help you understand me clearly,as follows is my question link: http://topic.csdn.net/u/20111125/12/52e25e41-24ce-487e-90ca-b6cab574af59.html[^]
Posted 3-Dec-11 0:41am
MSTzhao375
Comments
johny10151981 at 3-Dec-11 8:05am
   
I didnt do much work with this thing, but I am asking
how about drawing the text OnPaint, but set the position in the ontimer as usual
MSTzhao at 3-Dec-11 20:57pm
   
I have tested it,but it seems useless.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 520
1 Maciej Los 290
2 Richard MacCutchan 265
3 BillWoodruff 265
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,764
1 Sergey Alexandrovich Kryukov 7,437
2 DamithSL 5,639
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411028.1 | Last Updated 3 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100