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. How to change a alignment of CStatic Label at run time?

How to change a alignment of CStatic Label at run time?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 2 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.
  • L Offline
    L Offline
    Le rner
    wrote on last edited by
    #1

    HI all, can anybody please suggest me can i change the alignment of text in CStatic label. i want to change the alignment of text at runtime. please help me for this. thanks in advance.

    L 1 Reply Last reply
    0
    • L Le rner

      HI all, can anybody please suggest me can i change the alignment of text in CStatic label. i want to change the alignment of text at runtime. please help me for this. thanks in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      A CStatic Class[^] object is just a specialised type of CWnd. So you can change it by using any of the CWnd methods such as CWnd::ModifyStyle[^].

      L 1 Reply Last reply
      0
      • L Lost User

        A CStatic Class[^] object is just a specialised type of CWnd. So you can change it by using any of the CWnd methods such as CWnd::ModifyStyle[^].

        L Offline
        L Offline
        Le rner
        wrote on last edited by
        #3

        sir have already use this. but its not working properly\ m_st_label.ModifyStyle(0,SS_CENTER);

        L 1 Reply Last reply
        0
        • L Le rner

          sir have already use this. but its not working properly\ m_st_label.ModifyStyle(0,SS_CENTER);

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Le@rner wrote:

          not working properly

          What does that mean? Are you sure there are no style settings to be removed?

          L 1 Reply Last reply
          0
          • L Lost User

            Le@rner wrote:

            not working properly

            What does that mean? Are you sure there are no style settings to be removed?

            L Offline
            L Offline
            Le rner
            wrote on last edited by
            #5

            it means when i change alignment from left to center its shown but again when i change in any other alignment nothing is shown here.

            L 1 Reply Last reply
            0
            • L Le rner

              it means when i change alignment from left to center its shown but again when i change in any other alignment nothing is shown here.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              You should use your debugger to check what options are set each time you make a change, and remember to remove the ones not needed. You also need to refresh the Window after making any changes.

              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