acaia,你那问题代码如下,不能白要你的分(0分)

天真

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
const
WM_DEFINE= WM_USER+100;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
procedure draw;
procedure mytest(var message : TMessage);message WM_DEFINE;
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.mytest(var message : TMessage);
begin
TDraw.create(false);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
draw;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
postmessage(handle,WM_DEFINE,0,0);
end;

end.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unit Unit2;
interface
uses
Classes,graphics,controls;
type
TDraw = class(TThread)
private
{ Private declarations }
protected
procedure Execute;
override;
procedure draw;
end;

implementation
uses unit1;
{ Important: Methods and properties of objects in VCL can only be used in a
method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TDraw.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
}
{ TDraw }
procedure TDraw.Execute;
begin
{ Place thread code here }
Synchronize(draw);
end;

procedure TDraw.draw;
var
C:TCanvas;
x1,x2,y1,y2:longint;
bmp : TBitmap;
begin
with form1 do
begin
try
Bmp := TBitmap.Create;
Bmp.LoadFromFile('d:/bmp/149.bmp');
c:=TControlCanvas.Create;
TControlCanvas(c).Control:=Panel1;
x1 :=0;
while x1<=Panel1.Width do
begin
y1 :=0;
while y1 <=Panel1.Height do
begin
c.Draw(x1,y1,bmp);
inc(y1,bmp.Height);
end;
inc(x1,bmp.width);
end;

finally
C.free;
Bmp.Free;
end;
end;
end;

end.

 
如果写在Form的ONpaint里则在窗体缩小时不起作用,我在Onresize里发消息则可以;不过
画面比较抖动,如何解决??
另外,我对图象、绘图方面不太了解,可否介绍些资料或者书??谢了!!
 
呵你其实就好就是去改控件中,
PANIT这个过程了,
:)
这样无论怎么样都行:)
有机会,帮你写一个吧但现在没时间不好意思
 
好久没见!
有几次见到你,可是QQ发不过来!
听说你在学VC?怎样了?
 
气人,QQ上实在发不过来,只好这样,不好意思。
 
接受答案了.
 
顶部