当数据在mfc中以自动换行填充或不自动换行填充静态文本时,如何清除和更改静态文本数据的颜色? [英] How to clear and change color of static text data when data fills the static text in wrap or no wrap in mfc?

查看:115
本文介绍了当数据在mfc中以自动换行填充或不自动换行填充静态文本时,如何清除和更改静态文本数据的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当数据以自动换行显示形式填充静态文本或在mfc中不使用自动换行属性时,如何清除静态文本数据?

假设有文字说
1 2 3 4 5和

当下一个6到来时,它应该擦除1,并且文本中的数据应为

2 3 4 5 6

当下一个7到来时,它应擦除2,并且文本中的数据应为

3 4 5 6 7

而且我也想更改最近输入的字符的颜色,例如6,然后当7变为6时为正常颜色,而7应更改颜色

How to clear static text data when data fills the static text in display in wrap or no wrap properties are used in mfc?

suppose there is a text say
1 2 3 4 5 and

when next 6 comes it should erase 1 and the data in text should be

2 3 4 5 6

when next 7comes it should erase 2 and the data in text should be

3 4 5 6 7

And also I want to change the color of recently entered character say 6 then when 7 comes 6 comes to normal color and 7 should change the color

推荐答案

静态或非静态-与问题无关(如果您正确理解了什么是静态的). "MFC"可能意味着使用类CString,请参见:
http://www.cppdoc.com/example/mfc/classdoc/MFC/CString.html [ ^ ].

CString::Delete(int nIndex, int nCount = 1)可以使用的功能.

—SA
Static or non-static — it''s irrelevant to the question (if you understand what is static correctly). "MFC" probably means using the class CString, please see:
http://www.cppdoc.com/example/mfc/classdoc/MFC/CString.html[^].

The function you can use if CString::Delete(int nIndex, int nCount = 1).

—SA


如果要更改颜色,请使用RichEdit控件,在该控件中,您可以为锁符指定不同的颜色.参见 [
if you want to change the colors use RichEdit control, in which you can specify different colors for chracaters. see [^]


d++; //here count the number of displayed characters
if(d==28)// my static text control 28 characters fills the length of its display
{
m_Keys.dischords.Empty();//when it reaches limit empty the text
d=0;//start again from first count
}
displaychords(m_Keys.dischords);


这篇关于当数据在mfc中以自动换行填充或不自动换行填充静态文本时,如何清除和更改静态文本数据的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆