#ifndef __GRID_CELL_BUTTON__
#define __GRID_CELL_BUTTON__
#include "../GridCtrl_src/GridCell.h"
class CGridCellButton : public CGridCell
{
friend class CGridCtrl;
DECLARE_DYNCREATE(CGridCellButton)
public:
CGridCellButton(void);
~CGridCellButton(void);
public:
virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
protected:
virtual void OnClick(CPoint PointCellRelative);
protected:
CRect m_rect;
BOOL m_bPushing;
};
#endif

.cpp:

#include "stdafx.h"
#include "../GridCtrl_src/GridCell.h"
#include "../GridCtrl_src/GridCtrl.h"
#include "GridCellButton.h" #ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif IMPLEMENT_DYNCREATE(CGridCellButton, CGridCell)
CGridCellButton::CGridCellButton(void)
{
m_bPushing = FALSE;
}
CGridCellButton::~CGridCellButton(void)
{
}
BOOL CGridCellButton::Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd /* = TRUE */)
{
m_rect = rect;
pDC->SetBkMode(TRANSPARENT);
rect.DeflateRect(GetMargin(), );
CFont* pOldFont = pDC->SelectObject(GetFontObject());
pDC->DrawFrameControl(rect, DFC_BUTTON, m_bPushing ? DFCS_BUTTONPUSH | DFCS_PUSHED : DFCS_BUTTONPUSH);
COLORREF ColorCurrent = pDC->GetTextColor();
pDC->SetTextColor(::GetSysColor(COLOR_BTNTEXT));
pDC->DrawText(GetText(), -, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
pDC->SetTextColor(ColorCurrent);
return TRUE;
}
void CGridCellButton::OnClick(CPoint PointCellRelative)
{
m_bPushing = !m_bPushing;
GetGrid()->InvalidateRect(m_rect);
}

编译环境:vs2013  CGridCtrl版本:2.27

CGridCtrl 添加button (CGridCellButton类)的更多相关文章

  1. JQuery_给元素添加或删除类等以及CSS()方法

    一.addClass() - 向被选元素添加一个或多个类 <script src="jquery-1.11.1.min.js"></script> < ...

  2. 在excel worksheet中添加button 和对Excel workbook做权限控制相关的新知识

    添加button在worksheet中 1. Shapes Object (Excel) Reference:http://technet.microsoft.com/zh-cn/library/ff ...

  3. iOS 在tableView上添加button导致按钮没有点击效果和不能滑动的 zhuang

    转载请注明出处. 今天在调试代码的时候,在tableviewcell上添加button,发现button快速点击的话,是看不出点击效果的,查找资料发现, ios7上UITableViewCell子层容 ...

  4. 原生js添加和删除类

    原生js添加和删除类: this.className +=" "; this.className = this.className.replace(" 原来的类" ...

  5. class属性添加多个类

    <html> <head> <style type="text/css"> h1.intro { color:blue; text-align: ...

  6. Entity Framework 的小实例:在项目中添加一个实体类,并做插入操作

    Entity Framework 的小实例:在项目中添加一个实体类,并做插入操作 1>. 创建一个控制台程序2>. 添加一个 ADO.NET实体数据模型,选择对应的数据库与表(Studen ...

  7. @property 的本质是什么?ivar、getter、setter 是如何生成并添加到这个类中的

    出题者简介: 孙源(sunnyxx),目前就职于百度 整理者简介:陈奕龙(子循),目前就职于滴滴出行. 转载者:豆电雨(starain)微信:doudianyu @property 的本质是什么? @ ...

  8. uGUI使用代码动态添加Button.OnClick()事件(Unity3D开发之十二)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/42705885 ...

  9. 原生js查询、添加、删除类

    1.添加类 为标签添加一个class的类 如:<div id="box" class="box">内容</div> document.g ...

随机推荐

  1. tomcat重载web项目,debug

    Reloading Context with name [/testCookie] is completed 加载上下文名称[ / ]完成testcookie //start九月 05, 2017 9 ...

  2. coding 321

    三大原理(计算机原理.操作系统原理.编译原理)两个协议(TCP与HTTP协议)一种结构(数据结构)

  3. Redis 一些基本的概念和基础

    Redis 简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库. Redis 与其他 key - value 缓存产品有以下三个特点: Redis支持数据的持久 ...

  4. 「CF161B」Discounts

    传送门 Luogu 解题思路 贪心地想一想,我们肯定要让凳子去给价格越高的商品打半价,那么我们就先按照价格排序,但是要优先把凳子排在前面. 然后我们发现一条凳子肯定只能给价格小于等于它本身的物品打半价 ...

  5. 尝试使用 Visual Studio Online (Cloud IDE)

    这里的 Visual Studio Online 不是 Azure DevOps ,他们虽然是相同的名称,却是不同的域名 https://online.visualstudio.com/ ,今天我们就 ...

  6. 前端学习笔记系列一:12 js中获取时间new date()的用法

    获取时间: 1  var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.get ...

  7. 生成MyEclipse6.5&7.5&8.5 注册机源码

    分类: java技术2010-09-30 21:46 26638人阅读 评论(6) 收藏 举报 myeclipsejavastringimportinputbyte 生成MyEclipse8.5注册码 ...

  8. pgsql 查询jsonb中包含某个键值对的表记录

    pgsql 查询jsonb中包含某个键值对的表记录 表名 table_name ,字段 combos 类型为 jsonb 可为空,示例内容如下, $arr_combos = [ ['id' => ...

  9. POJ 2386 Lake Counting 八方向棋盘搜索

    Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 53301   Accepted: 26062 D ...

  10. JuJu团队1月7号工作汇报

    JuJu团队1月7号工作汇报 JuJu 周六周日放假,所以空了两天~   Scrum 团队成员 今日工作 剩余任务 困难 飞飞 完成data process readme部分 实现三维Dense 无 ...