Win32&列表框控件 [英] Win32 & Listbox Control
本文介绍了Win32&列表框控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有由win32编码并使用资源的dll.
我正在此dll中使用列表框控件.
Hi,
I have dll that coded by win32 and using resource.
I am using Listbox control in this dll.
case IDC_LIST1:
int index = SendDlgItemMessage(hDlg, IDC_LIST1, LB_ADDSTRING, (LPARAM)"RR", (LPARAM)"www.rezafx.com");
break;
我将内容添加到具有以上几行的列表框中.
我想在列表"框中显示一个包含超链接的字符串.我该怎么做?
使用上面的代码,它仅显示静态文本.
问候,
I add content to listbox with above lines.
I want show one string include hyperlink in my List box. How I must do that?
With above code it only show static text.
Regards,
推荐答案
如果使用win32(无MFC),请查看以下内容以更改列表中项目的颜色:
在Win32 API下使用ListView控件 [
如果可以使用MFC,本文将显示一个超链接:
CGridListCtrlEx-基于CListCtrl的网格控制 [
If working with win32 (no MFC) take a look at this to change color of items in the list:
Using ListView control under Win32 API[^]
This part of the article says it all:
"You won''t believe how much time I took to dig this up to actually work! I mean, 99.99% examples were MFC only!
So here we go, finally, pure WinAPI code for listview colors."
If you can use MFC, this this article shows an hyperlink:
CGridListCtrlEx - Grid Control Based on CListCtrl[^]
Hope it helps.
ListBox
控件不理解超链接,只能理解字符串.但是,您可以使用LBS_OWNERDRAWFIXED
样式,如该MSDN页面中的所述 [^ ],并提供自己的消息处理来添加此类功能.
TheListBox
control does not understand hyperlinks, only strings. However, you can use theLBS_OWNERDRAWFIXED
style, as described in this MSDN page[^], and provide your own message handling to add such functionality.
请查看 ^ ]
您可以对列表框进行子类化,并跟踪何时应显示您的项目.创建一个 SysLink [
Have a look at Create your own controls - the art of subclassing[^]
You can subclass the listbox, and keep track of when your item should be visible. Create a SysLink[^] control and place it over your item.
Best regards
Espen Harlinn
这篇关于Win32&列表框控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文