抛弃GdCpp*.dll/pdb历史重新建库。libhv和Sqlite的dll保留
This commit is contained in:
116
staticOnly/KsMFC/customcells.cpp
Normal file
116
staticOnly/KsMFC/customcells.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
//*******************************************************************************
|
||||
// COPYRIGHT NOTES
|
||||
// ---------------
|
||||
// This is a sample for BCGControlBar Library Professional Edition
|
||||
// Copyright (C) 1998-2024 BCGSoft Ltd.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This source code can be used, distributed or modified
|
||||
// only under terms and conditions
|
||||
// of the accompanying license agreement.
|
||||
//*******************************************************************************
|
||||
//
|
||||
// CustomCells.cpp: implementation of the CColorGridItem class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.h"
|
||||
//#include "BCGPGridExample.h"
|
||||
#include "CustomCells.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// CButtonItem Class
|
||||
|
||||
CButtonItem::CButtonItem (LPCTSTR lpszText, UINT id) :
|
||||
CBCGPGridItem (lpszText)
|
||||
{
|
||||
m_bAllowEdit = FALSE;
|
||||
m_id = id;
|
||||
}
|
||||
//*****************************************************************************************
|
||||
void CButtonItem::OnDrawValue (CDC* pDC, CRect rect)
|
||||
{
|
||||
ASSERT_VALID (pDC);
|
||||
|
||||
CBCGPGridCtrl* pGridCtrl = GetOwnerList ();
|
||||
|
||||
OnFillBackground (pDC, rect);
|
||||
|
||||
const int nMargin = globalUtils.ScaleByDPI(1, pGridCtrl);
|
||||
rect.DeflateRect(nMargin, nMargin);
|
||||
|
||||
COLORREF clrText = globalData.clrBarText;
|
||||
|
||||
if (pGridCtrl != NULL && pGridCtrl->IsVisualManagerStyle())
|
||||
{
|
||||
clrText = CBCGPVisualManager::GetInstance()->OnDrawPropListPushButton(pDC, rect, NULL, TRUE, FALSE, IsEnabled(), FALSE, IsHighlighted());
|
||||
}
|
||||
else
|
||||
{
|
||||
clrText = CBCGPVisualManager::GetInstance()->CBCGPVisualManager::OnDrawPropListPushButton(pDC, rect, NULL, TRUE, FALSE, IsEnabled(), FALSE, IsHighlighted());
|
||||
}
|
||||
|
||||
|
||||
COLORREF clrTextOld = pDC->SetTextColor(clrText);
|
||||
|
||||
CString strText = (LPCTSTR)(_bstr_t) m_varValue;
|
||||
pDC->DrawText (strText, rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
|
||||
|
||||
pDC->SetTextColor (clrTextOld);
|
||||
}
|
||||
//*****************************************************************************************
|
||||
BOOL CButtonItem::OnClickValue (UINT uiMsg, CPoint point)
|
||||
{
|
||||
if (uiMsg != WM_LBUTTONDOWN)
|
||||
{
|
||||
return CBCGPGridItem::OnClickValue (uiMsg, point);
|
||||
}
|
||||
|
||||
CBCGPGridCtrl* pGridCtrl = GetOwnerList();
|
||||
ASSERT_VALID (pGridCtrl);
|
||||
|
||||
pGridCtrl->SendMessage (WM_COMMAND,
|
||||
MAKEWPARAM (m_id, BN_CLICKED));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
//*****************************************************************************************
|
||||
BOOL CButtonItem::PushChar (UINT nChar)
|
||||
{
|
||||
if (nChar == VK_SPACE || nChar == VK_RETURN)
|
||||
{
|
||||
CBCGPGridCtrl* pGridCtrl = GetOwnerList();
|
||||
ASSERT_VALID (pGridCtrl);
|
||||
|
||||
pGridCtrl->SendMessage (WM_COMMAND,
|
||||
MAKEWPARAM (m_id, BN_CLICKED));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CBCGPGridItem::PushChar(nChar);
|
||||
}
|
||||
//*****************************************************************************************
|
||||
void CButtonItem::OnMouseMove(const CPoint& /*point*/)
|
||||
{
|
||||
if (!IsHighlighted())
|
||||
{
|
||||
Highlight();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
//*****************************************************************************************
|
||||
void CButtonItem::OnMouseLeave()
|
||||
{
|
||||
if (IsHighlighted())
|
||||
{
|
||||
Highlight(FALSE);
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user