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
    156

    Owner drawn, what is it?



    Hi,


    On this discussion board, I often read about owner-drawn listbox and various controls etc. I believe this is to do with getting more control on the property of these controls/dialog. Am I on the right track?


    Can someone please describe what this owner drawn thing is about. And more importantly, how to go about doing it ? I have tried to look up in books (like Inside Visual C++) but no help. What are the procedures to make owner-drawn button, for example.


    Any help to this green 'MFCer' is appreciated.


    Will

  2. #2
    Join Date
    Apr 1999
    Location
    Germany
    Posts
    418

    Re: Owner drawn, what is it?



    Hi Will,


    you're on the right track. An owner-drawn control is drawn by the owner of the control. Imagine a normal dialog box with several control in it. Normally every control does the painting for itself. By specifying the owner-draw style the controls sends several messages to his owner, the dialog, to get information about what the item(s) to be drawn and to draw the item or the entire control. Let's assume you have a listbox where you let the user choose a country. A small frag in front of the country names will be fine. Okay, this is a typical task for an owner-drawn listbox with items with fixed height. After creation the control will send the message WM_MEASUREITEM to his owner to get information about the dimension of each item. The control will send this message for each item if you specify a listbox with variable height items. Some time later the control get the WM_PAINT message as every window does (a control is nothing else than a special window). It will ask the system for a device context, and sending this dc along with other information in form of a WM_DRAWITEM.


    That's all in short.


    HTH


    Martin

  3. #3
    Join Date
    May 1999
    Posts
    156

    Re: Owner drawn, what is it? Part II



    Thanks Martin for your clear description. You probably have guessed this comming; can you owner-draw the whole of the dialogs or the application. For example, how do you do something like what Winamp does, I mean with non MFC standard View like interface?


    Will




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