具有Firemonkey的Delphi Xe2:您可以使用非默认Windows非客户端绘画风格的非客户端区域吗? [英] Delphi Xe2 with Firemonkey : Can you have a non-client area that is painted in a style other than the default Windows nonclient paint style?

查看:267
本文介绍了具有Firemonkey的Delphi Xe2:您可以使用非默认Windows非客户端绘画风格的非客户端区域吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是使用firemonkey + Delphi XE2制作的delphi应用程序示例。



如您所见,您可以使用视觉样式stylebook Firemonkey可以自定义窗口框架内大部分内容的外观。然而,Windows框架的外部是使用Windows决定的任何样式绘制的。现在,如果我使用VCL而不是Firemonkey,我可以在深色配置中应用VCL样式和皮肤整个VCL应用程序。



我的猜测是这不是Delphi XE2 + Firemonkey不可思议的。任何人都可以显示怎么做?





在设计时,表单的预览显示了一个漂亮的黑色边框。但是当我运行我的应用程序时,Windows XPLuna主题边框(下图中的蓝色部分)看起来很残酷。讽刺的是,VCL比Firemonkey更漂亮(在XE2风格中)

解决方案

您可以创建一个VCL Forms应用程序通常情况下,如果您喜欢,在运行时加载您的Firemonkey表单并将VCL表单设置为其父级:

 使用
FMX.Platform.Win,FMX.Forms,
Unit2;

procedure TForm1.FormCreate(Sender:TObject);
var
Form2:TForm2;
begin
Form2:= TForm2.Create(nil);
Form2.BorderStyle:= FMX.Forms.TFmxFormBorderStyle.bsNone;
Form2.SetBounds(0,0,ClientWidth,ClientHeight);
Winapi.Windows.SetParent(FmxHandleToHWND(Form2.Handle),Handle);
Form2.Show;
结束

在下面的截图中,Form1是VCL应用程序主窗体(带碳样式)灰色区域与按钮是嵌入式Firemonkey形式:





请注意,我没有处理调整父窗口的大小 - 它也应该调整emebedded形式的大小,仿效alClient对齐。
这种方法似乎有很多潜在的问题 - 我认为有一个原因,IDE不能让您轻松地将Firemonkey表单与VCL表单混合 - 它警告可能的编译错误或意外行为。 p>

Here is a sample of a delphi application I am making using firemonkey + Delphi XE2.

As you can see, you can use the visual style "stylebook" in Firemonkey to customize the appearance of most things inside the window frame. However the outside of the window frame is drawn using whatever style Windows decides. Now if I was using VCL instead of Firemonkey, I could apply "VCL Styles" and "skin" the whole VCL application in a dark color scheme.

My guess is that this is NOT YET posssible with Delphi XE2 + Firemonkey. Can anyone show how to do this?

At designtime, the "preview" of your form shows a nice black border. But when I run my app, the Windows XP "Luna" theme border (the blue parts in the picture below) looks atrocious. Ironically, the VCL is prettier (in XE2 with styles) than Firemonkey...

解决方案

You can create a VCL Forms application as usual, with styles if you like, at runtime load your Firemonkey form and set your VCL form as its parent:

uses
  FMX.Platform.Win, FMX.Forms,
  Unit2;

procedure TForm1.FormCreate(Sender: TObject);
var
  Form2: TForm2;
begin
  Form2 := TForm2.Create(nil);
  Form2.BorderStyle := FMX.Forms.TFmxFormBorderStyle.bsNone;
  Form2.SetBounds(0, 0, ClientWidth, ClientHeight);
  Winapi.Windows.SetParent(FmxHandleToHWND(Form2.Handle), Handle);
  Form2.Show;
end;

In the following screenshot, Form1 is the VCL application main form (with Carbon style) and the dark-grey area with the button is the embedded Firemonkey form:

Note that I'm not handling resizing of the parent window - it should resize the emebedded form, too, emulating alClient alignment. It seems there are many potential problems with this approach - I think there's a reason why the IDE doesn't let you easily mix Firemonkey forms with VCL forms - it warns about possible "compilation errors or unexpected behavior."

这篇关于具有Firemonkey的Delphi Xe2:您可以使用非默认Windows非客户端绘画风格的非客户端区域吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆