在一些选择项目中,下拉框的内容的长度比下拉框的宽度长,如何实现鼠标指示的记录的内容全部浮现的功能? PB可以实现,难道DELPHI5.O就不行吗??

解决方案 »

  1.   

    procedure TForm1.SetComboBox(ComboBox:TComboBox);
    var i:integer;
        iCurrentWidth:integer;
        iLen:integer;
        iReaWidth:integer;
        iOff:integer;
    begin
      iLen:=0;
      iOff:=25;
      iCurrentWidth:=combobox.Perform(CB_GETDROPPEDWIDTH,0,0);
      for i:=0 to combobox.Items.Count-1 do
      begin
        if iLen<length(combobox.Items.Strings[i]) then
           iLen:=length(combobox.Items.Strings[i]);
      end;
      iReaWidth:=iLen*canvas.TextWidth('0');
      combobox.Perform(CB_SETDROPPEDWIDTH,iReaWidth+iOff,0);
    end;
      

  2.   

    设置Form和Combobox的ShowHint属性为True,然后在Combobox的OnChange事件中:
    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
      ComboBox1.Hint := ComboBox1.Text;
    end;
      

  3.   

    我需要在下拉的时候,随即产生指向的记录文本 。前一个方法是所有都显示出来了 后一个事件触发是在CLICK一个记录后,对TEXT修改后发生 。我寻找不到合适的事件  各位高手再论
      

  4.   

    就是鼠标下移到一个ITEM时候,停顿就会显示HINT 这个事件怎么找不到呢?