如何让Image在Edit控件上面显示?(10分)

接受答案了.
 
咔咔,搞这么复杂呀。直接画不就完了?
取到效果图像:(字要斜的吗?自己搜代码去搞定)
function TForm1.DrawSelf(const Text:string): TBitmap;
procedure HideClient;
var
I:integer;
begin
for I := 0 to Self.ControlCount - 1do
Self.Controls.Visible := False;
end;
var
DC:HDC;
begin
Result := TBitmap.Create;
try
Result.Width := ClientWidth;
Result.Height := ClientHeight;
Result.Canvas.Lock;
try
DC := GetDC(Handle);
Bitblt(Result.Canvas.Handle, 0, 0, Result.Width, Result.Height, DC, 0, 0, SRCCOPY);
ReleaseDC(Handle, DC);
finally
Result.Canvas.Unlock;
end;
Result.Canvas.Brush.Style := bsClear;
with Result.Canvas.Fontdo
begin
Name := '隶书';
Size := 72;
Style := [fsBold];
end;
Result.Canvas.TextRect(ClientRect, ClientWidth div 4, ClientHeight div 3, Text);
HideClient;
except
Result.Free;
Result := nil;
end;
end;

按钮点一下:
procedure TForm1.Button1Click(Sender: TObject);
begin
Bmp := DrawSelf('爽啊爽');
Refresh;
end;

在画方法里画出来:
procedure TForm1.FormPaint(Sender: TObject);
begin
if Assigned(Bmp) then
Canvas.Draw(0, 0, Bmp);
end;
 
已接受答案就算了
 
顶部