Home > Software engineering >  How to use SetWindowLong to remove the border around the ComboBox
How to use SetWindowLong to remove the border around the ComboBox

Time:09-19

As title, consult everybody, the lives of the border around the ComboBox to go out

CodePudding user response:

Try from the ComboBox derived a new class handling WM_NCPAINT your WM_PAINT message

CodePudding user response:

reference 1st floor zgl7903 response:
try from the ComboBox derived new class handling WM_NCPAINT your WM_PAINT message

Cannot be handled directly through the SetWindowLong?

CodePudding user response:

The certain properties of some controls are not support dynamic modification,

CodePudding user response:

The
reference 3 floor 7-eleven's response:
the certain properties of some controls are not support dynamic modification,

I use SetWindowLong found that can be changed into thick, but should go out of the original borders, whether to get inside the Edit control

CodePudding user response:

ComboBox has two child controls "list" and edit,

CodePudding user response:

reference 5 floor schlafenhamster reply:
ComboBox has two child controls "list" and edit,

Whether to remove the borders, as long as get the edit control can be, how to get the edit control handle?

CodePudding user response:

Vc6 can
//CSuperComboBox message handlers
HBRUSH CSuperComboBox: : OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor)
{
//TODO: Change any attributes of the DC here
If (nCtlColor==CTLCOLOR_LISTBOX)
{//ListBox control, It is a COMBOLBOX, not a normal ListBox. Fit,
//It is not a child window of combobox.
If (m_listbox GetSafeHwnd ()==NULL)
{
M_listbox. SubclassWindow (pWnd - & gt; GetSafeHwnd ());
//too later to change the sytle!
//no vscroll!!!!!!
M_listbox. ModifyStyle (0, WS_HSCROLL | LBS_MULTICOLUMN);
//you have to create a new list box?
//see "Dynamically re - creating a list box" code project.
RecreateComboLBox (& amp; M_listbox);//no messages?
}
}
If (nCtlColor==CTLCOLOR_EDIT)
{
M_hEdit=pWnd - & gt; GetSafeHwnd ();
}
//
HBRUSH gets=CComboBox: : OnCtlColor (pDC, pWnd, nCtlColor);
Return gets;
}

VS a function can be directly take

CodePudding user response:

refer to 7th floor schlafenhamster response:
vc6 can
//CSuperComboBox message handlers
HBRUSH CSuperComboBox: : OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor)
{
//TODO: Change any attributes of the DC here
If (nCtlColor==CTLCOLOR_LISTBOX)
{//ListBox control, It is a COMBOLBOX, not a normal ListBox. Fit,
//It is not a child window of combobox.
If (m_listbox GetSafeHwnd ()==NULL)
{
M_listbox. SubclassWindow (pWnd - & gt; GetSafeHwnd ());
//too later to change the sytle!
//no vscroll!!!!!!
M_listbox. ModifyStyle (0, WS_HSCROLL | LBS_MULTICOLUMN);
//you have to create a new list box?
//see "Dynamically re - creating a list box" code project.
RecreateComboLBox (& amp; M_listbox);//no messages?
}
}
If (nCtlColor==CTLCOLOR_EDIT)
{
M_hEdit=pWnd - & gt; GetSafeHwnd ();
}
//
HBRUSH gets=CComboBox: : OnCtlColor (pDC, pWnd, nCtlColor);
Return gets;
}

VS a function can be directly take

Oh, I try, thank the boss
  • Related