disable CString value
-
hi all, i have a value like this in my application.. CString strTemp = "hello world"; now, i want the word "world" to be disabled(grayed out..) like wat appear in a static text box.. is it possible? Thanks, Rakesh.
CString class holds just a string (array of characters). It doesn't have any color information associated with it.
-
hi all, i have a value like this in my application.. CString strTemp = "hello world"; now, i want the word "world" to be disabled(grayed out..) like wat appear in a static text box.. is it possible? Thanks, Rakesh.
How are you displaying the string ? As already mentioned by somebody else, CString is just a class containing data and doesn't have any relation with how it will displayed.
Cédric Moonen Software developer
Charting control [v3.0 - Updated] OpenGL game tutorial in C++ -
hi all, i have a value like this in my application.. CString strTemp = "hello world"; now, i want the word "world" to be disabled(grayed out..) like wat appear in a static text box.. is it possible? Thanks, Rakesh.
What you want is a different color for a word. You can only disable/enable windows and not words. Also as Rejeesh said, you cannot do that with a CString alone. You could use a control similar to a rich edit control and show one word with a different color.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
hi all, i have a value like this in my application.. CString strTemp = "hello world"; now, i want the word "world" to be disabled(grayed out..) like wat appear in a static text box.. is it possible? Thanks, Rakesh.
If you are using the string in pDC->TextOut (...) you can do it as well by changing the font color, but you can't do it only depending on words, you will need different strings, so you print one, change the color and then print the next. this[^] or this[^]may be useful for you as well.
Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.
-
hi all, i have a value like this in my application.. CString strTemp = "hello world"; now, i want the word "world" to be disabled(grayed out..) like wat appear in a static text box.. is it possible? Thanks, Rakesh.
Rakesh5 wrote:
i have a value like this in my application.. CString strTemp = "hello world"; now, i want the word "world" to be disabled(grayed out..) like wat appear in a static text box.. is it possible?
Sorry, but that isn't possible. Kindly buy and read a beginner level book on Windows programming.
“Follow your bliss.” – Joseph Campbell
-
hi all, i have a value like this in my application.. CString strTemp = "hello world"; now, i want the word "world" to be disabled(grayed out..) like wat appear in a static text box.. is it possible? Thanks, Rakesh.
One way to store colour information in a CString is to use HTML tags and then dump the string into a HTML enabled control. -or- Use RTF codes and dump into a Rich Edit Control.
-
One way to store colour information in a CString is to use HTML tags and then dump the string into a HTML enabled control. -or- Use RTF codes and dump into a Rich Edit Control.
Michael Schubert wrote:
One way to store colour information in a CString is to use HTML tags and then dump the string into a HTML enabled control.
Another way to store color information in a
CString
:CString strBackground = "Blue";
(pardon!) :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Michael Schubert wrote:
One way to store colour information in a CString is to use HTML tags and then dump the string into a HTML enabled control.
Another way to store color information in a
CString
:CString strBackground = "Blue";
(pardon!) :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Good point. Another method: CString strBackground = "Blue";
-
Good point. Another method: CString strBackground = "Blue";
CString strBackground = "
█";
:-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]