DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: laidabin
今日帖子: 1
在线用户: 3
导航: 论坛 -> 报表专区 斑竹:sunyesy,iamdream  
作者:
男 aknightchen (.) ★☆☆☆☆ -
盒子活跃会员
2023/1/7 11:32:54
标题:
分享:  如何设置fastReport设计时的首次默认字体 ( 原先默认是Arial, 有点难看) 浏览:1016
加入我的收藏
楼主: 单元: frxDesgn.pas


procedure TSampleFormat.Clear;
begin
  if FMemo <> nil then
    FMemo.Free;
  FMemo := TfrxMemoView.Create(nil);
  if frxDesignerComp <> nil then
  begin
    FMemo.Font := frxDesignerComp.DefaultFont;


    //修改fastReport默认字体----------begin----------

    //原本我尝试设置frxDesignerComp.DefaultFont,但这个会在初始化时,它会恢复回Arial字体,
    //因为,我认为frxDesignerComp.DefaultFont是无效的,所以,还是在这里直接改默认字体更合适

    //设置默认字体  暂时好像FDefaultFont这个代码无效果
    if Screen.Fonts.IndexOf('新宋体')>=0 then
    begin
      FMemo.Font.Name:='新宋体';
      FMemo.Font.Size:=9;
    end
    else if Screen.Fonts.IndexOf('Tahoma')>=0 then
    begin
      FMemo.Font.Name:='Tahoma';
      FMemo.Font.Size:=9;
    end ;
    //修改fastReport默认字体---------- end ----------







    FMemo.RTLReading := frxDesignerComp.RTLLanguage;
    FMemo.ParentFont := frxDesignerComp.MemoParentFont;
  end;
end;
----------------------------------------------
...
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2023/1/8 1:34:02
1楼: do you try this:

procedure TForm1.frxReport1BeginDoc(Sender: TObject); // before "Begin Doc" to write values on report
begin
  for var i: Integer := 0 to (frxReport1.ComponentCount - 1) do
    if (frxReport1.Components[i] is TfrxMemoView) then
      begin
        TfrxMemoView(frxReport1.Components[i]).Font.Name  := 'Arial Bold';
        TfrxMemoView(frxReport1.Components[i]).Font.Color := clRed;
      end;
end;
此帖子包含附件:
PNG 图像
大小:12.6K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 sxqwhxq (步惊云) ★☆☆☆☆ -
普通会员
2023/1/8 9:27:24
2楼: 别老想着改源代码
----------------------------------------------
-
作者:
男 aknightchen (.) ★☆☆☆☆ -
盒子活跃会员
2023/1/9 14:51:23
3楼: 作者毕竟精力有限, 有些源码, 整体很棒, 但有一点点小瑕, 还要要改一改

不过, 改的地方, 都会加一个固定标志, 
下次升级时, 再按这个标志, 重新在新版代码中加上就是.
----------------------------------------------
...
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS