FoxUI在线文档

关于FoxUI组件的说明


在标题栏上绘制自定义内容

<p>FoxStdForm提供了OnCaptionPaint事件,我们可以在这个事件里绘制内容。 procedure TForm1.FoxStdForm1FoxCaptionPaint(Sender: TObject; DstBmp: TBitmap32; Arect: TRect);</p> <p>DstBmp 目标图片 Arect 当前Caption区域</p> <p>bmpbank: TFoxUIBMP32Storage;//FoxUI图片存放控件,我们可以把需要的图片以bmp32格式存放在此控件里 方便直接使用 这里注意dpi的兼容问题,我的电脑是dpi 200% 先看看传统的不兼容画法 var bmp:TBitmap32; imgx,imgy:Integer; begin //在标题栏中间画个我们的内容 bmp:=bmpbank.Images[0].Bmp; //不兼容dpi方法 imgx:=(Arect.Width-bmp.Width) div 2; imgy:=4; bmp.DrawTo(dstbmp,imgx,imgy); end; 效果如下 <img src="https://www.showdoc.cc/server/api/common/visitfile/sign/ab835fa2e16e7a657bb1a8ae0e1beb97?showdoc=.jpg" alt="" /></p> <p>明显有问题,图片大小比例不对了</p> <p>看看准确的做法 //兼容画法 iw:=bmp.Width; ih:=bmp.Height; //我目前电脑dpi设的200% if FoxStdForm1.Dfactor&gt;1 then //分辨率高于1 begin iw:=FoxStdForm1.GetValueByDPI(iw); ih:=FoxStdForm1.GetValueByDPI(ih); end;</p> <p>imgrect.Left:=(Arect.Width-iw) div 2; imgrect.Right:=imgrect.Left+iw; imgrect.Top:=FoxStdForm1.GetValueByDPI(4); imgrect.Bottom:=imgrect.Top+ih; bmp.DrawTo(dstbmp,imgrect,bmp.BoundsRect); 运行效果如下 <img src="https://www.showdoc.cc/server/api/common/visitfile/sign/cf11e432da80e35a76831e1d7ac3e502?showdoc=.jpg" alt="" /></p>

页面列表

ITEM_HTML