Font in CIpAddressCtrl

Font in CIpAddressCtrl

Post by UGV0ZX » Thu, 12 Oct 2006 17:18:02

I have CListBox deriver class of owner-draw type. Items are CIpAddressCtrl
Displaying list of IP addresses is functional, only font is problem.
I am trying to set font before CIPAddressCtrl calls ShowWindow(SW_SHOW)
inside of DrawItem() of my CIpListBox. Font is set OK and displayed OK only
on first displaying, but when I delete some of items, on next redrawing font
in all other items changes, there is changed weight and height of font inside
of all CIPAddressCtrl in all items.
Every CIpAddressCtrl are created only once - when list is first time
When some item is deleted, other items are offset to one position to the
top. I do it by MoveWindow() inside of DrawItem(). Before MoveWindow() I call
again ipAddrCtrl->SetFont(), with good CFont object, but it does not set font
inside of CIPAddressCtrl :-( So I created EnumChildWindowsProc and I call
EnumChildWindow() for my ip address control and inside I use:

hfont = ::CreateFontIndirect(logFont);
::SendMessage(hwnd, WM_SETFONT, (WPARAM)hfont, TRUE);

to set correct font in every of four edit boxes inside if IP address, but it
does not help. :-((

How to set font inside of CIPAddressCtrl ?