• λ我爱Aspx >> Asp.Net >> VC++的菜单控制和自绘菜单。
  • VC++的菜单控制和自绘菜单。

  • :未知  Դ:internet  :2007-5-5 19:47:16  ؼ:
  • m_crText = m_clrText;

    m_bLBtnDown = FALSE;

    m_iconX = GetSystemMetrics ( SM_CXMENUCHECK);

    m_iconY = GetSystemMetrics (SM_CYMENUCHECK );

    m_clrHilight = GetSysColor (COLOR_HIGHLIGHT);

    m_brSelect.CreateSolidBrush (m_clrHilight);

    m_clrHilightText = GetSysColor (COLOR_HIGHLIGHTTEXT);

    ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));

    NONCLIENTMETRICS nm;

    nm.cbSize = sizeof (NONCLIENTMETRICS);

    //Get the system metrics for the Captionfromhere

    VERIFY (SystemParametersInfo (SPI_GETNONCLIENTMETRICS,0,&nm,0));

    m_lf = nm.lfMenuFont;

    m_iMenuHeight = nm.iMenuHeight;

    m_fontMenu.CreateFontIndirect (&m_lf);

    }

    CCustomMenu::~CCustomMenu()

    {

    if ((HBRUSH) m_brBackground != NULL)

    m_brBackground.DeleteObject ();

    if ((HFONT)m_fontMenu !=NULL)

    m_fontMenu.DeleteObject ();

    if ((HBRUSH)m_brSelect != NULL)

    m_brSelect.DeleteObject ();

    }

    ////////////////////////////////////////////////

    //

    // CCustomMenu message handlers

    void CCustomMenu::DrawItem (LPDRAWITEMSTRUCT lpDIS)

    {

    ASSERT(lpDIS != NULL);

    CDC* pDC = CDC::FromHandle(lpDIS->hDC);

    CRect rect;

    HICON hIcon;

    COLORREF crText = m_crText;

    // draw the colored rectangle portion

    rect.CopyRect(&lpDIS->rcItem);

    // draw the up/down/focused/disabled state

    UINT action = lpDIS->itemAction;

    Ҷƪл˵?
  • һƪ华为亲历(转载)
    һƪ源代码推荐:vb的GUID生成算法