资源简介
美国Galil运动控制卡的例子程序,程序是基于C++开发的。
代码片段和文件信息
#include “stdafx.h“
#include “BtnST.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CButtonST
CButtonST::CButtonST()
{
k=0;
j=0;
m_MouseOnButton = FALSE;
m_hIconIn = NULL;
m_hIconOut = NULL;
m_cxIcon = 0;
m_cyIcon = 0;
m_hCursor = NULL;
// Default type is “flat“ button
m_bIsFlat = TRUE;
// By default draw border in “flat“ button
m_bDrawBorder = TRUE;
// By default icon is aligned horizontally
m_nAlign = ST_ALIGN_HORIZ;
// By default show the text button
m_bShowText = TRUE;
// By default for “flat“ button don‘t draw the focus rect
m_bDrawFlatFocus = FALSE;
// By default the button is not the default button
m_bIsDefault = FALSE;
SetDefaultInactiveBgColor();
SetDefaultInactiveFgColor();
SetDefaultActiveBgColor();
SetDefaultActiveFgColor();
// No tooltip created
m_ToolTip.m_hWnd = NULL;
// Do not draw as a transparent button
m_bDrawTransparent = FALSE;
m_pbmpOldBk = NULL;
} // End of CButtonST
CButtonST::~CButtonST()
{
// Restore old bitmap (if any)
if (m_dcBk.m_hDC != NULL && m_pbmpOldBk != NULL)
{
m_dcBk.Selectobject(m_pbmpOldBk);
}
// Destroy the icons (if any)
// Note: the following two lines MUST be here! even if
// BoundChecker says they are unnecessary!
if (m_hIconIn != NULL) ::DestroyIcon(m_hIconIn);
if (m_hIconOut != NULL) ::DestroyIcon(m_hIconOut);
// Destroy the cursor (if any)
if (m_hCursor != NULL) ::DestroyCursor(m_hCursor);
} // End of ~CButtonST
BEGIN_MESSAGE_MAP(CButtonST CButton)
//{{AFX_MSG_MAP(CButtonST)
ON_WM_CAPTURECHANGED()
ON_WM_SETCURSOR()
ON_WM_KILLFOCUS()
ON_WM_MOUSEMOVE()
ON_WM_CTLCOLOR_REFLECT()
ON_WM_SYSCOLORCHANGE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CButtonST::SetIcon(int nIconInId int nIconOutId)
{
HICON hIconIn;
HICON hIconOut;
HINSTANCE hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nIconInId) RT_GROUP_ICON);
// Set icon when the mouse is IN the button
hIconIn = (HICON)::LoadImage(hInstResource/*AfxGetApp()->m_hInstance*/ MAKEINTRESOURCE(nIconInId) IMAGE_ICON 0 0 0);
// Set icon when the mouse is OUT the button
hIconOut = (nIconOutId == NULL) ? NULL : (HICON)::LoadImage(hInstResource/*AfxGetApp()->m_hInstance*/ MAKEINTRESOURCE(nIconOutId) IMAGE_ICON 0 0 0);
SetIcon(hIconIn hIconOut);
/*
// Note: the following two lines MUST be here! even if
// BoundChecker says they are unnecessary!
if (m_hIconIn != NULL) ::DestroyIcon(m_hIconIn);
if (m_hIconOut != NULL) ::DestroyIcon(m_hIconOut);
// Set icon when the mouse is IN the button
m_hIconIn = (HICON)::LoadImage(hInstResource MAKEINTRESOURCE(nIconInId) IMAGE_ICON 0 0 0);
// Set icon when the mouse is OUT the button
m_hIconOut = (nIconOutId == NULL) ? m_hIcon
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 22727 2014-08-29 09:47 GalilTest\BtnST.cpp
文件 6747 2014-08-29 09:47 GalilTest\BtnST.h
文件 68805 2014-08-29 09:47 GalilTest\Debug\BtnST.obj
文件 0 2014-08-29 09:47 GalilTest\Debug\BtnST.sbr
文件 56049 2014-08-29 09:41 GalilTest\Debug\DMCWIN.obj
文件 0 2014-08-29 09:41 GalilTest\Debug\DMCWIN.sbr
文件 5497856 2014-09-25 15:41 GalilTest\Debug\GalilTest.bsc
文件 139317 2014-09-25 15:41 GalilTest\Debug\GalilTest.exe
文件 596320 2014-09-25 15:41 GalilTest\Debug\GalilTest.ilk
文件 25434 2014-09-25 15:32 GalilTest\Debug\GalilTest.obj
文件 6948836 2014-08-20 10:41 GalilTest\Debug\GalilTest.pch
文件 599040 2014-09-25 15:41 GalilTest\Debug\GalilTest.pdb
文件 3568 2014-09-25 15:32 GalilTest\Debug\GalilTest.res
文件 0 2014-09-25 15:32 GalilTest\Debug\GalilTest.sbr
文件 65289 2014-09-25 15:41 GalilTest\Debug\GalilTestDlg.obj
文件 0 2014-09-25 15:41 GalilTest\Debug\GalilTestDlg.sbr
文件 105460 2014-09-25 15:32 GalilTest\Debug\StdAfx.obj
文件 1374920 2014-09-25 15:32 GalilTest\Debug\StdAfx.sbr
文件 230400 2014-09-25 16:15 GalilTest\Debug\vc60.idb
文件 380928 2014-09-25 15:41 GalilTest\Debug\vc60.pdb
文件 42516 2001-08-31 17:50 GalilTest\DMC32.lib
文件 48507 2001-08-30 15:09 GalilTest\Dmccom.h
文件 15252 2001-05-16 16:07 GalilTest\dmcdrc.h
文件 3599 2000-09-25 10:47 GalilTest\dmcdrco.h
文件 4757 2000-03-24 16:01 GalilTest\DMCMLIB.H
文件 5208 2001-01-08 11:35 GalilTest\DMCMLIB.lib
文件 17384 1999-02-03 14:02 GalilTest\DMCWIN.CPP
文件 9664 2014-08-15 11:01 GalilTest\DMCWIN.H
文件 37024 2014-09-25 15:30 GalilTest\GalilTest.aps
文件 2305 2014-09-25 16:20 GalilTest\GalilTest.clw
............此处省略22个文件信息
评论
共有 条评论