- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 DELPHI XE5 上创建了这个函数,它工作得很好。您创建一个包含所有图标的图像,将此图像加载到 TBitmap(在我的示例中为 IDE),然后在表单中创建许多小的 TRECTANGLE。
在onCreate期间,我调用Mapping方法来设置每个Trectangle的背景。
但在 DELPHI XE8 中,它不适用于 ANDROID
这是映射函数。
Procedure TForm1.Mapping(Const Obj:TRectangle;Const ofx,ofy:Integer);
Var
Arect : TRectF;
FBitmap : TBitmap;
Begin
Arect:=TRectF.Create(0,0,Obj.Width,Obj.Height);
Obj.Stroke.Kind := TBrushKind.None;
Obj.Fill.Kind := TBrushKind.Bitmap;
Obj.Fill.Bitmap.WrapMode := TWrapMode.TileOriginal;
//Create Crop Bitmap
FBitmap:=TBitmap.create( Round(Obj.Width), Round(Obj.Height)) ;
Try
FBitmap.Canvas.BeginScene();
FBitmap.Canvas.ClearRect(ARect,StringToAlphaColor('$00000000'));
FBitmap.Canvas.DrawBitmap(IDE,
TRectF.Create(ofx,ofy,ofx+Obj.Width,ofy+Obj.Height),
Arect, 100) ;
FBitmap.Canvas.EndScene;
//Assign Crop image to Rectangle object
Obj.Fill.Bitmap.Bitmap.Assign(FBitmap);
Finally
FBitmap.Free;
End;
End;
图片(delphiXE.png)正在“asset/internal”中部署,并在oncreate中打开。
procedure TForm1.FormCreate(Sender: TObject);
Var Mfile:String;
begin
IDE := TBitmap.Create(ClientWidth,ClientHeight);
{$IFDEF ANDROID}
Mfile:=TPath.Combine(TPath.GetDocumentsPath, 'delphiXE.png');
{$ELSE}
Mfile:=TPath.Combine(ExtractFilePath(ParamStr(0)), 'delphiXE.png');
{$ENDIF}
If FileExists(MFile)
Then begin
IDE.LoadFromFile(MFile);
Mapping(Logo,0,0);
End
Else ShowMessage('NO '+MFile);
end;
在 Windows 中,一切正常,但在 Android 中却不行,但是如果我使用 Mapping(Logo,0,0) 添加一个简单的 onclick 事件;调用,映射工作,但我需要先单击灰色 Trectangle 将其设置为背景
有什么想法吗?
更新:使用计时器时,映射功能正常工作并且矩形具有良好的图片,但如果我切换到另一个应用程序并返回到我的应用程序,图片消失并且矩形变回纯灰色。
这意味着 TRectangle 的内部绘制没有更新。为什么?
最佳答案
感谢您的帮助,我找到了解决方案和问题的根源。
Trectangle 中的图片不持久这一事实帮助了我。
//Assign Crop image to Rectangle objects
Obj.Fill.Bitmap.Bitmap.Assign(FBitmap);
不再像在 Android 上的 DELPHI XE5 上那样工作。它复制位图,但不是以持久的方式。这就是为什么它与 onclick 一起工作,但在我切换应用程序时消失的原因。
所以,我把这一行改成了
// Force the size of TRectangle internal Bitmap
Obj.Fill.Bitmap.Bitmap.SetSize(FBitmap.Width,FBitmap.Height);
// Copy the crop bitmap in TRectangle Internal Bitmap
Obj.Fill.Bitmap.Bitmap.CopyFromBitmap(FBitmap);
在我的测试项目中,它正在运行。
我希望这可以帮助其他开发者。
关于android - 德尔福XE8 : No refresh for TRectangle on Android during OnCreate event,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29584789/
我正在构建一个使用 Oracle 数据库 10g 作为数据库后端的 Web 应用程序。我意识到 Express 版本有限制,但我只是想确保连接数不是其中之一。 Oracle 快捷版 (XE) 是否限制
我是一名开始使用 Oracle 数据库的新手,在将 Oracle XE 11g x64 的最新版本安装到 Microsoft Windows 7 x64 Enterprise 时遇到了问题。 安装过程
我有一个 USB 连接到 device发出串行信息。当我运行下面的 Python 脚本(在 Jupyter Notebook 中)时,我从中得到了奇怪的信息。 import serial ser =
我们有一台运行 Delphi XE Professional 的机器,它会在 IDE 中键入时更改某些键的值。它将字母和数字键更改为数字。按下下一个键将按顺序输入下一个数字,直到 9,然后从 0 重新
从昨天开始,我的源代码中的所有蓝点(编译行)都移动了一行。因此,第一个点从“var”而不是“begin”开始,最后一个点是函数最后一个“end”之前的一行。 我删除了除 DPR、PAS、DFM 和 D
我在 RegexBuddy 中构建了一个匹配模式,其行为完全符合我的预期。但我无法将其转移到 Delphi XE,至少在使用最新内置的 TRegEx 或 TPerlRegEx 时是这样。 我的现实世界
TBytes 变量的正确使用模式是什么?根据我的理解,TBytes不是一个类,而是一个“动态字节数组”。我不确定内存在哪里分配,何时释放,以及将其从生产者传递到消费者的最佳方式是什么。我希望我的生产者
我创建了一个自定义 MSBuild .targets我通过 IDE 将其包含在 Delphi XE 项目中,并从项目管理器的上下文菜单中启用它。尽管文件有效,但在我重新保存项目文件后它总是被禁用。 这
有谁知道 http://reportman.sourceforge.net/可用于 Delphi XE 吗? 最佳答案 我已经成功获得Reportmanager 2.9b通过将以下行添加到文件 rpc
Oracle XE Oracle是这样介绍XE的:11g XE(Express Edition)简化版是在Oracle11gR2基础之上一个入门级的小体量数据库,免费用于开发/部署与发布,下载很快
我已经安装了 docker 在 Ubuntu 21.10 并跟随官方 instructions 我拉甲骨文 11g xe 图片:docker pull oracleinanutshell/oracle
一段时间以来,我一直在寻找解决问题的方法,但似乎没有任何效果,这是我重新安装之前的最后一次尝试。 我今天通过其安装向导安装了 Oracle XE 11g 第 2 版,并且一切顺利。我似乎遇到的麻烦是我
我需要模拟汽车在平方区域上移动(比方说)。 任何人都可以轻松想象计算(x/y 坐标、轨迹、速度、加速度、暂停......) 之前的版本(跨千年错误开发...... 21 年前)运行到 Applicat
我已经下载了适用于 Windows 64 位的 Oracle XE 18c,并尝试将其安装在 Windows 10 机器上。我检查了 SHA-256 校验和,它是正确的。 安装开始正常,但是当它复制新
我需要通过客户端操作删除服务器上的物理文件,然后将文件删除事件通知远程数据库-希望这完全在serverSide上发生。 更高版本的Delphi公开了许多以前在WinAPI调用中被锁定的目录服务。目前,
这几年来我一直没有使用Delphi(我使用的最新版本是D2005),现在我需要在DelphiXE中做一些工作。我的问题是,如何在Delphi IDE中禁用声明包装?目前,我使用Modelmaker的代
如何打开应用程序初始化所在的程序单元?我需要进行一些更改。 另外,除了显示的当前单位以外,还可以在程序中搜索所有单位吗? Delphi 5有一个弹出窗口,您可以选择它。 最佳答案 每个项目均由sing
如何配置Datasnap REST服务器(在Windows上作为服务运行)以处理Delphi XE中的https调用?周围有什么好的例子吗? 向上的Delphi XE2似乎具有其他组件-这是否意味着X
我尝试以这种方式列出程序: type TProc = procedure of object; TMyClass=class private fList:Tlist; function getItem
我刚刚发现了 Delphi 的实时绑定(bind)。并创建了我的第一个组件来处理变频器的控制字。该组件本身似乎在表单设计器中测试它效果很好。但是,编译和运行应用程序不起作用。来自 livbinding
我是一名优秀的程序员,十分优秀!