如何给comboBox的下拉列表加上水平滚动条或改变其宽度

radish 2000-01-13 09:49:00
...全文
810 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ypyRock 2001-07-17
  • 打赏
  • 举报
回复
yjq(渤海海峡)能否把你的控件借我用用?我正缺。
WHQ 2000-01-13
  • 打赏
  • 举报
回复
向它发CB_GETHORIZONTALEXTENT消息便可,如用MFC,则CComboBox::SetHorizontalExtent
kxy 2000-01-13
  • 打赏
  • 举报
回复
我想只能先看ComboBox的源码,在自己继承一个。
渤海海峡 2000-01-13
  • 打赏
  • 举报
回复
我作了一个控件,原理用一个edit加一个listbox,可以根据字符设宽度,也可以自己
设定宽度。
radish 2000-01-13
  • 打赏
  • 举报
回复
是的,kxy说的对,但在PB里面的COMCOBOX就可以有水平滚动条,不知道是如何做的
kxy 2000-01-13
  • 打赏
  • 举报
回复
CB_GETHORIZONTALEXTENT是取得宽度.
CB_SETHORIZONTALEXTENT是设置宽度.
都不灵,tiger is right
use CB_SETDROPPEDWIDTH
tiger 2000-01-13
  • 打赏
  • 举报
回复
TControl.Perform
----------------------------------------------------------------
Responds as if the control received a specified Windows message.

function Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;

Description

Call Perform to bypass the Windows message queue and send a message directly to the control抯 window procedure.

Perform fills a message record (of type TMessage) with the message ID passed in the Msg parameter, the message parameters passed in WParam and LParam, and a result field of zero. Perform then passes the message record to the WindowProc method for processing.
----------------------------------------------------------------
eg:
procedrue Tform1.FormShow(Sender : Tobjects)
begin
comboBox1.Perform(CB_SETDROPPEDWIDTH, 100, 0);
end;
kxy 2000-01-13
  • 打赏
  • 举报
回复
CB_GETHORIZONTALEXTENT是取得宽度.
CB_SETHORIZONTALEXTENT是设置宽度.
An application sends the CB_SETHORIZONTALEXTENT message to set the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width). If the width of the list box is smaller than this value, the horizontal scroll bar horizontally scrolls items in the list box. If the width of the list box is equal to or greater than this value, the horizontal scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled.

CB_SETHORIZONTALEXTENT
wParam = (WPARAM) cxExtent; // scrollable width of list box, in pixels
lParam = 0; // not used, must be zero


Parameters

cxExtent

Specifies the scrollable width of the list box, in pixels.



Return Values

No return value.
radish 2000-01-13
  • 打赏
  • 举报
回复
我用SendMessage发过,好象没用

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧