• 大小: 64.52 KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-08-20
  • 语言: 其他
  • 标签: TabCtrl  控件  

资源简介

自定义的基于CWnd类实现的TabCtrl控件,可以添加、删除、修改标签页

资源截图

代码片段和文件信息

/**********************************************************************
**
** CustomTabCtrl.cpp : implementation file of CCustomTabCtrl class
**
** by Andrzej Markowski June 2004
**
**********************************************************************/

#include “stdafx.h“
#include “CustomTabCtrl.h“
#include “resource.h“

// CCustomTabCtrlItem

CCustomTabCtrlItem::CCustomTabCtrlItem(CString sTextLPARAM lParam) : 
m_sText(sText) 
m_lParam(lParam)
m_bShape(TAB_SHAPE1)
m_fSelected(FALSE)
m_fHighlighted(FALSE)
m_fHighlightChanged(FALSE)
{
}

void CCustomTabCtrlItem::operator=(const CCustomTabCtrlItem &other)
{
m_sText = other.m_sText;
m_lParam = other.m_lParam;
}

void CCustomTabCtrlItem::ComputeRgn()
{
m_rgn.Deleteobject();

CPoint pts[6];
GetRegionPoints(m_rectpts);
m_rgn.CreatePolygonRgn(pts 6 WINDING);
}

void CCustomTabCtrlItem::GetRegionPoints(const CRect& rc CPoint* pts) const
{
switch(m_bShape)
{
case TAB_SHAPE2:
{
pts[0] = rc.TopLeft();
pts[1] = CPoint(rc.left rc.bottom);
pts[2] = CPoint(rc.left + rc.Height()/2 rc.top);
pts[3] = CPoint(rc.left + rc.Height()/2 rc.top);
pts[4] = CPoint(rc.left + rc.Height()/2 rc.top);
pts[5] = CPoint(rc.left + rc.Height()/2 rc.top);
}
break;
case TAB_SHAPE3:
{
pts[0] = rc.TopLeft();
pts[1] = CPoint(rc.left + rc.Height()/4 rc.Height()/2);
pts[2] = CPoint(rc.left rc.bottom);
pts[3] = CPoint(rc.left rc.bottom);
pts[4] = CPoint(rc.left rc.bottom);
pts[5] = CPoint(rc.left rc.bottom);
}
break;
case TAB_SHAPE4:
{
pts[0] = rc.TopLeft();
pts[1] = CPoint(rc.left + rc.Height()/4 rc.Height()/2);
pts[2] = CPoint(rc.left + rc.Height()/2 rc.bottom);
pts[3] = CPoint(rc.right - rc.Height()/2 rc.bottom);
pts[4] = CPoint(rc.right - rc.Height()/4 rc.Height()/2);
pts[5] = CPoint(rc.right rc.top);
}
break;
case TAB_SHAPE5:
{
pts[0] = rc.TopLeft();
pts[1] = CPoint(rc.left + rc.Height()/4 rc.Height()/2);
pts[2] = CPoint(rc.left + rc.Height()/2  rc.bottom);
pts[3] = CPoint(rc.right - rc.Height()/2 rc.bottom);
pts[4] = CPoint(rc.right - rc.Height()/4 rc.Height()/2);
pts[5] = CPoint(rc.right - rc.Height()/2 rc.top);
}
break;
default:
{
pts[0] = CPoint(00);
pts[1] = CPoint(00);
pts[2] = CPoint(00);
pts[3] = CPoint(00);
pts[4] = CPoint(00);
pts[5] = CPoint(00);
}
break;
}
}

void CCustomTabCtrlItem::GetDrawPoints(const CRect& rc CPoint* pts) const
{
switch(m_bShape)
{
case TAB_SHAPE2:
case TAB_SHAPE3:
{
pts[0] = CPoint(rc.left rc.bottom);
pts[1] = CPoint(rc.left + rc.Height()/2 rc.top);
}
break;
case TAB_SHAPE4:
case TAB_SHAPE5:
{
pts[0] = rc.TopLeft();
pts[1] = CPoint(rc.left + rc.Height()/2 rc.bottom);
pts[2] = CPoint(rc.right - rc.Height()/2 rc.bottom);
pts[3] = CPoint(rc.right rc.top);
}
break;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      68241  2004-07-24 08:51  CustomTabCtrlDemo\CustomTabCtrl.cpp

     文件       7611  2004-07-24 15:48  CustomTabCtrlDemo\CustomTabCtrl.h

     文件       2145  2004-07-17 20:10  CustomTabCtrlDemo\CustomTabCtrlDemo.cpp

     文件       4884  2004-07-14 22:57  CustomTabCtrlDemo\CustomTabCtrlDemo.dsp

     文件        559  2004-05-04 06:57  CustomTabCtrlDemo\CustomTabCtrlDemo.dsw

     文件       1445  2004-05-04 06:57  CustomTabCtrlDemo\CustomTabCtrlDemo.h

     文件      18779  2004-07-25 19:51  CustomTabCtrlDemo\CustomTabCtrlDemoDlg.cpp

     文件       2685  2004-07-20 16:51  CustomTabCtrlDemo\CustomTabCtrlDemoDlg.h

     文件       1078  2004-05-04 06:57  CustomTabCtrlDemo\res\CustomTabCtrlDemo.ico

     文件        409  2004-05-04 06:57  CustomTabCtrlDemo\res\CustomTabCtrlDemo.rc2

     文件        326  2004-07-13 20:02  CustomTabCtrlDemo\res\DRAGCOPY.CUR

     文件        326  2004-07-13 20:02  CustomTabCtrlDemo\res\DRAGMOVE.CUR

    ..AD...         0  2004-07-15 07:39  CustomTabCtrlDemo\res

     文件       1337  2004-07-18 18:01  CustomTabCtrlDemo\resource.h

     文件       4140  2002-06-04 16:13  CustomTabCtrlDemo\Schemadef.h

     文件        219  2004-05-04 06:57  CustomTabCtrlDemo\StdAfx.cpp

     文件        999  2004-05-04 06:57  CustomTabCtrlDemo\StdAfx.h

     文件       6397  2004-07-04 20:33  CustomTabCtrlDemo\ThemeUtil.cpp

     文件       1563  2004-07-17 20:12  CustomTabCtrlDemo\ThemeUtil.h

     文件      45694  2002-06-04 16:13  CustomTabCtrlDemo\Tmschema.h

     文件      60416  2005-10-31 17:32  CustomTabCtrlDemo\CustomTabCtrlDemo.ncb

     文件       7463  2005-10-31 17:11  CustomTabCtrlDemo\CustomTabCtrlDemo.vcproj

     文件        923  2005-10-31 16:13  CustomTabCtrlDemo\CustomTabCtrlDemo.sln

    ..A..H.     17408  2005-10-31 17:32  CustomTabCtrlDemo\CustomTabCtrlDemo.suo

     目录          0  2005-10-31 16:13  CustomTabCtrlDemo\Debug

     文件      39904  2005-10-31 16:44  CustomTabCtrlDemo\CustomTabCtrlDemo.aps

     文件       6840  2005-10-31 16:44  CustomTabCtrlDemo\CustomTabCtrlDemo.rc

     目录          0  2005-10-31 16:13  CustomTabCtrlDemo

----------- ---------  ---------- -----  ----

               302009                    29

............此处省略2个文件信息

评论

共有 条评论