CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    3

    How to change combobox to ownerdraw at runtime?

    I'd like to change a combobox control to owner-draw at runtime. In the resource script the control is layed out as a standard control.

    I've experimented with setting the style bits to CBS_OWNERDRAW | CBS_HASSTRINGS but somehow this does not help.

    Does anybody know the trick?


  2. #2
    Join Date
    Apr 1999
    Posts
    306

    Re: How to change combobox to ownerdraw at runtime?

    Try SetWindowLong() function


  3. #3
    Join Date
    May 1999
    Posts
    3

    Re: How to change combobox to ownerdraw at runtime?

    I used SetWindowLong to or in the CBS_OWNERDRAW | CBS_HASSTRINGS styles.

    Thats the code I use:

    // turn to ownerdraw
    DWORD dwStyle = ::GetWindowLong(hCtrl, GWL_STYLE);
    dwStyle |= CBS_OWNERDRAWFIXED | CBS_HASSTRINGS;
    VERIFY(0 != ::SetWindowLong(hCtrl, GWL_STYLE, dwStyle));

    This code is processed in the WM_INITDIALOG message handler.

    Unfortunately it doesn't work.

    Anybody already done that?



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