如TListBox中有
张三
李四
王二
如选择了张三再选择李四,那么框中变为:张三、李四,而不是李四
再在下拉列表中选择王二,那么框中变为:张三、李四、王二,而不是王二
张三
李四
王二
如选择了张三再选择李四,那么框中变为:张三、李四,而不是李四
再在下拉列表中选择王二,那么框中变为:张三、李四、王二,而不是王二
解决方案 »
- CXGRID排序以后 选择记录方式 哪个比较好
- 求Tchart 显示柱状图 实例代码?
- 这年头,有用MySQL做C/S结构的应用的数据库的么?用InterBase的我倒是见过,例如速达,那么MySQL是否有IB那么方便呢?!
- 如何在一个DBGrid中显示两个表中的部分字段?
- 想做一个XP风格的软件,不知该如何做?请各位指点指点!!!
- 奇怪!!!!!!!!!!!!!!!!!!!!!!!!!!!!用ADO不行,用ODBC就可以?why?
- 晕了,,,,,。。动态创建tmediaplayer问题。。。
- 接口问题,大家快来拿分!
- 请问高手Delphi7如何开发.net程序?
- sql与delphi之间的链接
- VCLZIP解压缩单个文件的问题
- 用XML做配置文件时遇到的问题
不知道是不是这个意思.
:)
http://topic.csdn.net/u/20080510/15/4dd5fadc-563a-42e4-af64-d3831ef89725.html
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;const
WM_SHOWCOMBTEXT = WM_USER + 12345; //定义一个消息显示ComboBox.Texttype
TForm1 = class(TForm)
ComboBox1: TComboBox;
procedure ComboBox1DropDown(Sender: TObject);
procedure ComboBox1Select(Sender: TObject);
private
{ Private declarations }
cText: string;
PrevIndex: Integer;
procedure DoShowCombText(var Msg: TMessage); message WM_SHOWCOMBTEXT;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.ComboBox1DropDown(Sender: TObject);
begin
PrevIndex := ComboBox1.ItemIndex;
cText := ComboBox1.Text;
end;procedure TForm1.ComboBox1Select(Sender: TObject);
begin
if (ComboBox1.ItemIndex <> PrevIndex) and (ComboBox1.ItemIndex > -1) then
begin
if Trim(cText) = '' then
cText := ComboBox1.Items[ComboBox1.ItemIndex]
else
cText := cText + ',' + ComboBox1.Items[ComboBox1.ItemIndex];
PostMessage(Handle, WM_SHOWCOMBTEXT, 0, 0);
end;
end;procedure TForm1.DoShowCombText(var Msg: TMessage);
begin
if Trim(cText) <> '' then
begin
ComboBox1.Text := cText;
ComboBox1.SelectAll;
cText := '';
end;
end;end.