[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[TSVN] AW: Fixing height of custom drawn combo box

From: Bodo Maass <bodo42_at_gmx.de>
Date: 2005-06-15 10:11:59 CEST

SteveKing wrote:

> > Another thing are the combo boxes in 'Look and Feel / Dialogs'. The
> > section 'Font for log messages:' is followed by two combos, one for
> > the font, and the other for the size. The first one is
> > larger than the second one.
> > I assume the first one is custom drawn, which causes the
> > box to be 2
> > or 3 pixels larger than normal (which I consider a Windows bug).
> > I have some code that fixes the height of custom drawn combo boxes
> > somewhere, so if you are interested I could dig it out.
>
> Would be great! I too noticed that when I first introduced
> changing the fonts, but couldn't figure out why this happens
> or how to prevent it.
> Just send a patch (or info on how to get rid of that
> increased size) to the mailing list.

 
Hi Steve,

I don't have the TSVN code checked out right now, so I can't code it
directly, but here is how it goes:

If your custom drawn combo box is a derived class, add the members:

class MyCustomDrawnCombo : public CComboBox
{
public:
[...]

  void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
  {
    lpMeasureItemStruct->itemHeight = m_itemHeight;
  }

  void fixHeight(CWnd* heightRefControl) //heightRefControl must point to a
non-customdrawn listbox or combobox
  {
    if (heightRefControl)
    {
      int lbItemHeight = heightRefControl->SendMessage(CB_GETITEMHEIGHT,
-1);
      int cbItemHeight = SendMessage(CB_GETITEMHEIGHT, -1);
      SendMessage(CB_SETITEMHEIGHT, -1, lbItemHeight);
      m_itemHeight = itemHeight;
    }
  }
private:
  int m_itemHeight;
}

Now, in your Dialog's OnInitDialog, call
m_myCustomCombo.fixHeight(&m_someNonCustomDrawnComboOrListBox).

Hope that helps,
 Bodo

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Wed Jun 15 11:33:25 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.