zoukankan      html  css  js  c++  java
  • 如何在工具栏中,加上图标和文字?

    a).如何在工具栏中,加上图标和文字?(How To Add Icon And Text)

    /********************************************************************/
    /* */
    /* Function name : CreateHotToolBar */
    /* Description : Create the main toolbar. */
    /* */
    /********************************************************************/
    BOOL CMainFrame::CreateHotToolBar()
    {
    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC/*| CBRS_GRIPPER*/) ||
    !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
    {
    TRACE0("Failed to create toolbar\n");
    return FALSE; // fail to create
    }

    // Set the text for each button
    CToolBarCtrl& bar = m_wndToolBar.GetToolBarCtrl();

    int nIndex = 0;
    TBBUTTON tb;

    for (nIndex = m_wndToolBar.GetToolBarCtrl().GetButtonCount() - 1; nIndex >= 0; nIndex--)
    {
    ZeroMemory(&tb, sizeof(TBBUTTON));
    m_wndToolBar.GetToolBarCtrl().GetButton(nIndex, &tb);

    // Do we have a separator?
    if ((tb.fsStyle & TBSTYLE_SEP) == TBSTYLE_SEP)
    continue;

    // Have we got a valid command id?
    if (tb.idCommand == 0)
    continue;

    // Get the resource string if there is one.
    CString strText;
    LPCTSTR lpszButtonText = NULL;
    CString strButtonText(_T(""));
    _TCHAR seps[] = _T("\n");

    strText.LoadString(tb.idCommand);

    if (!strText.IsEmpty())
    {
    lpszButtonText = _tcstok((LPTSTR)(LPCTSTR)strText, seps);

    while(lpszButtonText)
    {
    strButtonText = lpszButtonText;
    lpszButtonText = _tcstok(NULL, seps);
    }
    }

    if (!strButtonText.IsEmpty())
    m_wndToolBar.SetButtonText(nIndex, strButtonText);
    }


  • 相关阅读:
    photoshop快捷键汇总
    div和css:行内元素和块元素的水平和垂直居中
    使块元素并排显示和清除浮动的方法
    javascript与DOM节点的结合使用
    导航+轮播图(手动)
    执行计划
    oracle存储过程
    oracle 常用语法
    Sqlserver数据库总结
    sqlserver sum 和count在关于进行统计时的区别
  • 原文地址:https://www.cnblogs.com/confach/p/112082.html
Copyright © 2011-2022 走看看