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

     

     

     

     

     

     

  • 相关阅读:
    TSQL 错误状态
    CSS光标聚焦改指针为手
    PD使用指导
    Ext 为label添加单击事件
    (转) SQL Server中解决死锁的新方法介绍
    DateTime 的使用技巧
    (转) C# 接口
    常见频率f与周期T之间的关系
    上拉电阻与下拉电阻的作用和区别
    powershell命令返回值
  • 原文地址:https://www.cnblogs.com/huhu0013/p/4576743.html
Copyright © 2011-2022 走看看