Hello, after the image you sent I broke my head.
The simplest solution I could find was to use the Jedi Project that adds many components.
The idea was to put a panel with alClient transparent and inside it a semi-transparent image and was like this:
The code:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, pngimage, ExtCtrls, JvExExtCtrls, JvExtComponent, JvPanel,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
btn1: TButton;
jvpnl1: TJvPanel;
Button2: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
jvpnl1.Align := alClient;
jvpnl1.Visible := True;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
jvpnl1.Visible := False;
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
Close;
end;
end.
Unit1.dmf file
object Form1: TForm1
Left = 192
Top = 117
Width = 829
Height = 413
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 152
Top = 40
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object btn1: TButton
Left = 256
Top = 152
Width = 75
Height = 25
Caption = 'btn1'
TabOrder = 1
OnClick = btn1Click
end
object jvpnl1: TJvPanel
Left = 456
Top = 80
Width = 337
Height = 201
Transparent = True
BevelOuter = bvNone
TabOrder = 2
Visible = False
object Image1: TImage
Left = 0
Top = 0
Width = 337
Height = 201
Align = alClient
Picture.Data = {
0A54504E474F626A65637489504E470D0A1A0A0000000D49484452000000F000
0000C80806000000D67C6C52000002424944415478DAEDD3010D00301003A1BE
7F6B13351D9780076EDB1B90741318B204863081214C60081318C20486308121
4C60081318C204863081214C60081318C204863081214C60081318C204863081
214C60081318C204863081214C60081318C204863081214C60081318C2048630
81214C60081318C204863081214C60081318C204863081214C60081318C20486
3081214C60081318C204863081214C60081318C204863081214C60081318C204
863081214C60081318C204863081214C60081318C204863081214C60081318C2
04863081214C60081318C204863081214C60081318C204863081214C60081318
C204863081214C60081318C204863081214C60081318C204863081214C600813
18C204863081214C60081318C204863081214C60081318C204863081214C6008
1318C204863081214C60081318C204863081214C60081318C204863081214C60
081318C204863081214C60081318C204863081214C60081318C204863081214C
60081318C204863081214C60081318C204863081214C60081318C20486308121
4C60081318C204863081214C60081318C204863081214C60081318C204863081
214C60081318C204863081214C60081318C204863081214C60081318C2048630
81214C60081318C204863081214C60081318C204863081214C60081318C20486
3081214C60081318C204863081214C60081318C204863081214C60081318C204
863081214C60081318C204863081214C60081318C204863081214C60081318C2
04863081214C60081318C20486308121EC030928A029907BE5A9000000004945
4E44AE426082}
Stretch = True
Transparent = True
end
object Button2: TButton
Left = 64
Top = 32
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 0
OnClick = Button2Click
end
end
end
Whoa, Guy, I do with
forms
, on my main screen, I create aprocedure
to open the screen, with centralization options, etc. When opening my login form, create another form at runtime, called Background, and in it I put the size of my main screen form, withAlphaBlend
andAlphaBlendValue := 200
, and other parameters to look cute. In formClose from the Login screen, I will kill this form from behind. What do you think? If you want later I can post an example...– David
@David, I’m going to first try a way to do this using Panels. If it really is not possible then I will go to another approach, like the one you reported (I had already seen in a forum about it). Thanks anyway! Hug!
– Guybrush