Y
ynfly
Unregistered / Unconfirmed
GUEST, unregistred user!
在窗体上添加一个TImage和一个label,可以把label放在TImage上面,且透明显示,但是如果是程序创建的TImage对象只能在label上面,什么原因?(100分)<br />这是我的代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtDlgs, StdCtrls, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Image1: TImage;
BitBtn1: TBitBtn;
OpenPictureDialog1: TOpenPictureDialog;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var newImage:tImage;
begin
if OpenPictureDialog1.Execute then
begin
newImage:=tImage.Create(owner);
newImage.Parent:=Form1;
newImage.Width :=100;
newImage.Height :=100;
newImage.Picture.LoadFromFile(openPictureDialog1.FileName );
//加入此图片后图片显示在label上面,且不能看到label上方的文字,我要求的是
//图片显示在label下方,透过Label能看到图片
end;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtDlgs, StdCtrls, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Image1: TImage;
BitBtn1: TBitBtn;
OpenPictureDialog1: TOpenPictureDialog;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var newImage:tImage;
begin
if OpenPictureDialog1.Execute then
begin
newImage:=tImage.Create(owner);
newImage.Parent:=Form1;
newImage.Width :=100;
newImage.Height :=100;
代码:
//加入此图片后图片显示在label上面,且不能看到label上方的文字,我要求的是
//图片显示在label下方,透过Label能看到图片
end;
end;
end.