CComboBox control question 
Author Message
 CComboBox control question

I would like to remove the border around a CComboBox object.  However, I
also want to reduce the size of the CComboBox by the border size as well.  I
know of most controls you can just turn off the "Border", but on a ComboBox
you cannot.  I have a CComboBox object embedded in a CListCtrl object and I
want the combo box to fit within the CListCtrl row size.  However, the
combobox automatically changes it's own size once it is created, even though
I pass the CRect for the CListCtrl item row.  So, I was wondering if anyone
had any experience with this sort of thing.  Any help would be appreciated!

Thanks,

Brian



Sun, 11 Sep 2005 02:46:05 GMT  
 CComboBox control question
I just did something similar, however I increased the height of each
row to accomodate the combo box.  You can do this in the MeasureItem()
virtual override for the CListCtrl, provided you have specified the
LVS_OWNERDRAWFIXED window style when creating the control.

As for resizing the combobox... you can try removing the border styles
using the CWnd::ModifyStyle() function.  That may get rid of the border.
However it would probably be a fair amount of work to actually change
the size of the combo box because not only would you need to handle the
size of the CEdit control, you also need to handle the size of the
drop down CListCtrl as well.  That may mean deriving your own class from
CComboBox and subclassing both the CEdit and CListCtrl to handle their
sizes.

Murrgon

Quote:

> I would like to remove the border around a CComboBox object.  However, I
> also want to reduce the size of the CComboBox by the border size as well.  I
> know of most controls you can just turn off the "Border", but on a ComboBox
> you cannot.  I have a CComboBox object embedded in a CListCtrl object and I
> want the combo box to fit within the CListCtrl row size.  However, the
> combobox automatically changes it's own size once it is created, even though
> I pass the CRect for the CListCtrl item row.  So, I was wondering if anyone
> had any experience with this sort of thing.  Any help would be appreciated!



Sun, 11 Sep 2005 15:56:04 GMT  
 CComboBox control question
Murrgon,

I actually did what you just said.  I just resized the row in the CListCtrl.
However, I know removing the border on the combobox can be done.  I've seen
an app that does it without resizing the row.  I'd really like to know how
they did that.  I've asked around on several different boards and no one
really had any definitive way to do this.  :-(  Oh well.

Thanks anyway,

Brian

Quote:
> I just did something similar, however I increased the height of each
> row to accomodate the combo box.  You can do this in the MeasureItem()
> virtual override for the CListCtrl, provided you have specified the
> LVS_OWNERDRAWFIXED window style when creating the control.

> As for resizing the combobox... you can try removing the border styles
> using the CWnd::ModifyStyle() function.  That may get rid of the border.
> However it would probably be a fair amount of work to actually change
> the size of the combo box because not only would you need to handle the
> size of the CEdit control, you also need to handle the size of the
> drop down CListCtrl as well.  That may mean deriving your own class from
> CComboBox and subclassing both the CEdit and CListCtrl to handle their
> sizes.

> Murrgon


> > I would like to remove the border around a CComboBox object.  However, I
> > also want to reduce the size of the CComboBox by the border size as
well.  I
> > know of most controls you can just turn off the "Border", but on a
ComboBox
> > you cannot.  I have a CComboBox object embedded in a CListCtrl object
and I
> > want the combo box to fit within the CListCtrl row size.  However, the
> > combobox automatically changes it's own size once it is created, even
though
> > I pass the CRect for the CListCtrl item row.  So, I was wondering if
anyone
> > had any experience with this sort of thing.  Any help would be
appreciated!



Tue, 13 Sep 2005 04:15:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Question about using CComboBox Control??Thank you

2. Question about CComboBox Control

3. A couple CTreeCtrl questions and a CComboBox question

4. limit of CComboBox and handling of scrolling event in a CComboBox

5. CComboBox control variable

6. CComboBox 'Sort'ing Under Program Control?

7. CComboBox control

8. CEdit style in a CComboBox control

9. Setting the size of the drop down for a CComboBox control

10. OnChar() w/ CComboBox controls

11. Program Freezes when using CComboBox Control with Property Page

12. Subclassing edit-control of CComboBox

 

 
Powered by phpBB® Forum Software