Re: Where do I change a CListBox style.
There are some styles you can't change at runtime. There are a couple of
ways I can think of to address this problem:
1. Create the listbox dynamically in code rather than having it on the
dialog
2. Have two listboxes on top of each other in the dialog and just use
ShowWindow() to show the one you want to have active.
Tom
"TonyG" <TonyG@junk.com> wrote in message
news:iCadi.4370$c06.1165@newssvr22.news.prodigy.net...
I have a dialog that contains a CListBox. Sometimes I want the list box to
be a variable owner draw while at other times I want it to be regular (not
owner draw). I put code in the dialog's OnInitDialog:
if (true == m_IsWantOwnerDraw)
{
m_cScroll.ModifyStyle(0, LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, 0);
}
else
{
m_cScroll.ModifyStyle(LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, 0, 0);
}
It doesn't work. The list box stays whatever sytle is set in the resource
editor.
Is this the correct code? Should I put the code someplace else?