Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. disable CString value

disable CString value

Scheduled Pinned Locked Moved C / C++ / MFC
question
10 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rakesh5
    wrote on last edited by
    #1

    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.

    K C _ N R 6 Replies Last reply
    0
    • R Rakesh5

      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.

      K Offline
      K Offline
      KingsGambit
      wrote on last edited by
      #2

      CString class holds just a string (array of characters). It doesn't have any color information associated with it.

      1 Reply Last reply
      0
      • R Rakesh5

        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.

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        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++

        1 Reply Last reply
        0
        • R Rakesh5

          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.

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          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++)

          1 Reply Last reply
          0
          • R Rakesh5

            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.

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • R Rakesh5

              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.

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • R Rakesh5

                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.

                M Offline
                M Offline
                Michael Schubert
                wrote on last edited by
                #7

                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.

                C 1 Reply Last reply
                0
                • M Michael Schubert

                  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.

                  C Offline
                  C Offline
                  CPallini
                  wrote on last edited by
                  #8

                  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]

                  M 1 Reply Last reply
                  0
                  • C CPallini

                    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]

                    M Offline
                    M Offline
                    Michael Schubert
                    wrote on last edited by
                    #9

                    Good point. Another method: CString strBackground = "Blue";

                    C 1 Reply Last reply
                    0
                    • M Michael Schubert

                      Good point. Another method: CString strBackground = "Blue";

                      C Offline
                      C Offline
                      CPallini
                      wrote on last edited by
                      #10

                      CString strBackground = "█"; :-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]

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups