ListBox修改赋值

有办法解决的,用自绘方式,可以触发 OnDrawItem,然后就可以取出当前选择的Item值
1、设置ListBox.Sytle=lbOwnerDrawFixed
2、在 OnDrawItem 事件中编写自绘代码即可


Delphi(Pascal) code
    
    
    
    
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); begin (Control as TListBox).Canvas.FillRect(Rect); (Control as TListBox).Canvas.TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]); Edit1.Text : = ListBox1.Items[Index]; end ; procedure TForm1.FormCreate(Sender: TObject); begin self.ListBox1.Style : = lbOwnerDrawFixed; end ;

你可能感兴趣的:(Integer,Delphi,pascal)