📄 axtable.cpp
字号:
// AxTable.cpp : Implementation of CAxTable
#include "stdafx.h"
#include "AxAtlSrv.h"
#include "AxTable.h"
/////////////////////////////////////////////////////////////////////////////
// CAxTable
STDMETHODIMP CAxTable::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IAxTable
};
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
{
if (InlineIsEqualGUID(*arr[i],riid))
return S_OK;
}
return S_FALSE;
}
STDMETHODIMP CAxTable::get_Left(long *pVal)
{
// TODO: Add your implementation code here
*pVal=m_nLeft;
return S_OK;
}
STDMETHODIMP CAxTable::put_Left(long newVal)
{
// TODO: Add your implementation code here
m_nLeft=newVal;
return S_OK;
}
STDMETHODIMP CAxTable::get_Right(long *pVal)
{
// TODO: Add your implementation code here
*pVal=m_nRight;
return S_OK;
}
STDMETHODIMP CAxTable::put_Right(long newVal)
{
// TODO: Add your implementation code here
m_nRight=newVal;
return S_OK;
}
STDMETHODIMP CAxTable::get_Top(long *pVal)
{
// TODO: Add your implementation code here
*pVal=m_nTop;
return S_OK;
}
STDMETHODIMP CAxTable::put_Top(long newVal)
{
// TODO: Add your implementation code here
m_nTop=newVal;
return S_OK;
}
STDMETHODIMP CAxTable::get_Bottom(long *pVal)
{
// TODO: Add your implementation code here
*pVal=m_nBottom;
return S_OK;
}
STDMETHODIMP CAxTable::put_Bottom(long newVal)
{
// TODO: Add your implementation code here
m_nBottom=newVal;
return S_OK;
}
STDMETHODIMP CAxTable::get_RowNum(short *pVal)
{
// TODO: Add your implementation code here
*pVal=m_nRowNum;
return S_OK;
}
STDMETHODIMP CAxTable::put_RowNum(short newVal)
{
// TODO: Add your implementation code here
m_nRowNum=newVal;
return S_OK;
}
STDMETHODIMP CAxTable::get_ColNum(short *pVal)
{
// TODO: Add your implementation code here
*pVal=m_nColNum;
return S_OK;
}
STDMETHODIMP CAxTable::put_ColNum(short newVal)
{
// TODO: Add your implementation code here
m_nColNum=newVal;
return S_OK;
}
STDMETHODIMP CAxTable::Draw(long nDC)
{
// TODO: Add your implementation code here
// 得到绘图设备句柄
HDC hDC=(HDC)nDC;
// 计算每个单元格的宽度和高度
long nWidth=(m_nRight-m_nLeft)/m_nColNum;
long nHeight=(m_nBottom-m_nTop)/m_nRowNum;
int nIndex=0;
// 绘制横线
for(nIndex=0;nIndex<=m_nRowNum;nIndex++)
{
MoveToEx(hDC,m_nLeft,m_nTop+nIndex*nHeight,NULL);
LineTo(hDC,m_nRight,m_nTop+nIndex*nHeight);
}
// 绘制纵线
for(nIndex=0;nIndex<=m_nColNum;nIndex++)
{
MoveToEx(hDC,m_nLeft+nIndex*nWidth,m_nTop,NULL);
LineTo(hDC,m_nLeft+nIndex*nWidth,m_nBottom);
}
return S_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -