请教各位高手,如何才能使combobox中显示出本机的所有字体?就像word的字体选择一样。 ComboBox1.Items := Screen.Fonts; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 将ComboBox1的Style属性设为csOwnerDrawFixed;procedure TForm1.FormCreate(Sender: TObject);begin ComboBox1.Items.Assign(Screen.Fonts);end;procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);begin with ComboBox1 do begin Canvas.FillRect(Rect); Canvas.Font.Name := Items[Index]; Canvas.TextOut(Rect.Left + 2, Rect.Top + 2, Items[Index]); end;end; EnumFontFamilies(DC, nil, @EnumFontsProc, Integer(Pointer(ComboBox1.Items))) function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric; FontType: Integer; Data: Pointer): Integer; stdcall;begin TStrings(Data).Add(LogFont.lfFaceName); Result := 1;end; ComboBox1.Items := Screen.Fonts; 帮我估价,开发出这样的项目,我该向对方要价多少钱? 如何操作事务中的两个相互有关联的表?高手请进!! DELPHI里如何建一个临时表,临时表要怎么命名,才能避免重复? 还是有关MDI中,工具栏合并的问题 怎么出现这个问题的啊! 数据编码问题,急急 用Delphi怎样表达数学式: ① 开X的平方根;② X的-2次方;③ log(X); 一个DWORD型的数据,除以一个DWORD型的数据,我想得到整数部分,如何处理? 请问为什么我的窗口不响应我的消息? 用delphi如何实现这种类似网页的效果?很急!!! 表的查询问题.多多指教 走到这,不进来瞧一下,真的逛为人生!不信,瞧瞧!
begin
ComboBox1.Items.Assign(Screen.Fonts);
end;procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
with ComboBox1 do
begin
Canvas.FillRect(Rect);
Canvas.Font.Name := Items[Index];
Canvas.TextOut(Rect.Left + 2, Rect.Top + 2, Items[Index]);
end;
end;
FontType: Integer; Data: Pointer): Integer; stdcall;
begin
TStrings(Data).Add(LogFont.lfFaceName);
Result := 1;
end;