왜 이런 것이 필요한 지는 도통 모르겠으나..
우선 Delphi 및 서브 디랙토리 중 Source\VCL에서..
StdCtrls.Pas를 찾아 보시면..
아래와 같은 곳이 있습니다..
이것을 수정하시면 되는데..
콤포넌트를 다시 등록시켜야 하구..
아니면.. Combobox의 OnDrawItem 이벤트를 이용하면..
될 것 같아요..
하여간 어떤 방법이든 아래의 코드를 참고하시면 됩니다..
(참고적으로 이것은 저도 해보지는 않았습니다..)
procedure TCustomComboBox.DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState);
begin
if Assigned(FOnDrawItem) then FOnDrawItem(Self, Index, Rect, State)
else
begin
FCanvas.FillRect(Rect);
FCanvas.TextOut(Rect.Left + 2, Rect.Top, Items[Index]);
end;
end;
* 수정된 것
procedure TCustomComboBox.DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState);
Var
Loop : Integer;
stTemp : String;
begin
if Assigned(FOnDrawItem) then FOnDrawItem(Self, Index, Rect, State)
else
begin
FCanvas.FillRect(Rect);
stTemp:= Items[Index];
For Loop:= 1 to Length(stTemp) do
Begin
// Random으로 색깔을 지정
FCanvas.Font.Color:= Round(Random(256)) shl 16 +
Round(Random(256)) shl 8 +
Round(Random(256));
FCanvas.TextOut(Rect.Left+(Loop-1)*?+2, Rect.Top, stTemp[Loop]);
End;
end;
end;
?표는 해당 폰트의 크기마다 몇 Pixel인지 계산하는 것을
잊어먹어서리..
현재 제가 한국 내에 없기 때문에 자료구하기가 힘드네요..
|