• 大小: 53KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: 其他
  • 标签: 图标  combobox  

资源简介

带图标的下拉列表框控件,不但可以使你的程序界面美观,而且还能使你的下拉列表框变高。

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “app.h“
#include “IconComboBox.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


class CTestDialog : public CDialog
{
public:
CTestDialog(CWnd* pParent = NULL);   // standard constructor

//{{AFX_DATA(CTestDialog)
enum { IDD = IDD_MAINFRM };
//}}AFX_DATA
CSmallIconComboBox m_ctrlCombo1;
UINT m_nIconID1;
CLargeIconComboBox m_ctrlCombo2;
UINT m_nIconID2;

protected:
//{{AFX_VIRTUAL(CTestDialog)
virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
//}}AFX_VIRTUAL

//{{AFX_MSG(CTestDialog)
afx_msg HCURSOR OnQueryDragIcon();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

HICON m_hIcon;
};





CTestDialog::CTestDialog(CWnd* pParent /*=NULL*/)
: CDialog(CTestDialog::IDD pParent)
{
//{{AFX_DATA_INIT(CTestDialog)
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINframe);
m_nIconID1 = IDI_SMALL2;
m_nIconID2 = IDI_BIG3;
}


void CTestDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestDialog)
//}}AFX_DATA_MAP
DDX_Control(pDX IDC_COMBO1 m_ctrlCombo1);
DDX_CBIcon(pDX IDC_COMBO1 m_nIconID1);
DDX_Control(pDX IDC_COMBO2 m_ctrlCombo2);
DDX_CBIcon(pDX IDC_COMBO2 m_nIconID2);
}

BEGIN_MESSAGE_MAP(CTestDialog CDialog)
//{{AFX_MSG_MAP(CTestDialog)
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

HCURSOR CTestDialog::OnQueryDragIcon() 
{
return (HCURSOR) m_hIcon;
}

BOOL CTestDialog::OnInitDialog() 
{
CDialog::OnInitDialog();

//Set up the dialog menu
SetIcon(m_hIcon TRUE);
SetIcon(m_hIcon FALSE);


//Set up the icons which are contained 
//within the icon combo boxes

  //Add all the small icons available
  m_ctrlCombo1.AddIcon(IDI_SMALL1);
  m_ctrlCombo1.AddIcon(IDI_SMALL2);
  m_ctrlCombo1.AddIcon(IDI_SMALL3);
  m_ctrlCombo1.AddIcon(IDI_SMALL4);
  m_ctrlCombo1.AddIcon(IDI_SMALL5);
  m_ctrlCombo1.AddIcon(IDI_SMALL6);
  m_ctrlCombo1.AddIcon(IDI_SMALL7);
  m_ctrlCombo1.AddIcon(IDI_SMALL8);
  
//Add all the large icons available
  m_ctrlCombo2.AddIcon(IDI_BIG1);
  m_ctrlCombo2.AddIcon(IDI_BIG2);
  m_ctrlCombo2.AddIcon(IDI_BIG3);
  m_ctrlCombo2.AddIcon(IDI_BIG4);

  //Force a DoDataExchange after adding the 
//icons to the combo box
UpdateData(FALSE);

return TRUE;
}



BEGIN_MESSAGE_MAP(CTestApp CWinApp)
//{{AFX_MSG_MAP(CTestApp)
//}}AFX_MSG
END_MESSAGE_MAP()

CTestApp::CTestApp()
{
}

CTestApp theApp;

BOOL CTestApp::InitInstance()

  Enable3dControls();

  //Bring up the test dialog
  CTestDialog dlg;
  dlg.DoModal();

return FALSE;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2730  1998-08-26 05:53  IconCombo\IconComboBox_src\app.cpp

     文件        359  1998-08-26 03:56  IconCombo\IconComboBox_src\app.h

     目录          0  2004-12-29 23:36  IconCombo\IconComboBox_src\Debug

     文件       9380  1998-09-13 00:44  IconCombo\IconComboBox_src\IconComboBox.cpp

     文件       3115  1998-08-26 06:30  IconCombo\IconComboBox_src\iconcombobox.gif

     文件       1791  1998-09-13 00:44  IconCombo\IconComboBox_src\IconComboBox.h

     文件      10903  1998-09-13 00:52  IconCombo\IconComboBox_src\iconcombobox.htm

     文件       1078  1998-08-26 05:51  IconCombo\IconComboBox_src\RES\big1.ico

     文件        766  1998-08-26 05:51  IconCombo\IconComboBox_src\RES\big2.ico

     文件        766  1998-08-26 05:51  IconCombo\IconComboBox_src\RES\big3.ico

     文件        766  1998-08-26 05:51  IconCombo\IconComboBox_src\RES\big4.ico

     文件       1078  1998-08-26 04:23  IconCombo\IconComboBox_src\RES\mainfrm.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small1.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small2.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small3.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small4.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small5.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small6.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small7.ico

     文件        318  1998-08-26 04:09  IconCombo\IconComboBox_src\RES\small8.ico

     文件        397  1997-10-16 03:33  IconCombo\IconComboBox_src\RES\testapp.rc2

     目录          0  2004-12-29 23:36  IconCombo\IconComboBox_src\RES

     文件       1993  1998-08-26 05:51  IconCombo\IconComboBox_src\Resource.h

     文件        203  1997-10-16 03:41  IconCombo\IconComboBox_src\StdAfx.cpp

     文件        475  1997-10-16 05:40  IconCombo\IconComboBox_src\StdAfx.h

     文件      30032  2004-03-26 21:04  IconCombo\IconComboBox_src\testapp.aps

     文件       6491  1998-09-13 00:25  IconCombo\IconComboBox_src\testapp.dsp

     文件        539  1998-09-13 00:25  IconCombo\IconComboBox_src\testapp.dsw

     文件      60416  2004-03-26 21:18  IconCombo\IconComboBox_src\testapp.ncb

     文件       4620  1998-08-26 05:56  IconCombo\IconComboBox_src\testapp.rc

............此处省略9个文件信息

评论

共有 条评论