关于 过时的 蛋疼的 MFC + DataGrid 显示设置

本文主要介绍了在过时的MFC环境中如何使用DataGrid控件,包括其滚动功能、行选择、对话框显示等。文章指出DataGrid自身已支持滚动,但不包含上下翻页功能。同时,提供了设置鼠标点击选中整行的技巧,并分享了在任务栏中显示新对话框的方法。此外,还列出了一系列DataGrid的重要属性和方法。
摘要由CSDN通过智能技术生成

由于MFC 已经过时了。。DataGrid的帮助文档 找不到。。。查了很多资料没见到有对于C++ MFC DataGrid的 API (本人比较蠢。。在MSDN上居然找不到,也许是关键词错了,望懂的人能帮忙指导一下 (  0  .  0 ))

一下是自己的一些小总结:


1、 DataGrid 控件自身就支持滚动查看数据,所以别再跟着C# 啥的。。设置参数的。。PS :自带滚动,但不带上下翻页


2、对于有些同学想实现的鼠标点击DataGrid 中的某个数据,被选中的是整一行的功能  至少显示出来的效果是这样,,但还是能获取到 对应的列的 
      可以通过 该语句实现  m_grid.SetMarqueeStyle(0x3);      

     PS:m_grid是自己定义的CDataGrid对象。。 当然这只是笔者自己用的 datagrid类的功能 具体 .h 文件 .cpp文件见附件


关于 MFC 显示新的对话框的一些总结:


在显示自己新建的对话框时,发现,Tab+Alt能切过去,但在任务栏中并没显示该对话框, PS :我是在主对话框的 初始化函数中新建对话框的

可以通过 该语句实现 在任务栏中显示对话框 CWnd::ModifyStyleEx(NULL, WS_EX_APPWINDOW);  这个函数在MSDN中我还是查到了。。ps 用函数可使每个对话框都显示在任务栏。当然若是想隐藏的话只需改动参数即可,,MSDN上都有


头文件 

#if !defined(AFX_DATAGRID_H__33AD90AC_2A60_4D2B_B4DF_24F2761962F0__INCLUDED_)
#define AFX_DATAGRID_H__33AD90AC_2A60_4D2B_B4DF_24F2761962F0__INCLUDED_


#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++


// NOTE: Do not modify the contents of this file.  If this class is regenerated by
//  Microsoft Visual C++, your modifications will be overwritten.


/
// CDataGrid wrapper class


class CDataGrid : public CWnd
{
protected:
DECLARE_DYNCREATE(CDataGrid)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0xcde57a43, 0x8b86, 0x11d0, { 0xb3, 0xc6, 0x0, 0xa0, 0xc9, 0xa, 0xea, 0x82 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }


BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }


// Attributes
public:


// Operations
public:
long GetAddNewMode();
BOOL GetAllowAddNew();
void SetAllowAddNew(BOOL bNewValue);
BOOL GetAllowArrows();
void SetAllowArrows(BOOL bNewValue);
BOOL GetAllowDelete();
void SetAllowDelete(BOOL bNewValue);
BOOL GetAllowRowSizing();
void SetAllowRowSizing(BOOL bNewValue);
BOOL GetAllowUpdate();
void SetAllowUpdate(BOOL bNewValue);
long GetAppearance();
void SetAppearance(long nNewValue);
long GetApproxCount();
unsigned long GetBackColor();
void SetBackColor(unsigned long newValue);
VARIANT GetBookmark();
void SetBookmark(const VARIANT& newValue);
long GetBorderStyle();
void SetBorderStyle(long nNewValue);
CString GetCaption();
void SetCaption(LPCTSTR lpszNewValue);
short GetCol();
void SetCol(short nNewValue);
BOOL GetColumnHeaders();
void SetColumnHeaders(BOOL bNewValue);
BOOL GetCurrentCellModified();
void SetCurrentCellModified(BOOL bNewValue);
BOOL GetCurrentCellVisible();
void SetCurrentCellVisible(BOOL bNewValue);
BOOL GetDataChanged();
void SetDataChanged(BOOL bNewValue);
LPUNKNOWN GetDataSource();
void SetRefDataSource(LPUNKNOWN newValue);
CString GetDataMember();
void SetDataMember(LPCTSTR lpszNewValue);
float GetDefColWidth();
void SetDefColWidth(float newValue);
BOOL GetEditActive();
void SetEditActive(BOOL bNewValue);
BOOL GetEnabled();
void SetEnabled(BOOL bNewValue);
CString GetErrorText();
LPDISPATCH GetFont();
void SetRefFont(LPDISPATCH newValue);
unsigned long GetForeColor();
void SetForeColor(unsigned long newValue);
VARIANT GetFirstRow();
void SetFirstRow(const VARIANT& newValue);
LPDISPATCH GetHeadFont();
void SetRefHeadFont(LPDISPATCH newValue);
float GetHeadLines();
void SetHeadLines(float newValue);
long GetHWnd();
long GetHWndEditor();
short GetLeftCol();
void SetLeftCol(short nNewValue);
long GetMarqueeStyle();
void SetMarqueeStyle(long nNewValue);
BOOL GetRecordSelectors();
void SetRecordSelectors(BOOL bNewValue);
BOOL GetRightToLeft();
void SetRightToLeft(BOOL bNewValue);
short GetRow();
void SetRow(short nNewValue);
long GetRowDividerStyle();
void SetRowDividerStyle(long nNewValue);
float GetRowHeight();
void SetRowHeight(float newValue);
long GetScrollBars();
void SetScrollBars(long nNewValue);
short GetSelEndCol();
void SetSelEndCol(short nNewValue);
long GetSelLength();
void SetSelLength(long nNewValue);
long GetSelStart();
void SetSelStart(long nNewValue);
short GetSelStartCol();
void SetSelStartCol(short nNewValue);
CString GetSelText();
void SetSelText(LPCTSTR lpszNewValue);
short GetSplit();
void SetSplit(short nNewValue);
BOOL GetTabAcrossSplits();
void SetTabAcrossSplits(BOOL bNewValue);
long GetTabAction();
void SetTabAction(long nNewValue);
CString GetText();
void SetText(LPCTSTR lpszNewValue);
short GetVisibleCols();
short G

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值