var Tsb:TSpeedButton;
begin
Tsb:=TSpeedButton.Create(Panel1) ;
Tsb.Parent:=Panel1;
Tsb.OnClick:=TsbOnClick; Tsb.Width :=85;
Tsb.Height :=70;
Tsb.Caption :='MyButton';
Tsb.Show;
end;
begin
Tsb:=TSpeedButton.Create(Panel1) ;
Tsb.Parent:=Panel1;
Tsb.OnClick:=TsbOnClick; Tsb.Width :=85;
Tsb.Height :=70;
Tsb.Caption :='MyButton';
Tsb.Show;
end;
解决方案 »
- 在program单元中定义了一个全局变量,如何在其它单元引用它?(非unit单元文件定义)
- 请教DBGridEh1排序问题
- ArrangelconicuWindows在uses中如何定义??
- 有谁用过TimeSetEvent函数?
- 我在用win2000进行Delphi三层开发,原来用Administrator,后来要求换个名称,所装的Delphi控年不见了!!!
- 有没有ADO连接的sql监视器?
- 如何写包含有变量的insert语句?
- 怎样使DBGRID只显示所查询的数据
- foxnt蛛蛛好,这两天看com 搜到您写的文章,由于资质愚钝,仍然无法理解,能否发个原码给我
- 有西电的校友再做delphi+sqlserver的吗?
- 如何用命令显式的触发一个事件?要触发ADO中的OnRecordChangComplete事件。
- 想把SQL.SERVER的库打包。要怎么做啊。给分100
interface
uses
Windows, Messages, SysUtils, Classes, Graphics,
Controls, Forms, Dialogs,
StdCtrls;type
L_TEdit1 = class(TEdit)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent); override;
procedure MoveShow;
published
{ Published declarations }
property Text;
end;procedure Register;implementation
constructor L_TEdit1.Create(AOwner:TComponent);
begin
inherited create(aowner);
color:=clblue;
font.Color:=clyellow;
font.Size:=12;
font.Name:= '@仿宋_GB2312';
tabstop:=false;
update;
end;procedure L_TEdit1.MoveShow;
var
edit_length,i:integer;
edit_char:char;
chars: string;
begin
chars:='';
if (length(text)=0) then
text:=’Welcom you to use the software!’;
edit_length:=length(text);
for i:=1 to edit_length do
begin
edit_char:=text[1];
if (Ord(edit_char) >127) then
if length(chars) >1 then
begin
text:=copy(text,2,edit_length-2)+chars;
chars:='';
end
else
begin
chars:=copy(text,1,2);
text:=copy(text,2,edit_length-1);
end
else
begin
text:=copy(text,2,edit_length-1)+edit_char;
end;
update;
sleep(100);
end;
end;
procedure Register;
begin
RegisterComponents('Samples', [L_TEdit1]);
end;end.
再保存该文件。
启动Image Editor 创建L_Edit.dcr , 选New- >Bitmap,自己做一个图标,保存名为L_TEDIT1(与新建的类同名)。注意L_Edit.dcr 与L_Edit.pas 要在同一个目录中(缺省为\delphi\lib目录中。再单击Install Component. 选Into new package属性页,填上L_Edit.pas 的路径和文件名,并在该路径下新建L_Edit1.dpk 文件。之后一直单击OK即可。此时我们可以在Delphi 的工具栏Sample 一项中看到自己创建的图标。
三. 编写主程序 在主窗体Form1中放一自己创建的控件,在Text的属性中填上要显示的文字(中英文都可)。与该窗体对应的L_unit1.pas内容如下: unit L_Unit1;
interface
uses
Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms, Dialogs,
StdCtrls, L_Edit;type
Tmythread=class(TThread)
protected
procedure Execute; override;
end;
TForm1 = class(TForm)
L_TEdit11: L_TEdit1;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
MyThread1:TMyThread;
implementation{$R *.DFM}
Procedure TMyThread.Execute;
begin
while true do form1.L_TEdit11.MoveShow;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
MyThread1:=TMyThread.Create(false);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('Welcome You!');
end;end.