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. CStatic ModifyStyle

CStatic ModifyStyle

Scheduled Pinned Locked Moved C / C++ / MFC
designquestion
3 Posts 3 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.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    I don't know why can not modify style at runtime : at design time style of CStatic is Frame , and in OnInitDialog I try :

    m\_staticIcon.ModifyStyle(0,SS\_BITMAP | SS\_CENTERIMAGE);
    m\_staticIcon.SetBitmap(::LoadBitmap(AfxGetApp()->m\_hInstance, MAKEINTRESOURCE(IDB\_BITMAP1)));
    

    but didn't working at all ( I seen nothing on dialog ) ... what I should to do modify style in SS_BITMAP ? Thank you.

    T C 2 Replies Last reply
    0
    • _ _Flaviu

      I don't know why can not modify style at runtime : at design time style of CStatic is Frame , and in OnInitDialog I try :

      m\_staticIcon.ModifyStyle(0,SS\_BITMAP | SS\_CENTERIMAGE);
      m\_staticIcon.SetBitmap(::LoadBitmap(AfxGetApp()->m\_hInstance, MAKEINTRESOURCE(IDB\_BITMAP1)));
      

      but didn't working at all ( I seen nothing on dialog ) ... what I should to do modify style in SS_BITMAP ? Thank you.

      T Offline
      T Offline
      The_Inventor
      wrote on last edited by
      #2

      My bet is that as the CBitmap is a local object it goes out of scope at the end of the function and its destructor cleans up its memory usage and deletes the bitmap you loaded. Try making it a member variable instead. The above is an answer from another question, however I think it applies. Member varibles in the class, tend to be less volitile. If the varible is in your "CMyDoument" class, it is more prone to persistance.

      The World as we think we know it Has a lot more to it than meets the eye. A Mad Scientist who has seen it for himself....

      1 Reply Last reply
      0
      • _ _Flaviu

        I don't know why can not modify style at runtime : at design time style of CStatic is Frame , and in OnInitDialog I try :

        m\_staticIcon.ModifyStyle(0,SS\_BITMAP | SS\_CENTERIMAGE);
        m\_staticIcon.SetBitmap(::LoadBitmap(AfxGetApp()->m\_hInstance, MAKEINTRESOURCE(IDB\_BITMAP1)));
        

        but didn't working at all ( I seen nothing on dialog ) ... what I should to do modify style in SS_BITMAP ? Thank you.

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        Try also removing the old style (first parameter of ModifyStyle), however, not every style can be changed at runtime, i don't know which can and can't, you should google it up.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > //TODO: Implement signature here<

        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