델파이/Components

델파이 TComboBox 오른쪽 정렬

지병철 2011. 11. 19. 12:38

procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
   Rect: TRect; State: TOwnerDrawState) ;
var
   x: Integer;
   txt: String;
begin
   with ComboBox1 do
   begin
     Canvas.FillRect(Rect) ;
     txt := Items[Index];
     x := Rect.Right - Canvas.TextWidth(txt) - 4;
     Canvas.TextOut(x, Rect.Top, txt) ;
   end;

end;