如何在Combox中进行多项选择

XTMENG 2011-08-02 11:24:38
比如 combox有三项内容,分别是A,B,C,想实现多次选择,当第一次选择时,combox.text:='A',第二选择时,combox.text:='A'+'B'
依次类推,如何实现???
...全文
437 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
XTMENG 2011-08-03
  • 打赏
  • 举报
回复
请问dinoalex:我装ExpressQuantumGrid4.5版本,发现没有
TcxCheckComboBox这个控件啊,到底是哪个版本有呢???
山东蓝鸟贵薪 2011-08-03
  • 打赏
  • 举报
回复
学习学习中..........................
dinoalex 2011-08-03
  • 打赏
  • 举报
回复
TcxCheckComboBox
oosmile 2011-08-03
  • 打赏
  • 举报
回复
在ComBox中添加Checkbox
add flat checkboxes into a TComboBox and multiselect?
Author: Chrizz
0 Comments to this tip [Write new comment]
[ Print tip ]

Tip Rating (0):




//Set ComboBox.Style:=csOwnerDrawFixed
//tested with D6 and WinXP...

//.....
private
Selected: array of Boolean;
//.....


procedure TTForm1.ComboBox1DrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
SetLength(Selected, TComboBox(Control).Items.Count);
with TComboBox(Control).Canvas do
begin
FillRect(rect);

Rect.Left := Rect.Left + 1;
Rect.Right := Rect.Left + 13;
Rect.Bottom := Rect.Bottom;
Rect.Top := Rect.Top;

if not (odSelected in State) and (Selected[Index]) then
DrawFrameControl(Handle, Rect, DFC_BUTTON,
DFCS_BUTTONCHECK or DFCS_CHECKED or DFCS_FLAT)
else if (odFocused in State) and (Selected[Index]) then
DrawFrameControl(Handle, Rect, DFC_BUTTON,
DFCS_BUTTONCHECK or DFCS_CHECKED or DFCS_FLAT)
else if (Selected[Index]) then
DrawFrameControl(Handle, Rect, DFC_BUTTON,
DFCS_BUTTONCHECK or DFCS_CHECKED or DFCS_FLAT)
else if not (Selected[Index]) then
DrawFrameControl(Handle, Rect, DFC_BUTTON, DFCS_BUTTONCHECK or DFCS_FLAT);

TextOut(Rect.Left + 15, Rect.Top, TComboBox(Control).Items[Index]);
end;
end;

procedure TForm1.ComboBox1Select(Sender: TObject);
var
i: Integer;
Sel: string;
begin
Sel := EmptyStr;
Selected[TComboBox(Sender).ItemIndex] := not Selected[TComboBox(Sender).ItemIndex];
for i := 0 to TComboBox(Sender).Items.Count - 1 do
if Selected[i] then
Sel := Sel + TComboBox(Sender).Items[i] + ' ';
ShowMessage(Sel); //Just for test...
end;
babydog01 2011-08-03
  • 打赏
  • 举报
回复
你要安装devexpress 控件组,不能只安装ExpressQuantumGrid4.5。

5,388

社区成员

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

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