//设置横向滚动条
procedure TFormMain.SetHorizontalScrollBar(CustomListBox:TCustomListBox);
var i, MaxWidth:Integer;
begin
MaxWidth:=0;
for i:=0 to CustomListBox.Items.Count-1 do
if MaxWidth<CustomListBox.Canvas.TextWidth(CustomListBox.Items[i]) then
MaxWidth:=CustomListBox.Canvas.TextWidth(CustomListBox.Items[i]);
SendMessage(CustomListBox.Handle, LB_SETHORIZONTALEXTENT, MaxWidth+5, 0);
end;在向ListBox中添加条目时,调用这个过程,SetHorizontalScrollBar(ListBox1);但是并没有像我预想的那样,横向滚动条应该显示到最大条目那个长度。
这是为什么呢??哪里不对呢?我觉得问题出在MaxWidth+5这个参数上,请高手们帮忙解释一下。
procedure TFormMain.SetHorizontalScrollBar(CustomListBox:TCustomListBox);
var i, MaxWidth:Integer;
begin
MaxWidth:=0;
for i:=0 to CustomListBox.Items.Count-1 do
if MaxWidth<CustomListBox.Canvas.TextWidth(CustomListBox.Items[i]) then
MaxWidth:=CustomListBox.Canvas.TextWidth(CustomListBox.Items[i]);
SendMessage(CustomListBox.Handle, LB_SETHORIZONTALEXTENT, MaxWidth+5, 0);
end;在向ListBox中添加条目时,调用这个过程,SetHorizontalScrollBar(ListBox1);但是并没有像我预想的那样,横向滚动条应该显示到最大条目那个长度。
这是为什么呢??哪里不对呢?我觉得问题出在MaxWidth+5这个参数上,请高手们帮忙解释一下。
解决方案 »
- 程序运行中线程线程的奇怪问题
- 怎样判断dbGrid 多选的情况下,选中巨行块(RECT)时 怎么样确定行数!!! 开始行和结束行
- 如何注册控件?
- 新组建的Delphi联盟QQ群,希望和大家一起提高 :)
- 怎样用readln从文件读数据?在线等
- 高分求教,提供一个用excel在一个表单中做出曲线的程序,分另外加,需要多少尽管说
- DELPHI如何处理象VF中的宏的使用?高手请进!
- 关于delphi调试问题
- 急!(50分)求用Delphi 5编写的exe的资源(如窗体,图像资源)提取及反编译器.
- 懒的看书了,很简单的delphi问题,马上给分!!!
- 在KeyDown事件中如何获取Ctrl + S或者Ctrl + A等组合键?
- 简单的统计实现,时间太紧,送分!
begin
SendMessage(ListBox1.Handle,LB_SetHorizontalExtent,5000, longint(0));
end;