Subscribe:
Selamat Datang di Blog IT, Blog ini berisikan tentang Teknologi Informasi dan Komunikasi serta Gadge

Social Icons

Sample Text

Followers

Featured Posts

Jumat, 07 Desember 2012

Menambahkan Image pada Combo Box

بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ImgList, StdCtrls;

type
TForm1 = class(TForm)
ImageList1: TImageList;
ComboBox1: TComboBox;
procedure ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;


var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
ComboBox1.Canvas.FillRect(Rect);
ImageList1.Draw(ComboBox1.Canvas,Rect.Left,Rect.Top,Index);
ComboBox1.Canvas.TextOut(Rect.Left+ImageList1.Width+2,Rect.Top,
ComboBox1.Items[Index]);
end;

end. 

0 komentar:

Posting Komentar