DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: jsuguo
今日帖子: 29
在线用户: 10
导航: 论坛 -> 移动应用开发 斑竹:flyers,iamdream  
作者:
男 sxfgf (FC_FGF) ★☆☆☆☆ -
普通会员
2022/4/13 0:08:36
标题:
求让Form背景透明,中间Panel可以显示的例子代码 浏览:1357
加入我的收藏
楼主: Form1为调用窗口,Form2 为透明窗体
Form2属性:
Transparency->True
backgroundcolor->Null
StyleLookUP->空
fill.color->Black
当show  fORM2,窗体不透明,请教哪里出了问题?
另外,我的意图是模拟一个类似VCL里模式对话框的样子,能显示信息,能输入信息
请问用哪种方法更好?
----------------------------------------------
偶尔做做代码应付一下工作,却发现Delphi已成必配
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/4/13 0:54:29
1楼: maybe help you;

var
  Form1: TForm1;

implementation

{$R *.fmx}

uses
  Unit2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2 := TForm2.Create(nil);
  try
    Form2.Transparency := true;
    Form2.ShowModal;
  finally
    Form2.DisposeOf;
  end;
end;

end.
----------
type
  TForm2 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Label1: TLabel;
    Rectangle1: TRectangle;
    Edit2: TEdit;
    Button2: TButton;
    Label3: TLabel;
    Label4: TLabel;
    Panel1: TPanel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
    procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.fmx}

procedure TForm2.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TForm2.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
  if (ssLeft in Shift) then
    StartWindowDrag;
end;

procedure TForm2.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
  if (ssLeft in Shift) then
    ReleaseCapture;
end;

end.
此帖子包含附件:
PNG 图像
大小:26.0K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/4/13 1:09:44
2楼: VCL form1 with another color for better see the effect
此帖子包含附件:
PNG 图像
大小:33.0K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/4/13 1:15:24
3楼: FMX
此帖子包含附件:
PNG 图像
大小:12.4K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/4/13 1:29:48
4楼: Color = NULL = NO COLOR!!!
Color = Black = Black color.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 sxfgf (FC_FGF) ★☆☆☆☆ -
普通会员
2022/4/13 8:11:03
5楼: emailx45,谢谢您

我需要的是安卓下的,麻烦您赐教!
----------------------------------------------
偶尔做做代码应付一下工作,却发现Delphi已成必配
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/4/13 11:56:02
6楼: If you don't ask the question correctly, you run the risk of getting the answer wrong.


for Android, try modify your AndroidManifest.Template.XML params:

from:
section:  <%uses-permission%>
line:   android:theme="%theme%"
------
to:  
line: android:theme="@android:style/Theme.Translucent.NoTitleBar"

by default, the transparent forms in Android is "black-color"

since Embarcadero RAD Studio 10.3 Rio 
RSP-22314: https://quality.embarcadero.com/browse/RSP-22314

"Marco Cantù added a comment - 03/Sep/20 7:31 AM
Works as expected means this is the behavior by design, a design that in this case is due to external platform limitations.

Some internal info: "Since 10.3, we use SurfaceView as a base for our form. It allows us to render form using OpenGL ES and as result let us to use native controls. And only 2 SurfaceView instances are available for rendering for an Android app. There is an alternative implementation of forms via TextureView. But experiments have shown that speed of rendering slower in 2 times than SurfaceView."

Marco Cantù added a comment - 14/Sep/20 2:21 AM
I'll be more than happy if you convince Google to change how Android works or optimize the TextureView. We need to live with the constraints of the OS, balancing different and conflicting requirements.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 smartdata (Jack) ★☆☆☆☆ -
普通会员
2022/4/14 0:55:00
7楼: 顶!
----------------------------------------------
==========
作者:
男 sxfgf (FC_FGF) ★☆☆☆☆ -
普通会员
2022/4/14 2:25:05
8楼:
----------------------------------------------
偶尔做做代码应付一下工作,却发现Delphi已成必配
作者:
男 www12345 (风云) ★☆☆☆☆ -
盒子活跃会员
2022/4/14 8:12:44
9楼: emailx45按此在新窗口浏览图片
----------------------------------------------
一卡通专家的中专家www.cnduh.com
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行93.75毫秒 RSS