小辉程序员之路, since 1996 http://www.xiaohui.com
乐走天涯: 工作并快乐着,职业并休闲着
 » 首页 > GUI界面处理源码: 列表框(ListBox)控制

A VisualStudio-like ListBox class - Visual Studio 风格的列表框


http://www.XiaoHui.com 日期: 2000-02-01 13:00

本程序实现 Visual Studio 风格的列表框(A VisualStudio-like ListBox class),如图:

Visual Studio 风格的列表框(A VisualStudio-like ListBox class)

  1. 环境:VC++ 6
  2. 作者: Stefano Passiglia
  3. 下载链接 下载源代码及演示程序

A VisualStudio-like ListBox class 示例代码


// This class overrides the OnBrowseButton method.
class CMyListBoxEx: public CListBoxEx
{
public:

 virtual void OnBrowseButton( int iItem )
 {
  iItem;
  CSHBrowseDlg dlgBrowse;
  if ( dlgBrowse.DoModal() ) SetEditText( dlgBrowse.GetFullPath() );
 };
};

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

// Dialog Data
 //{{AFX_DATA(CListBoxExDemoDlg)
 enum { IDD = IDD_LISTBOXEXDEMO_DIALOG };
 CMyListBoxEx	m_ListBoxEx;
 //}}AFX_DATA
};
If you want to use also the buddy class, drop a button on the dialog, change its properties and make it owner-draw and with a client edge. Then, in your dialog OnInitDialog() subclass the button control in this way:

// Add the listbox buddy
m_ListBoxExBuddy.SubclassDlgItem( IDC_LISTBUDDY, this );
m_ListBoxExBuddy.SetListbox( &m_ListBoxEx )

Tags: VC 源码: ListBox



 文章评论

目前没有任何评论.

↓ 快抢占第1楼,发表你的评论和意见 ↓
 
发表你的评论
如果你想针对此文发表评论, 请填写下列表单:
姓名: * 必填
E-mail: 可选 (不会被公开)
反垃圾广告: 为了防止广告机器人自动发贴, 请计算下列表达式的值:
7 + 20 = * 必填
评论内容:
* 必填
你可以使用下列标签修饰文字:
[b] 文字 [/b]: 加粗文字
[quote] 文字 [/quote]: 引用文字

 

小辉程序员之路 建站于 1997 ◇ 做一名最好的开发者是我不变的理想……
Copyright(C) 1997-2008 XiaoHui.com   All rights reserved
声明:站内所有原创文字,未经许可,均可转载、复制。
转载时必须以链接形式注明作者和原始出处