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);
    }


  • 相关阅读:
    解析中间人攻击(4/4)---SSL欺骗
    解析中间人攻击(3/4)---会话劫持
    解析中间人攻击(2/4)---DNS欺骗
    解析中间人攻击(1/4)---ARP缓存中毒
    (转)常见的HTTPS攻击方法
    转载 OpenUrl
    如何安全的存储密码
    本地存储密码的安全设计
    硬件断点和软件断点的区别
    网站防止CC攻击的方法
  • 原文地址:https://www.cnblogs.com/confach/p/112082.html
Copyright © 2011-2022 走看看