CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2006
    Location
    Marseille, France
    Posts
    94

    [RESOLVED] Set "Owner Draw" property in the constructor

    Hi,

    I'm looking how to set the "Owner Draw" property in the construtor

    Thanks helping me.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Set "Owner Draw" property in the constructor

    What "construtor"? What class? What control? ...?

  3. #3
    Join Date
    Jan 2006
    Location
    Marseille, France
    Posts
    94

    Re: Set "Owner Draw" property in the constructor

    It's a customed class based on CBitmapButton.

    It needs that all components herited from its to have "Owner Draw" property to true

    So i want to do this in it's constructor

  4. #4
    Join Date
    Jul 2005
    Location
    Germany
    Posts
    1,194

    Re: Set "Owner Draw" property in the constructor

    I guess CBitmapButton uses the "BUTTON" window class. In that case you would have to set the window style BS_OWNERDRAW. SetWindowLong() is the function you can use for this task. Of course you will also need to use GetWindowLong() because you add the window style.
    Please don't forget to rate users who helped you!

  5. #5
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Set "Owner Draw" property in the constructor

    I don't think you can set the style in the constructor because the window is not actually a 'window' at that point in time. A better place would be in PreSubclassWindow() using CWnd::ModifyStyle().
    Gort...Klaatu, Barada Nikto!

  6. #6
    Join Date
    Jan 2006
    Location
    Marseille, France
    Posts
    94

    Re: Set "Owner Draw" property in the constructor

    Quote Originally Posted by Mike Harnad
    I don't think you can set the style in the constructor because the window is not actually a 'window' at that point in time. A better place would be in PreSubclassWindow() using CWnd::ModifyStyle().
    Ok, but wich style adding ?

    I don't see Owner draw in style list

  7. #7
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Set "Owner Draw" property in the constructor

    CWnd::ModifyStyle() will allow you to specify control styles also. So, simply specify BS_OWNERDRAW.
    Gort...Klaatu, Barada Nikto!

  8. #8
    Join Date
    Jan 2006
    Location
    Marseille, France
    Posts
    94

    Re: Set "Owner Draw" property in the constructor

    Thanks, it's good !

    this->ModifyStyle(0, BS_OWNERDRAW);


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured