|
// FormatIcon.cpp : implementation file
//
#include "stdafx.h"
#include "Icon Manager.h"
#include "FormatIcon.h"
#include "FormatDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFormatIcon
CFormatIcon::CFormatIcon(CFormatDlg* pParent)
{
m_pParent = pParent;
}
CFormatIcon::~CFormatIcon()
{
}
BEGIN_MESSAGE_MAP(CFormatIcon, CStatic)
//{{AFX_MSG_MAP(CFormatIcon)
ON_WM_LBUTTONDOWN()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFormatIcon message handlers
void CFormatIcon::AddFormat(CSize Size, int nColor, int nID)
{
m_Size = Size;
m_nColor = nColor;
m_nID = nID;
}
void CFormatIcon::OnLButtonDown(UINT nFlags, CPoint point)
{
NotifyScroll();
//CStatic::OnLButtonDown(nFlags, point);
}
void CFormatIcon::NotifyScroll()
{
m_pParent->ScrollTo(m_Rect.top+(m_Rect.Height() / 2), m_nID);
}
void CFormatIcon::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rc;
CString szBuf;
GetClientRect(rc);
szBuf.Format("%dx%d\n%d (%d)", m_Size.cx , m_Size.cy, m_nColor, m_nID);
dc.SetBkMode(TRANSPARENT);
dc.DrawText(szBuf, rc, DT_CENTER|DT_VCENTER);
// Do not call CStatic::OnPaint() for painting messages
}
void CFormatIcon::SetBoxRect(CRect rc, BOOL bRedraw)
{
m_Rect = rc;
if (bRedraw) {
SetWindowPos(NULL, 0, m_Rect.top, 0, 0, SWP_NOSIZE);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.