在 Delphi VCL 中,打印表单很容易,因为表单有一个Print方法。FMX 中的表单似乎并非如此。有没有一种简单的方法可以在 Windows 上的 FMX 中打印表单?
我正在尝试编写一个单独的单元供我的主窗体调用,除了使用TTimer.
基本上,该函数应该做的就是主窗体uDataReceived调用BlinkRect(Gateway)以rRectControl单元形式处理,并且相应的矩形将在主窗体中闪烁。
以下是代码:
unit uRectControl;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants, System.IOUtils, FMX.Graphics, FMX.Types, FMX.Objects;
var
Blinks: array [0 .. 2] of record Rectangle: TRectangle;
Timer: TTimer;
end;
type
TMyClass = Class(TObject)
private
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
public
procedure BlinkRect(Gateway: integer);
end;
procedure AssignRectangles;
implementation
uses uDataReceived;
// Error shows "Cannot resolve unit name 'uDataReceived'
{ TMyClass }
procedure AssignRectangles;
var
i: integer;
begin
Blinks[0].Rectangle := TC_Theft_Detection.rect1;
// Error shows …Run Code Online (Sandbox Code Playgroud) 我在网上找到了很多解决方案,但由于StringGrid1.ColumnCountpeoperty是只读的,所以它们不起作用.我正在使用Delphi 10 Seattle.
我有一个StringGrid1,我需要在运行时添加列.具体来说,我必须根据TList的大小添加列.特别是:
var a: TList<double>;
begin
//fill the TList...
for i := 0 to a.Count - 1 do
begin
StringGrid1.AddColumn(); //how can I do this?
end;
end;
Run Code Online (Sandbox Code Playgroud)
我觉得Lazarus很容易(但它当然有FPC)但是在Delphi上我真的不知道该怎么办.我正在研究Firemonkey.
我的表单中有一个TListBox,我在运行时添加项目如下:
ListBox1.Clear;
//don't care about sol, it is a dynamic array with a size between 1 and 6
ListBox1.BeginUpdate;
for i := Low(sol) to High(sol) do
begin
tmp := TListBoxItem.Create(ListBox1);
tmp.Parent := ListBox1;
tmp.Selectable := false;
tmp.TextSettings.Font.Size := 30; //problem here, it doesn't change the text size
tmp.Text := 'some text';
end;
ListBox1.EndUpdate;
Run Code Online (Sandbox Code Playgroud)
这里tmp变量是a TListBoxItem.一切正常,因为我看到当我按下按钮时,列表框被添加到TListBox中.
问题是我无法改变文字大小.任何的想法?我认为我可能必须将StyledSettingstmp 设置为false,但我无法做到.
我有一个带有连接到 SQLLite 数据库的 TFDConnection 的数据模块。
对数据模块的查询工作正常。但是,如果我在将 Active 设置为 true 时对连接到数据模块上的连接的表单进行查询,则会收到错误消息:
异常消息:[FireDAC][Comp][Clnt]-512。未为 [FDQuery1] 定义连接。可能的原因:Connection 和 ConnectionName 属性值
这发生在设计时。
这是在 Firemonkey 移动应用程序中与 Delphi Tokyo 一起使用的。
我正在运行 Delphi Tokyo,并且正在寻找一种在 Windows 和 Android(也许在某些时候 iOS)上播放音频的方法。
在 Windows 上我可以使用类似的东西PlaySound(PChar(ResourceName), 0, SND_RESOURCE or SND_ASYNC),但我被困在 Android 上。我尝试过 TMediaPlayer,但大约需要一秒钟才能开始播放,这对于单击鼠标或屏幕点击来说太长了。
基本上我已经构建了一个扫雷克隆,并且正在寻找声音支持(如果您想了解背景)。
建议?
当我看到在原来的Delphi源代码(大多在firemonkey)所作的修改,我看到Embarcadero公司的某个时候取代if assigned(MyObj) then的if (MyObj <> nil) then.他们有任何真正的理由这样做,还是仅仅是纯粹的化妆品?
我刚开始开发一个有两种形式的移动应用程序,FRM_Main(主表格)和FRM_Party(派对表格)。我们可以打开FRM_Party从FRM_Main通过点击图片。图片上的代码是:
procedure TFRM_Main.IMAGE_PartyClick(Sender: TObject);
begin
FRM_Party := TFRM_Party.Create(Application);
FRM_Party.Show;
end;
Run Code Online (Sandbox Code Playgroud)
现在,当FRM_Party调用该OnActivate事件时,我将一些数据加载到TMSFMXTableView. 该代码是:
procedure TFRM_Party.FormActivate(Sender: TObject);
var
TableView : TTMSFMXTableViewItem;
I : Integer;
begin
if Class_My_Pro_and_func.Func_DataBaseConnection then // Checks wethere database connection is active or not if not then it connect with database and returns bool value.
Begin
UniQuery.Close;
UniQuery.SQL.Clear;
UniQuery.SQL.Text := 'select * from db_stock.tbl_party where Reg_ID = :Reg_ID and Party_Delete <> :Party_Delete order by Party_Name …Run Code Online (Sandbox Code Playgroud) 我正在尝试从与 .dproj 位于同一目录的文本文件中加载一堆行,但 Delphi 找不到我试图从中读取的文件。代码如下:
procedure TFoPrincipale.Button2Click(Sender: TObject);
var monFich : TextFile;
Sligne : string;
begin
try
AssignFile(monFich, 'docText.txt');
Reset(monFich);
except
showmessage('Le fichier est introuvable');
exit;
end;
while not Eof (monFich) do
begin
Readln(monFich, Sligne);
Memo1.Lines.Add(Sligne);
end;
CloseFile(monFich);
end;
Run Code Online (Sandbox Code Playgroud)
在 FireMonkey (FMX) 中,每个TControl组件都有一个HitTest属性,允许我启用或禁用组件上的鼠标事件。
VCL中有类似的东西吗?我试着寻找它,但我HitTest在任何地方都找不到房产。
如果没有HitTestVCL,如何实现同样的效果呢?有人可以提供一个关于如何在 VCL 中执行此操作的代码示例吗?
我正在使用 Embarcadero Delphi 12。
delphi ×10
firemonkey ×10
android ×1
audio ×1
delphi-xe7 ×1
firedac ×1
hittest ×1
listbox ×1
mouseevent ×1
timer ×1
timertask ×1
vcl ×1