15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Owner draw CListCtrl

Brian Welsh -- brianw@i1.net
Thursday, February 06, 1997

Environment: VC++ 4.2-flat; Win NT 3.51/4.0

Hello Again;

Forgive me if this has been addressed before but, I have a CFrameWnd
derived class that has a CListCtrl member with the LVS_OWNERDRAWFIXED bit
set.  The problem is that my CFrameWnd does not receive the WM_DRAWITEM
message.  In ClassWizard doesn't even have WM_DRAWITEM as an available
message.  Can anyone tell me why this is and/or how to fix it?

Thanks
Brian
-----------------
email: brianw@i1.net
http://www.i1.net/~brianw




Karunakaran KR -- cs1@sriven.scs.co.in
Friday, February 07, 1997


Environment: VC4.2b NT 4.0 Win 95

Hi,
I have a small problem regarding CListCtrl.My CListCtrl is a owner Drawn
List Control and I have to 
create a Spin Control in the column on Doubleclicking a particular row in
the List Control.I am able to create the spin control but the problem is
when I am trying to resize the columns(HEADER) I do not want my spin control
to appear on the screen, but actually the spin control is getting
Repainted.I want to know the event when the mouse position is on the
splitter(while resizing the columns(HEADER) of the List Control).
Could anyone help me out in solving this problem 

Thanks 
Karunakaran




ГЦ °ж ·Д -- listen@klnet.co.kr
Monday, February 10, 1997

brianw wrote:
> 
> Environment: VC++ 4.2-flat; Win NT 3.51/4.0
> 
> Hello Again;
> 
> Forgive me if this has been addressed before but, I have a CFrameWnd
> derived class that has a CListCtrl member with the LVS_OWNERDRAWFIXED bit
> set.  The problem is that my CFrameWnd does not receive the WM_DRAWITEM
> message.  In ClassWizard doesn't even have WM_DRAWITEM as an available
> message.  Can anyone tell me why this is and/or how to fix it?
> 
> Thanks
> Brian
> -----------------
> email: brianw@i1.net
> http://www.i1.net/~brianw

Hi Brian!

WM_DRAWITEM message first sended to View, so you must check your 
View First. 
View::OnDrawItem(...)
!!!(This message handler processes all owner-draw members.
    --- like BitmapButton)
But if the View hasn't this message handler,
then message forwarded to List Control.

So if you want to your list control process this message,
then you make new class that inherits CListCtrl and 
override DrawItem(...) function

As you can see, View boradcast WM_DRAWITEM message to its child 
controls when it has no message handler for this message.

When you want your View processes WM_DRAWITEM message,
your View has OnDrawItem(...) message handler and 
processes all owner-draw children.

When you want your controls process WM_DRAWITEM message
all your owner-draw controls override DrawItem(...) member function.
But to do like this you must create class derived from that controls.



Kenneth A. Argo -- argo@rias.COM
Monday, February 10, 1997

[Mini-digest: 2 responses]

The owner draw messages do not go to the frame, they go to your =
CListCtrl derived class.  You need to create a new class derived from =
CListCtrl, then add the draw function(s) overload there.  They will =
appear in the list then.

Ken



----------
From:  brianw[SMTP:brianw@i1.net]
Sent:  Thursday, February 06, 1997 3:34 PM
To:  mfc-l@netcom.com
Subject:  Owner draw CListCtrl

Environment: VC++ 4.2-flat; Win NT 3.51/4.0

Hello Again;

Forgive me if this has been addressed before but, I have a CFrameWnd
derived class that has a CListCtrl member with the LVS_OWNERDRAWFIXED =
bit
set.  The problem is that my CFrameWnd does not receive the WM_DRAWITEM
message.  In ClassWizard doesn't even have WM_DRAWITEM as an available
message.  Can anyone tell me why this is and/or how to fix it?

Thanks
Brian
-----------------
email: brianw@i1.net
http://www.i1.net/~brianw


-----From: Tim Philip 

brianw writes:
> 
> Environment: VC++ 4.2-flat; Win NT 3.51/4.0
> 
> Forgive me if this has been addressed before but, I have a CFrameWnd
> derived class that has a CListCtrl member with the LVS_OWNERDRAWFIXED bit
> set.  The problem is that my CFrameWnd does not receive the WM_DRAWITEM
> message.  In ClassWizard doesn't even have WM_DRAWITEM as an available
> message.  Can anyone tell me why this is and/or how to fix it?
> 

The CListCtrl doesn't work quite like the CListBox control.  For owner
draw support you have to subclass the CListCtrl control and override the
DrawItem() function.

-------
Tim Philip, B.Sc. (Hon)                   philip@cs.usask.ca
Consultant, Graduate Student              http://www.cs.usask.ca/grads/philip

"... magic has a habit of lying low, like a rake in the grass." - T. Pratchet



Doncho Angelov -- alian@plovdiv.techno-link.com
Wednesday, February 12, 1997

[Mini-digest: 2 responses]

Hello Brian,

I would try to create my own class to handle this (this was the first =
thing which came in my mind as a solution). The other option is you =
manually to add the handler (I think in VC documentation was mentioned =
how you can do this). If you choose to use the second solution and you =
cannot find a way, let me know (use my personal email, not MFC-L) and I =
think I could help you (I never done this, I cannot give 100% guarantee =
that I'll succeed) !

Doncho

-----From: Ajay K Sanghi 


Hi, 
  U have two different options :
  1.  Use a CListCtrl derrived class instead of CListCtrl and
	override the function DrawItem().
  2.  In the parent window which is Frame window in your case, 
      capture NM_DRAWITEM message and do your painting here.

Bye, 
Ashok

> ----------
> From:  brianw[SMTP:brianw@i1.net]
> Sent:  Thursday, February 06, 1997 3:34 PM
> To:  mfc-l@netcom.com
> Subject:  Owner draw CListCtrl
> 
> Environment: VC++ 4.2-flat; Win NT 3.51/4.0
> 
> Hello Again;
> 
> Forgive me if this has been addressed before but, I have a CFrameWnd
> derived class that has a CListCtrl member with the LVS_OWNERDRAWFIXED bit
> set.  The problem is that my CFrameWnd does not receive the WM_DRAWITEM
> message.  In ClassWizard doesn't even have WM_DRAWITEM as an available
> message.  Can anyone tell me why this is and/or how to fix it?
> 
> Thanks
> Brian
> -----------------
> email: brianw@i1.net
> http://www.i1.net/~brianw
> 
> 
> -----From: Tim Philip 
> 
> brianw writes:
> >
> > Environment: VC++ 4.2-flat; Win NT 3.51/4.0
> >
> > Forgive me if this has been addressed before but, I have a CFrameWnd
> > derived class that has a CListCtrl member with the LVS_OWNERDRAWFIXED bit
> > set.  The problem is that my CFrameWnd does not receive the WM_DRAWITEM
> > message.  In ClassWizard doesn't even have WM_DRAWITEM as an available
> > message.  Can anyone tell me why this is and/or how to fix it?
> >
> 
> The CListCtrl doesn't work quite like the CListBox control.  For owner
> draw support you have to subclass the CListCtrl control and override the
> DrawItem() function.
> 
> -------
> Tim Philip, B.Sc. (Hon)                   philip@cs.usask.ca
> Consultant, Graduate Student              http://www.cs.usask.ca/grads/philip
> 
> "... magic has a habit of lying low, like a rake in the grass." - T. Pratchet
> 




Become an MFC-L member | Вернуться в корень Архива |