home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kolekce / d456 / DCSLIB25.ZIP / DCCombo.pas < prev    next >
Pascal/Delphi Source File  |  2001-01-20  |  17KB  |  616 lines

  1. {
  2.  BUSINESS CONSULTING
  3.  s a i n t - p e t e r s b u r g
  4.  
  5.          Components Library for Borland Delphi 4.x, 5.x
  6.          Copyright (c) 1998-2000 Alex'EM
  7.  
  8. }
  9. unit DCCombo;
  10.  
  11. interface
  12.  
  13. uses
  14.   Windows, Messages, Classes, Graphics, Controls, ComCtrls, StdCtrls,
  15.   SysUtils, DCEditTools, DCChoice, DCEditButton, DCConst;
  16.  
  17. const
  18.   CountValues = 41;
  19.   CountStdColors = 16;
  20.  
  21.   ColorValues: array[0..CountValues-1] of TColor =
  22.     (clBlack, clMaroon, clGreen, clOlive, clNavy, clPurple, clTeal, clGray,
  23.      clSilver, clRed, clLime, clYellow, clBlue, clFuchsia, clAqua, clWhite,
  24.      clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu,
  25.      clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText,
  26.      clActiveBorder, clInactiveBorder, clAppWorkSpace, clHighlight,
  27.      clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText,
  28.      clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight,
  29.      clInfoText ,clInfoBk);
  30.  
  31.  
  32. type
  33.   TDropDownStyle = (clsDropDown, clsDropDownList);
  34.   TFontOption    = (foTrueTypeOnly, foFixedPitchOnly);
  35.   TFontOptions   = set of TFontOption;
  36.  
  37.   TFontTypeImages = array[0..2] of TBitmap;
  38.  
  39.   TDCColorComboBox = class(TDCCustomComboBox)
  40.   private
  41.     FDropDownStyle: TDropDownStyle;
  42.     FColorValue: TColor;
  43.     FColorWidth: integer;
  44.     FInButtonArea: boolean;
  45.     FShowOnlyColor: boolean;
  46.     procedure SetDropDownWidth;
  47.     procedure InitItems(OnlyStandartColor: boolean);
  48.     procedure SetDropDownStyle(const Value: TDropDownStyle);
  49.     procedure SetColorValue(const Value: TColor);
  50.     procedure SetColorWidth(const Value: integer);
  51.     procedure DrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
  52.       State: TOwnerDrawState);
  53.     procedure DrawColorBitmap(Control: TWinControl; R: TRect;
  54.       Index: Integer; Bitmap: TBitmap);
  55.     procedure DrawColorItem(ACanvas:TCanvas; R: TRect; AColor: TColor;
  56.       Text: string; Tag: integer = 0);
  57.     procedure DrawColor(ACanvas:TCanvas; ARect: TRect; AColor: TColor;
  58.       ATransparent: boolean = False);
  59.     procedure FormatColor(AColor: integer);
  60.     procedure SetShowOnlyColor(const Value: boolean);
  61.     procedure DoDrawText(ACanvas: TCanvas; Control: TWinControl; Index: Integer;
  62.      Rect: TRect;  State: TOwnerDrawState);
  63.   protected
  64.     procedure WMPaint (var Message: TWMPaint); message WM_PAINT;
  65.     procedure WMSize(var Message: TWMSize); message WM_SIZE;
  66.     procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
  67.     procedure WMLButtonDblClk(var Message: TWMLButtonDown); message WM_LBUTTONDBLCLK;
  68.     procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
  69.     procedure Change; override;
  70.     procedure GetHintOnError; override;
  71.   public
  72.     constructor Create(AOwner: TComponent); override;
  73.     procedure KillFocus(var Value: boolean); override;
  74.   published
  75.     property DropDownStyle: TDropDownStyle read FDropDownStyle  write SetDropDownStyle;
  76.     property ColorValue: TColor read FColorValue write SetColorValue;
  77.     property ColorWidth: integer read FColorWidth write SetColorWidth;
  78.     property DrawStyle;
  79.     property OnlyStdColors: boolean read FShowOnlyColor write SetShowOnlyColor;
  80.     property OnIndexChange;
  81.   end;
  82.  
  83.   TDCFontComboBox = class(TDCCustomComboBox)
  84.   private
  85.     FDropDownStyle: TDropDownStyle;
  86.     FOptions: TFontOptions;
  87.     FFontTypeImages: TFontTypeImages;
  88.     procedure SetDropDownWidth;
  89.     procedure InitItems;
  90.     function GetFontName: string;
  91.     procedure SetDropDownStyle(const Value: TDropDownStyle);
  92.     procedure SetFontName(const Value: string);
  93.     procedure SetOptions(const Value: TFontOptions);
  94.     procedure DrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
  95.       State: TOwnerDrawState);
  96.     procedure DrawFontItem(ACanvas:TCanvas; R: TRect; FontType: integer;
  97.       Text: string; Tag: integer = 0);
  98.     procedure DrawFont(ACanvas:TCanvas; ARect: TRect; FontType: integer);
  99.   protected
  100.     procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
  101.     procedure WMSize(var Message: TWMSize); message WM_SIZE;
  102.   public
  103.     constructor Create(AOwner: TComponent); override;
  104.     destructor Destroy; override;
  105.   published
  106.     property FontName: string read GetFontName write SetFontName;
  107.     property DropDownStyle: TDropDownStyle read FDropDownStyle  write SetDropDownStyle;
  108.     property Options: TFontOptions read FOptions write SetOptions;
  109.     property DrawStyle;
  110.     property OnIndexChange;
  111.   end;
  112.  
  113. implementation
  114.   uses Printers, Dialogs;
  115.  
  116. {$R DCCombo.RES}
  117.  
  118. { TDCColorComboBox }
  119.  
  120. procedure TDCColorComboBox.Change;
  121. begin
  122.   if Parent <> nil then
  123.   begin
  124.     DrawBitmap(ItemIndex);
  125.     RedrawBorder(False, 0);
  126.   end;
  127.   inherited;
  128. end;
  129.  
  130. procedure TDCColorComboBox.CMFontChanged(var Message: TMessage);
  131. begin
  132.   inherited;
  133.   SetDropDownWidth;
  134. end;
  135.  
  136. constructor TDCColorComboBox.Create(AOwner: TComponent);
  137. begin
  138.   inherited;
  139.  
  140.   FShowOnlyColor:= False;
  141.   DropDownStyle := clsDropDown;
  142.   ColorWidth    := 20;
  143.  
  144.   OnDrawItem   := DrawItem;
  145.   OnDrawBitmap := DrawColorBitmap;
  146.   OnDrawText   := DoDrawText;
  147.  
  148.   InitItems(FShowOnlyColor);
  149.   SetDropDownWidth;
  150.  
  151.   ColorValue  := clBlack;
  152. end;
  153.  
  154. procedure TDCColorComboBox.DrawColor(ACanvas: TCanvas; ARect: TRect;
  155.   AColor: TColor; ATransparent: boolean = False);
  156.  var
  157.   SColor: TColor;
  158. begin
  159.   with ACanvas do
  160.   begin
  161.     SColor := Brush.Color;
  162.     if ATransparent then
  163.     begin
  164.       Brush.Color:= clWhite;
  165.       FillRect(ARect);
  166.     end;
  167.     InflateRect(ARect, -1, -1);
  168.     Pen.Color   := clBtnShadow;
  169.     Brush.Color := AColor;
  170.     Rectangle(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom);
  171.     Brush.Color := SColor;
  172.   end;
  173. end;
  174.  
  175. procedure TDCColorComboBox.DrawColorBitmap(Control: TWinControl; R: TRect;
  176.   Index: Integer; Bitmap: TBitmap);
  177.  var
  178.   AColor: TColor;
  179.   i:integer;
  180. begin
  181.   if Index <> -1 then
  182.     AColor := StringToColor(Items.Strings[Index])
  183.   else
  184.   begin
  185.     i :=  StrToInt64Def(Text, clWhite);
  186.     AColor := TColor(i);
  187.   end;
  188.  
  189.   with Bitmap do
  190.   begin
  191.     Height    := ClientHeight;
  192.     R.Bottom  := Height;
  193.     DrawColor(Canvas, R, AColor, True);
  194.   end;
  195.   FColorValue := AColor;
  196. end;
  197.  
  198. procedure TDCColorComboBox.DrawColorItem(ACanvas:TCanvas; R: TRect;
  199.   AColor: TColor; Text: string; Tag: integer = 0);
  200.  var
  201.   ARect: TRect;
  202.   AOffsetX: integer;
  203. begin
  204.   case DrawStyle of
  205.     fsNone: AOffsetX := 0;
  206.     fsFlat: AOffsetX := 1;
  207.     else AOffsetX := 2;
  208.   end;
  209.   if Tag = 1 then Dec(AOffsetX, 1);
  210.  
  211.   if FShowOnlyColor and (FDropDownStyle = clsDropDownList) then
  212.     DrawColor(ACanvas, R, AColor)
  213.   else begin
  214.     ACanvas.FillRect(R);
  215.     ARect := Classes.Rect(R.Left+AOffsetX, R.Top, R.Left+AOffsetX+FColorWidth,
  216.       R.Bottom);
  217.     DrawColor(ACanvas, ARect, AColor);
  218.     R.Left := R.Left +4+ FColorWidth;
  219.     Windows.DrawText(ACanvas.Handle, PChar(Text), Length(Text), R, 0);
  220.   end;
  221. end;
  222.  
  223. procedure TDCColorComboBox.DrawItem(Control: TWinControl; Index: Integer;
  224.   Rect: TRect; State: TOwnerDrawState);
  225. begin
  226.   if Index <> -1 then
  227.    DrawColorItem(Canvas, Rect, StringToColor(Items.Strings[Index]),
  228.       Items.Strings[Index])
  229. end;
  230.  
  231. procedure TDCColorComboBox.InitItems(OnlyStandartColor: boolean);
  232.  var
  233.   i: integer;
  234. begin
  235.   Items.Clear;
  236.   if not OnlyStandartColor then
  237.     for i := 0 to CountValues-1 do
  238.       Items.Add(ColorToString(ColorValues[i]))
  239.   else
  240.     for i := 0 to CountStdColors-1 do
  241.       Items.Add(ColorToString(ColorValues[i]))
  242. end;
  243.  
  244. procedure TDCColorComboBox.SetDropDownStyle(const Value: TDropDownStyle);
  245. begin
  246.   FDropDownStyle := Value;
  247.   case FDropDownStyle of
  248.     clsDropDown    :
  249.       begin
  250.         Style := csDropDown;
  251.         ShowCheckBox := True;
  252.         OnDrawBitmap := DrawColorBitmap;
  253.       end;
  254.     clsDropDownList:
  255.       begin
  256.         Style := csDropDownList;
  257.         ShowCheckBox := False;
  258.         OnDrawBitmap :=  nil;
  259.         Text := ColorToString(ColorValue);
  260.       end;
  261.   end;
  262. end;
  263.  
  264. procedure TDCColorComboBox.SetColorValue(const Value: TColor);
  265.  var
  266.   i: integer;
  267. begin
  268.   ItemIndex  := -1;
  269.   FColorValue := Value;
  270.   for i := 0 to Items.Count-1 do
  271.     if StringToColor(Items.Strings[i]) = Value then
  272.     begin
  273.       ItemIndex := i;
  274.       Break;
  275.     end;
  276.   if (ItemIndex = -1) then  FormatColor(FColorValue);
  277. end;
  278.  
  279. procedure TDCColorComboBox.SetColorWidth(const Value: integer);
  280. begin
  281.   FColorWidth := Value;
  282.   CheckGlyph.Width := FColorWidth;
  283.   SetDropDownWidth;
  284.   Invalidate;
  285. end;
  286.  
  287. procedure TDCColorComboBox.SetDropDownWidth;
  288. begin
  289.   DropDownWidth := GetDCTextWidth(Font, 'clInactiveCaptionText') +
  290.                    GetSystemMetrics(SM_CXVSCROLL) + 8;
  291.   case FDropDownStyle of
  292.     clsDropDown    : DropDownWidth := DropDownWidth + FColorWidth + 2;
  293.     clsDropDownList: if OnlyStdColors then DropDownWidth := 0;
  294.   end;
  295.   if DropDownWidth < Width then DropDownWidth := 0;
  296. end;
  297.  
  298. procedure TDCColorComboBox.WMPaint(var Message: TWMPaint);
  299. begin
  300.   inherited;
  301. end;
  302.  
  303. procedure TDCColorComboBox.WMSize(var Message: TWMSize);
  304. begin
  305.   inherited;
  306.   if DropDownWidth < Width then DropDownWidth := 0;
  307. end;
  308.  
  309. procedure TDCColorComboBox.KillFocus(var Value: boolean);
  310.  var
  311.   i, j: integer;
  312. begin
  313.   if not Value then begin
  314.     if ItemIndex = -1 then
  315.     begin
  316.       i :=  StrToInt64Def(Text, -1);
  317.       if i = -1 then
  318.       begin
  319.         Value := True;
  320.         ErrorCode := ERR_EDIT_INCORRECTDEC;
  321.       end
  322.       else begin
  323.         for j := Low(ColorValues) to High(ColorValues) do
  324.         begin
  325.           if ColorToRGB(ColorValues[j]) = i then
  326.           begin
  327.             ItemIndex := j;
  328.             Exit;
  329.           end;
  330.         end;
  331.         FormatColor(i);
  332.       end;
  333.     end;
  334.   end;
  335.   inherited;
  336. end;
  337.  
  338. procedure TDCColorComboBox.GetHintOnError;
  339. begin
  340.   case ErrorCode of
  341.     ERR_EDIT_INCORRECTDEC: ErrorHint := LoadStr(RES_EDIT_ERR_DEC);
  342.     else
  343.       ErrorHint := '';
  344.   end;
  345. end;
  346.  
  347. procedure TDCColorComboBox.WMLButtonDblClk(var Message: TWMLButtonDown);
  348. begin
  349.   if not FInButtonArea and not(FDropDownStyle = clsDropDownList) then
  350.   begin
  351.     Message.Result := $AE;
  352.     inherited WMLButtonDblClk(Message);
  353.  
  354.     with TColorDialog.Create(Self) do
  355.     begin
  356.       Color := ColorValue;
  357.       Execute;
  358.       ColorValue := Color;
  359.       Free;
  360.     end;
  361.   end
  362.   else begin
  363.     Message.Result := $AE;
  364.     inherited WMLButtonDblClk(Message);
  365.   end;
  366. end;
  367.  
  368. procedure TDCColorComboBox.WMNCHitTest(var Message: TWMNCHitTest);
  369.  var
  370.   P: TPoint;
  371. begin
  372.   inherited;
  373.   P := Self.ScreenToClient(Point(Message.XPos, Message.YPos));
  374.  
  375.   if BtnChoiceAssigned and (P.X >= (Width - ButtonWidth - 2)) then
  376.     FInButtonArea := True
  377.   else
  378.     FInButtonArea := False;
  379.  
  380.   inherited;
  381. end;
  382.  
  383. procedure TDCColorComboBox.FormatColor(AColor: Integer);
  384.  var
  385.   j, i: integer;
  386. begin
  387.   Text := Format('%x', [AColor]);
  388.   if Length(Text) < 8 then
  389.   begin
  390.     j := Length(Text);
  391.     for i := 1 to 8 - j do Text := '0' + Text;
  392.   end;
  393.   Text := '$' + Text;
  394. end;
  395.  
  396. procedure TDCColorComboBox.SetShowOnlyColor(const Value: boolean);
  397. begin
  398.   FShowOnlyColor := Value;
  399.   InitItems(FShowOnlyColor);
  400.   SetDropDownWidth;
  401. end;
  402.  
  403. procedure TDCColorComboBox.DoDrawText(ACanvas: TCanvas; Control: TWinControl;
  404.   Index: Integer; Rect: TRect; State: TOwnerDrawState);
  405. begin
  406.   Rect.Bottom := Rect.Bottom + 1;
  407.   DrawColorItem(ACanvas, Rect, StringToColor(Items.Strings[Index]),
  408.      Items.Strings[Index])
  409. end;
  410.  
  411. { TDCFontComboBox }
  412.  
  413. function RequestedFont(Data: Pointer; LogFont: TLogFont; FontType: Integer): boolean;
  414. var
  415.   FontCombo: TDCFontComboBox;
  416. begin
  417.   Result := True;
  418.   FontCombo := TDCFontComboBox(Data);
  419.   if foTrueTypeOnly in FontCombo.Options then
  420.     Result := Result and (FontType and TRUETYPE_FONTTYPE = TRUETYPE_FONTTYPE);
  421.   if foFixedPitchOnly in FontCombo.Options then
  422.     Result := Result and (LogFont.lfPitchAndFamily and FIXED_PITCH = FIXED_PITCH);
  423. end;
  424.  
  425. function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
  426.   FontType: Integer; Data: Pointer): Integer; stdcall;
  427. var
  428.   S: TStrings;
  429.   FaceName: string;
  430. begin
  431.   S := TDCFontComboBox(Data).Items;
  432.   FaceName := LogFont.lfFaceName;
  433.   if (S.IndexOf(FaceName) < 0) and RequestedFont(Data, LogFont,FontType) then
  434.     S.AddObject(FaceName, TObject(FontType));
  435.   Result := 1;
  436. end;
  437.  
  438. procedure TDCFontComboBox.CMFontChanged(var Message: TMessage);
  439. begin
  440.   inherited;
  441.   SetDropDownWidth
  442. end;
  443.  
  444. constructor TDCFontComboBox.Create(AOwner: TComponent);
  445. begin
  446.   inherited;
  447.   InitItems;
  448.   DropDownStyle  := clsDropDown;
  449.  
  450.   OnDrawItem   := DrawItem;
  451.  
  452.   FFontTypeImages[0] := TBitmap.Create;
  453.   FFontTypeImages[1] := TBitmap.Create;
  454.   FFontTypeImages[2] := TBitmap.Create;
  455.  
  456.   FFontTypeImages[0].LoadFromResourceName(HInstance, 'DC_RASTER_FONT');
  457.   FFontTypeImages[1].LoadFromResourceName(HInstance, 'DC_DEVICE_FONT');
  458.   FFontTypeImages[2].LoadFromResourceName(HInstance, 'DC_TRUETYPE_FONT');
  459.  
  460.   TStringList(Items).Sorted := True;
  461.   CheckGlyph.Width := FFontTypeImages[0].Width;
  462.   
  463.   SetDropDownWidth;
  464. end;
  465.  
  466. destructor TDCFontComboBox.Destroy;
  467. begin
  468.   FFontTypeImages[0].Free;
  469.   FFontTypeImages[1].Free;
  470.   FFontTypeImages[2].Free;
  471.   inherited;
  472. end;
  473.  
  474. procedure TDCFontComboBox.DrawFont(ACanvas: TCanvas; ARect: TRect;
  475.   FontType: integer);
  476.  var
  477.   Bitmap: TBitmap;
  478. begin
  479.   with ACanvas do
  480.   begin
  481.     Bitmap := nil;
  482.     if FontType <> -1 then
  483.     begin
  484.       if FontType and RASTER_FONTTYPE = RASTER_FONTTYPE then
  485.         Bitmap := FFontTypeImages[0];
  486.       if FontType and DEVICE_FONTTYPE = DEVICE_FONTTYPE then
  487.         Bitmap := FFontTypeImages[1];
  488.       if FontType and TRUETYPE_FONTTYPE = TRUETYPE_FONTTYPE then
  489.         Bitmap := FFontTypeImages[2];
  490.     end;
  491.     if Bitmap <> nil then
  492.       BrushCopy(Bounds(ARect.Left, ARect.Top, Bitmap.Width, Bitmap.Height),
  493.          Bitmap, Bounds(0, 0, Bitmap.Width, Bitmap.Height),
  494.          Bitmap.Canvas.Pixels[0,0])
  495.     else
  496.       FillRect(ARect);
  497.   end;
  498. end;
  499.  
  500. procedure TDCFontComboBox.DrawFontItem(ACanvas: TCanvas; R: TRect;
  501.   FontType: integer; Text: string; Tag: integer);
  502.  var
  503.   ARect: TRect;
  504.   AOffsetX: integer;
  505. begin
  506.   case DrawStyle of
  507.     fsNone: AOffsetX := 0;
  508.     fsFlat: AOffsetX := 1;
  509.     else AOffsetX := 2;
  510.   end;
  511.   if Tag = 1 then Dec(AOffsetX, 1);
  512.  
  513.   ACanvas.FillRect(R);
  514.   ARect := Classes.Rect(R.Left+AOffsetX, R.Top,
  515.     R.Left+AOffsetX+FFontTypeImages[0].Width, R.Bottom);
  516.   DrawFont(ACanvas, ARect, FontType);
  517.   R.Left := R.Left +4+ FFontTypeImages[0].Width;
  518.   Windows.DrawText(ACanvas.Handle, PChar(Text), Length(Text), R, 0);
  519. end;
  520.  
  521. procedure TDCFontComboBox.DrawItem(Control: TWinControl; Index: Integer;
  522.   Rect: TRect; State: TOwnerDrawState);
  523. begin
  524.   DrawFontItem(Canvas, Rect, Integer(Items.Objects[Index]),
  525.     Items.Strings[Index])
  526. end;
  527.  
  528. function TDCFontComboBox.GetFontName: string;
  529. begin
  530.   if ItemIndex > 0 then Result := Items.Strings[ItemIndex];
  531. end;
  532.  
  533. procedure TDCFontComboBox.InitItems;
  534.  var
  535.   DC: HDC;
  536.   LFont: TLogFont;
  537. begin
  538.   Items.Clear;
  539.   DC := GetDC(0);
  540.   try
  541.     if Lo(GetVersion) >= 4 then
  542.     begin
  543.       FillChar(LFont, sizeof(LFont), 0);
  544.       LFont.lfCharset := DEFAULT_CHARSET;
  545.       EnumFontFamiliesEx({Printer.Handle}DC, LFont, @EnumFontsProc, LongInt(Self), 0);
  546.     end
  547.     else
  548.       EnumFonts(DC, nil, @EnumFontsProc, Pointer(Items));
  549.   finally
  550.     ReleaseDC(0, DC);
  551.   end;
  552. end;
  553.  
  554. procedure TDCFontComboBox.SetDropDownStyle(const Value: TDropDownStyle);
  555. begin
  556.   FDropDownStyle := Value;
  557.   case FDropDownStyle of
  558.     clsDropDown    :
  559.       begin
  560.         Style := csDropDown;
  561.         ShowCheckBox := True;
  562.       end;
  563.     clsDropDownList:
  564.       begin
  565.         Style := csDropDownList;
  566.         ShowCheckBox := False;
  567.         Text := FontName;
  568.       end;
  569.   end;
  570. end;
  571.  
  572. procedure TDCFontComboBox.SetDropDownWidth;
  573.  var
  574.   i, MaxWidth, CurWidth: integer;
  575.   ACanvas: TCanvas;
  576. begin
  577.   MaxWidth := Width;
  578.   ACanvas := TControlCanvas.Create;
  579.   ACanvas.Handle := GetDC(0);
  580.   ACanvas.Font := Font;
  581.   try
  582.     for i:= 0 to Items.Count - 1 do
  583.     begin
  584.       CurWidth := GetTextWidth(ACanvas.Handle, Items.Strings[i]) +
  585.                   FFontTypeImages[0].Width + 8 + GetSystemMetrics(SM_CXVSCROLL);
  586.       if CurWidth > MaxWidth then MaxWidth := CurWidth;
  587.     end;
  588.     DropDownWidth := MaxWidth;
  589.   finally
  590.     ReleaseDC(0, ACanvas.Handle);
  591.     ACanvas.Free;
  592.   end
  593. end;
  594.  
  595. procedure TDCFontComboBox.SetFontName(const Value: string);
  596. begin
  597.   if FontName <> Value then
  598.   begin
  599.     ItemIndex := Items.IndexOf(Value);
  600.   end;
  601. end;
  602.  
  603. procedure TDCFontComboBox.SetOptions(const Value: TFontOptions);
  604. begin
  605.   FOptions := Value;
  606.   InitItems;
  607. end;
  608.  
  609. procedure TDCFontComboBox.WMSize(var Message: TWMSize);
  610. begin
  611.   inherited;
  612.   if DropDownWidth < Width then DropDownWidth := 0;
  613. end;
  614.  
  615. end.
  616.