zoukankan      html  css  js  c++  java
  • CTabCtrl控件标签的相关设置


    原文链接: http://blog.csdn.net/happyhell/article/details/6012177

    1、 获得CTabCtrl标签高度:
    CRect rc;
    CTabCtrl *pTabCtrl = GetTabControl();
    pTabCtrl->GetItemRect(&rc);
    int nHeight = rc.Height();

    2、修改CTabCtrl标签上的文字:

    // In this example a CTabCtrl data member, m_TabCtrl, changes the
    // text of the tabs in the tab control. A call to GetItem is used
    // to get the current text, and then the text is changed. A call
    // to SetItem is used to update the tab with the new text.

    void CTabDlg::OnChangeItem()
    {
      TCITEM tcItem;
      CString pszString;

      // Get text for the tab item.
      GetDlgItemText(IDC_ITEM_TEXT, pszString);

      // Get the current tab item text.
      TCHAR buffer[256] = {0};
      tcItem.pszText = buffer;
      tcItem.cchTextMax = 256;
      tcItem.mask = TCIF_TEXT;
      m_TabCtrl.GetItem(0, &tcItem);
      TRACE(_T("Changing item text from %s to %s..."), tcItem.pszText, pszString);

      // Set the new text for the item.
      tcItem.pszText = pszString.LockBuffer();

      // Set the item in the tab control.
      m_TabCtrl.SetItem(0, &tcItem);

      pszString.UnlockBuffer();
    }

    3、设置标签尺寸:
    pTabCtrl->SetItemSize(CSize(100,100)); // 第一个参数为长度,第二个参数为高度

    4、设置标签字体:
    m_Font.CreateFont(14,0,0,0,300,0,0,0,1,0,0,0,0,_T("Arial"));
    pTabCtrl->SetFont(&m_Font);

     

     

     

     

     

     

  • 相关阅读:
    linux 下安装 mysql (centos7)版本
    linux 安装php7 -系统centos7
    Beta阶段事后分析
    Beta阶段展示博客
    Beta阶段测试报告
    Beta阶段发布说明
    第二十次ScrumMeeting博客
    第十九次ScrumMeeting博客
    第十八次ScrumMeeting博客
    第十七次ScrumMeeting博客
  • 原文地址:https://www.cnblogs.com/huhu0013/p/4576743.html
Copyright © 2011-2022 走看看