zoukankan      html  css  js  c++  java
  • Delphi XE2 之 FireMonkey 入门(42) 控件基础: TComboBox、TComboEdit


    TListBox 有两个兄弟 TComboListBox、TComboEditListBox;
    TComboBox、TComboEdit 虽不是不是从它们继承, 但分别包含了它们, 所以使用起来都有点像 TListBox.

    TComboBox 更像 TListBox, 比 TComboEdit 多出了 Selected 等成员;
    TComboEdit 是从 TCustomEdit 继承, 和 TEdit 是兄弟, 比 TComboBox 多出了 Text 等成员.

    它们的公共常用属性:
    DropDownCount //下拉列表行的数
    ItemHeight    //
    ItemIndex     //
    Items         //
    Count         //
    


    测试:

    procedure TForm1.FormCreate(Sender: TObject);
    var
      i: Integer;
    begin
      { ComboBox1 }
      for i := 0 to 9 do
        ComboBox1.Items.Add(Format('Item_%d', [i]));
      with ComboBox1 do
      begin
        ItemIndex := 0;
        DropDownCount := 5;
        ListBox.UseSmallScrollBars := True;
        TListBox(ListBox).AlternatingRowBackground := True; //这个兄弟转换用得有点悬, 只是为了让 AlternatingRowBackground 属性暴露出来
      end;
    
      { ComboEdit1 }
      ComboEdit1.Items.Assign(ComboBox1.Items);
      with ComboEdit1 do
      begin
        ItemIndex := 0;
        DropDownCount := 5;
        ListBox.UseSmallScrollBars := True;
        TListBox(ListBox).AlternatingRowBackground := True;
      end;
    //  ComboEdit1.Text := 'Text';
    end;
    

  • 相关阅读:
    java8时间处理
    HttpServletRequest
    Elasticsearch简介
    springCloud-Alibaba--Sentinel
    Nacos集群部署:
    nginx安装配置
    hibernate 嵌套事务
    linux下cmake安装mysql 源码
    linux下中文乱码问题解决
    tomcat quartz 被触发两次
  • 原文地址:https://www.cnblogs.com/del/p/2203145.html
Copyright © 2011-2022 走看看