// GridCtrl.cpp : implementation file
//
// MFC Grid Control v2.26
//
// Written by Chris Maunder <chris@codeproject.com>
// Copyright (c) 1998-2005. All Rights Reserved.
//
// The code contained in this file was based on the original
// WorldCom Grid control written by Joe Willcoxson,
// mailto:chinajoe@aol.com
// http://users.aol.com/chinajoe
// (These addresses may be out of date) The code has gone through
// so many modifications that I'm not sure if there is even a single
// original line of code. In any case Joe's code was a great
// framework on which to build.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name and all copyright
// notices remains intact.
//
// An email letting me know how you are using it would be nice as well.
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage/loss of business that
// this product may cause.
//
// Expect bugs!
//
// Please use and enjoy, and let me know of any bugs/mods/improvements
// that you have found/implemented and I will fix/incorporate them into
// this file.
//
// History:
// --------
// This control is constantly evolving, sometimes due to new features that I
// feel are necessary, and sometimes due to existing bugs. Where possible I
// have credited the changes to those who contributed code corrections or
// enhancements (names in brackets) or code suggestions (suggested by...)
//
// 1.0 - 1.13 20 Feb 1998 - 6 May 1999
// First release version. Progressed from being a basic
// grid based on the original WorldCom Grid control
// written by Joe Willcoxson (mailto:chinajoe@aol.com,
// http://users.aol.com/chinajoe) to something a little
// more feature rich. Rewritten so many times I doubt
// there is a single line of Joe's code left. Many, many,
// MANY people sent in bug reports and fixes. Thank you
// all.
//
// 2.0 1 Feb 2000
// Rewritten to make the grid more object oriented, in
// that the CGridCell class now takes care of cell-specific
// tasks. This makes the code more robust, but more
// importantly it allows the simple insertion of other
// types of cells.
//
// 2.10 11 Mar 2000 - Ken Bertelson and Chris Maunder
// - Additions for virtual CGridCell support of embedded tree
// & cell buttons implementation
// - Optional WYSIWYG printing
// - Awareness of hidden (0 width/height) rows and columns for
// key movements, cut, copy, paste, and autosizing
// - CGridCell can make title tips display any text rather than
// cell text only
// - Minor vis bug fixes
// - CGridCtrl now works with CGridCellBase instead of CGridCell
// This is a taste of things to come.
//
// 2.20 30 Jul 2000 - Chris Maunder
// - Font storage optimised (suggested by Martin Richter)
// - AutoSizeColumn works on either column header, data or both
// - EnsureVisible. The saga continues... (Ken)
// - Rewrote exception handling
// - Added TrackFocusCell and FrameFocusCell properties, as well as
// ExpandLastColumn (suggested by Bruce E. Stemplewski).
// - InsertColumn now allows you to insert columns at the end of the
// column range (David Weibel)
// - Shift-cell-selection more intuitive
// - API change: Set/GetGridColor now Set/GetGridLineColor
// - API change: Set/GetBkColor now Set/GetGridBkColor
// - API change: Set/GetTextColor, Set/GetTextBkColor depricated
// - API change: Set/GetFixedTextColor, Set/GetFixedBkColor depricated
// - Stupid DDX_GridControl workaround removed.
// - Added "virtual mode" via Set/GetVirtualMode
// - Added SetCallbackFunc to allow callback functions in virtual mode
// - Added Set/GetAutoSizeStyle
// - AutoSize() bug fixed
// - added GVIS_FIXEDROW, GVIS_FIXEDCOL states
// - added Get/SetFixed[Row|Column]Selection
// - cell "Get" methods now const'd. Sorry folks...
// - GetMouseScrollLines now uses win98/W2K friendly code
// - WS_EX_CLIENTEDGE style now implicit
//
// [ Only the latest version and major version changes will be shown ]
////
// 2.25 13 Mar 2004 - Chris Maunder
// - Minor changes so it will compile in VS.NET (inc. Whidbey)
// - Fixed minor bug in EnsureVisible - Junlin Xu
// - Changed AfxGetInstanceHandle for AfxGetResourceHandle in RegisterWindowClass
// - Various changes thanks to Yogurt
//
// 2.26 13 Dec 2005 - Pierre Couderc
// - Added sort in Virtual mode
// - Change row/column order programatically or via drag and drop
// - Added save/restore layer (for undoing row/column order changes)
//
// TODO: 1) Implement sparse grids (super easy now)
// 2) Fix it so that as you drag select, the speed of selection increases
// with time.
// 3) Scrolling is still a little dodgy (too much grey area). I know there
// is a simple fix but it's been a low priority
//
// ISSUES: 1) WindowFromPoint seems to do weird things in W2K. Causing problems for
// the rigt-click-on-titletip code.
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MemDC.h"
#include "GridCtrl.h"
#include <algorithm>
// OLE stuff for clipboard operations
#include <afxadv.h> // For CSharedFile
#include <afxconv.h> // For LPTSTR -> LPSTR macros
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// Spit out some messages as a sanity check for programmers
#ifdef GRIDCONTROL_NO_TITLETIPS
#pragma message(" -- CGridCtrl: No titletips for cells with large data")
#endif
#ifdef GRIDCONTROL_NO_DRAGDROP
#pragma message(" -- CGridCtrl: No OLE drag and drop")
#endif
#ifdef GRIDCONTROL_NO_CLIPBOARD
#pragma message(" -- CGridCtrl: No clipboard support")
#endif
#ifdef GRIDCONTROL_NO_PRINTING
#pragma message(" -- CGridCtrl: No printing support")
#endif
IMPLEMENT_DYNCREATE(CGridCtrl, CWnd)
// Get the number of lines to scroll with each mouse wheel notch
// Why doesn't windows give us this function???
UINT GetMouseScrollLines()
{
int nScrollLines = 3; // reasonable default
#ifndef _WIN32_WCE
// Do things the hard way in win95
OSVERSIONINFO VersionInfo;
VersionInfo.dwOSVersionInfoSize
MFC GridCtrl 2.27修正版
5星 · 超过95%的资源 需积分: 50 48 浏览量
2013-12-03
22:08:58
上传
评论 3
收藏 99KB ZIP 举报
lordquest
- 粉丝: 0
- 资源: 1
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第30题串联所有单词的子串.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第29题两数相除.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第28题找出字符串中第一个匹配项的下标.zip
- 实验报告模板(1).docx
- C语言基础-C语言编程基础之Leetcode编程题解之第26题删除有序数组中的重复项.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第25题K个一组翻转链表.zip
- hnu计算机系统作业-计算机系统基础课程大作业.zip
- 树莓派app.apk
- C++的基于同态加密技术的匿名电子投票系统源码.zip
- SW建模格式图.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页