Panel+背景图片 不要加其他控件,请教,谢谢。今晚就结贴。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有点难度!Panel又没有canvas属性,怎么直接画图呢! unit CustomPanel1;interfaceuses SysUtils, Classes, Controls,Graphics, ExtCtrls;type TCustomPanel1 = class(TCustomPanel) private { Private declarations } FGlpy:TBitmap; FGlyph: TBitmap; procedure SetGlyph(val:TBitmap); protected { Protected declarations } procedure paint;override; public { Public declarations } constructor Create(AOwner:TComponent);override; destructor Destroy;override; published { Published declarations } property Glyph:TBitmap read FGlyph write SetGlyph; end;procedure Register;implementationprocedure Register;begin RegisterComponents('HQJVCL', [TCustomPanel1]);end;{ TCustomPanel1 }constructor TCustomPanel1.Create(AOwner: TComponent);begin inherited Create(AOwner); FGlyph:=TBitmap.create; SetBounds(0,0,100,100);end;destructor TCustomPanel1.Destroy;begin FGlyph.free; inherited;end;procedure TCustomPanel1.paint;begin if not FGlyph.Empty then begin Canvas.Draw(0,0,FGlyph); // end else inherited;end;procedure TCustomPanel1.SetGlyph(val: TBitmap);begin FGlyph.Assign(val); invalidate;end;end. 在panel上加一个Image 控件,把它们的大小设成一样,加入图片就OK了,结贴给分吧,哈 这样多简单,那用象 SydPink(希望不再敲键盘!) 这样麻烦 对了,最后别忘了把Image的Align属性设为alClient procedure TForm1.Button1Click(Sender: TObject);var aCanvas: TCanvas;begin aCanvas := TCanvas.Create; aCanvas.Handle := GetDC(Panel1.Handle); aCanvas.Draw(0, 0, Image1.Picture.Graphic); aCanvas.Free;end; 窗体坐标原点的问题,高分相送 怎么给动态创建的控件添加事件啊?各位大虾帮忙!!! 请问各位大侠一个很简单的问题!!! 关于Adoquery执行的问题,请指教! frame 问题 串口通信! 请教,怎样编写文件复制(急) 关于移动记录指针。 100分问一个关于在OleContainerx中嵌入Excel后相关操作的问题! 李维 系统篇第二章中的M/D的问题! 有一个问题请教大家!!! 关于delphi6 的query 问题,请教在线等待急!!!,急死俺了浑身是汗
SysUtils, Classes, Controls,Graphics, ExtCtrls;type
TCustomPanel1 = class(TCustomPanel)
private
{ Private declarations }
FGlpy:TBitmap;
FGlyph: TBitmap;
procedure SetGlyph(val:TBitmap);
protected
{ Protected declarations }
procedure paint;override; public
{ Public declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
published
{ Published declarations }
property Glyph:TBitmap read FGlyph write SetGlyph;
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('HQJVCL', [TCustomPanel1]);
end;{ TCustomPanel1 }constructor TCustomPanel1.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FGlyph:=TBitmap.create;
SetBounds(0,0,100,100);
end;destructor TCustomPanel1.Destroy;
begin
FGlyph.free;
inherited;
end;procedure TCustomPanel1.paint;
begin
if not FGlyph.Empty then
begin
Canvas.Draw(0,0,FGlyph);
//
end
else inherited;end;procedure TCustomPanel1.SetGlyph(val: TBitmap);
begin
FGlyph.Assign(val);
invalidate;
end;end.
var
aCanvas: TCanvas;
begin
aCanvas := TCanvas.Create;
aCanvas.Handle := GetDC(Panel1.Handle);
aCanvas.Draw(0, 0, Image1.Picture.Graphic);
aCanvas.Free;
end;