我的程序应以管理员身份运行.两年前,我创建了一个清单文件,它工作正常.但是现在,我从Delphi 2010转移到Delphi XE3并且它不起作用 - 程序像往常一样启动(而不是管理员).此外,我将我的程序称为"MyApp".
在源代码中,我声明了两个res文件:
{$R MyApp.res}
{$R Manifest.res}
Run Code Online (Sandbox Code Playgroud)
Manifest是由以下代码创建的:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="MyApp"
version="1.1.0.0"
processorArchitecture="x86"/>
<description>
MyApp
</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="*deleted*"
language="*"
processorArchitecture="x86"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Run Code Online (Sandbox Code Playgroud)
当我从源清单工作中删除{$ R MyApp.res}时.所以我理解MyApp.res(由Delphi自动生成)击败了Manifest.res.但在Delphi 2010中,此配置工作正常,但在XE3中不起作用.为什么?我怎么解决它?
开始在 Delphi 中使用 GDI+。需要画几条平滑的直线。例如,试图在表单上绘制对角线(从左上角到右下角),但什么也没出现。该代码有什么问题(Delphi XE3,Windows 10 x64)?
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Winapi.GDIPAPI, Winapi.GDIPOBJ;
type
TForm2 = class(TForm)
procedure FormPaint(Sender: TObject);
procedure FormResize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormPaint(Sender: TObject);
var
graphics: TGPGraphics;
gpPen: TGPPen;
begin
graphics := TGPGraphics.Create(Self.Canvas.Handle);
try
graphics.SetSmoothingMode(SmoothingModeAntiAlias8x8);
gpPen := TGPPen.Create(clBlue, 3);
try
graphics.DrawLine(gpPen, 0, 0, ClientWidth, ClientHeight);
finally
gpPen.Free;
end;
finally
graphics.Free;
end;
end; …
Run Code Online (Sandbox Code Playgroud) 我正在开发一些组件 - 自定义按钮。我安装了它,但在设计时自定义发布的属性重置为零。首先,我在谈论颜色 - 它重置为clBlack
(或clBtnFace
用于Color
财产)。Caption
重置为空字符串。我的意思是当我在设计时放置组件以形成表单时,对象检查器中的所有自定义属性都重置为零(颜色clBlack
等)。我可以手动更改它,但为什么我在代码中设置的默认值不起作用?问题仅在设计时。当我在运行时创建组件时,它工作正常。这是代码(以Color
属性为例)。
基类
TpfCustomButton = class(TCustomControl)
...
published
...
property Color;
...
end;
Run Code Online (Sandbox Code Playgroud)
主要代码
TpfCustomColoredButton = class(TpfCustomButton)
...
public
constructor Create(AOwner: TComponent);
...
end;
constructor TpfCustomColoredButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Color := $00E1E1E1;//Look at this: setting Color
...
end;
Run Code Online (Sandbox Code Playgroud)
组件代码
TpfColoredButton = class(TpfCustomColoredButton)
published
...
property Action;
property Align;
//And some other standard properties
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('PF Components', [TpfColoredButton]);
end; …
Run Code Online (Sandbox Code Playgroud)