delphi的控件可视化开发(不是开发可视化控件)遐想,高高手请进! ( 积分: 200 )

  • 主题发起人 主题发起人 auwa
  • 开始时间 开始时间
A

auwa

Unregistered / Unconfirmed
GUEST, unregistred user!
今天突然想到一个问题,delphi能不能做可视化控件开发?
于是我试了一下,
pas文件:
unit PanelXXX_u;
interface
uses
SysUtils, Classes, Controls, ExtCtrls;
type
TPanelXXXX = class(TPanel)
btn1: TButton;
btn2: TButton;
btn3: TButton;
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
{$R *.dfm} //主意这里,有个dfm
procedure Register;
begin
RegisterComponents('Samples', [TPanelXXXX]);
end;
end.
dfm文件:[red]注意dfm文件没有窗体[/red]
object TPanelXXXX : TPanel
Left = 8
Top = 8
Caption = 'pnl1'
ClientHeight = 122
ClientWidth = 168
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = True
PixelsPerInch = 96
TextHeight = 13
object btn1: TButton
Left = 16
Top = 16
Width = 75
Height = 25
Caption = 'btn1'
end
object btn2: TButton
Left = 16
Top = 47
Width = 75
Height = 25
Caption = 'btn2'
TabOrder = 1
end
object btn3: TButton
Left = 16
Top = 78
Width = 75
Height = 25
Caption = 'btn3'
TabOrder = 2
end
end
dpk文件
package PackageXXXX;

{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$IMPLICITBUILD OFF}

requires
rtl,
vcl;

contains
PanelXXX_u in 'PanelXXX_u.pas';
end.
没想到delphi10竟然可以把这个自定义控件TPanelXXXX 当窗体一样编辑,还保存dfm文件,只是不能编编译bpl,由于我就在想delphi倒底能不能做控件可视化开发?如果可以那肯定要修改TReader或TWriter或TStream这几个控件,本人时间,水平有限,请高高手试试,如果可以的话,那不得了,堪称2007第一伟大发现.相关delphi读写机制的文章 :
http://edu.chinaz.com/Get/Program/Program_Other/064101437025379061.asp
 
多人接受答案了。
 

Similar threads

I
回复
0
查看
673
import
I
I
回复
0
查看
811
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部