一直用VB的,觉得DELPHI什么都比他好,就是向导不行,VB做控件只要跟向导一步步做就行了,我还用VB做过很酷的控件呢,DELPHI连最简单的都不行,不是不会写代码,只是不知道怎么加上去,老说设计期、运行期什么的。
11 个解决方案
#1
先把下面的代码保存成 TranForm.pas ;
component ->install component ->into newpackpage
unitfile name ://加上 TranForm.pas(包括文件的路径)
package filename ://自己定义包文件名
package description ://自己定义描述
->ok剩下的自己看着办吧!
//////////////
Unit TranForm; {DragonPC 2001.2.21}
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms ;
Type
TTranForm = class (TComponent)
Private
FAlphaValue: integer;
FParentFormHandle: HWND;
Procedure SetFAlphaValue (Alpha: integer);
Protected
Procedure UpdateDisplay;
Public
Constructor Create (AOwner: TComponent); override;
Published
Property AlphaValue: integer read FAlphaValue write SetFAlphaValue;
End;
Const
WS_EX_LAYERED = $80000;
LWA_ALPHA = 2;
Procedure Register;
Function SetLayeredWindowAttributes (Handle: HWND; COLORKEY: COLORREF;
Alpha: BYTE; Flags: DWORD): Boolean; stdcall; external 'USER32.DLL';
Implementation
Procedure Register;
Begin
RegisterComponents ('Standard', [TTranForm]);
End;
Procedure TTranForm.SetFAlphaValue (Alpha: integer);
Begin
if (Alpha >= 0) and (Alpha < 256) then begin
FAlphaValue:= Alpha;
UpdateDisplay ();
End;
End;
Procedure TTranForm.UpdateDisplay;
Begin
if (csDesigning in ComponentState) then Exit ;
SetLayeredWindowAttributes (FParentFormHandle, 0, FAlphaValue, 2);
End;
Constructor TTranForm.Create (AOwner: TComponent);
Begin
Inherited;
if (csDesigning in ComponentState) then Exit;
FAlphaValue:= 255;
FParentFormHandle:= TForm (AOwner). Handle;
SetWindowLong (FParentFormHandle,
GWL_EXSTYLE, GetWindowLong (FParentFormHandle, GWL_EXSTYLE) or WS_EX_LAYERED);
End;
End.
component ->install component ->into newpackpage
unitfile name ://加上 TranForm.pas(包括文件的路径)
package filename ://自己定义包文件名
package description ://自己定义描述
->ok剩下的自己看着办吧!
//////////////
Unit TranForm; {DragonPC 2001.2.21}
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms ;
Type
TTranForm = class (TComponent)
Private
FAlphaValue: integer;
FParentFormHandle: HWND;
Procedure SetFAlphaValue (Alpha: integer);
Protected
Procedure UpdateDisplay;
Public
Constructor Create (AOwner: TComponent); override;
Published
Property AlphaValue: integer read FAlphaValue write SetFAlphaValue;
End;
Const
WS_EX_LAYERED = $80000;
LWA_ALPHA = 2;
Procedure Register;
Function SetLayeredWindowAttributes (Handle: HWND; COLORKEY: COLORREF;
Alpha: BYTE; Flags: DWORD): Boolean; stdcall; external 'USER32.DLL';
Implementation
Procedure Register;
Begin
RegisterComponents ('Standard', [TTranForm]);
End;
Procedure TTranForm.SetFAlphaValue (Alpha: integer);
Begin
if (Alpha >= 0) and (Alpha < 256) then begin
FAlphaValue:= Alpha;
UpdateDisplay ();
End;
End;
Procedure TTranForm.UpdateDisplay;
Begin
if (csDesigning in ComponentState) then Exit ;
SetLayeredWindowAttributes (FParentFormHandle, 0, FAlphaValue, 2);
End;
Constructor TTranForm.Create (AOwner: TComponent);
Begin
Inherited;
if (csDesigning in ComponentState) then Exit;
FAlphaValue:= 255;
FParentFormHandle:= TForm (AOwner). Handle;
SetWindowLong (FParentFormHandle,
GWL_EXSTYLE, GetWindowLong (FParentFormHandle, GWL_EXSTYLE) or WS_EX_LAYERED);
End;
End.
#2
慢慢练吧
#3
同意C#
#4
多看一些关于组件编程的书籍,我推荐“Delphi5程序员指南”这里有大量的篇幅介绍组件的编写。
#5
编写组建和一般的编写有些差异,比如对类内的对象复制,不要用:=,用Assign方法
调试也稍微麻烦一些。
看看帮助吧。
调试也稍微麻烦一些。
看看帮助吧。
#6
写组件没有不可以可视化,慢慢来
#7
soft123(泰山) 的话怎么看不懂
#8
还是没人能够一步步教会怎么做,组件的代码知道怎么写的,书上有讲呀,可是怎么加到组件面板上呢,要注意些什么呢?这也说明DELPHI的向导不好,都不知道怎么做
#9
你不能把组件装到面版上吗?
#10
组件的代码中加一个过程
prodeure Registre;
begin
调用RegisterComponents;//注册面板
end;
再放到一个包里
prodeure Registre;
begin
调用RegisterComponents;//注册面板
end;
再放到一个包里
#11
有这么多高见,好象还是不会,再说吧,要用时自然就会。
#1
先把下面的代码保存成 TranForm.pas ;
component ->install component ->into newpackpage
unitfile name ://加上 TranForm.pas(包括文件的路径)
package filename ://自己定义包文件名
package description ://自己定义描述
->ok剩下的自己看着办吧!
//////////////
Unit TranForm; {DragonPC 2001.2.21}
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms ;
Type
TTranForm = class (TComponent)
Private
FAlphaValue: integer;
FParentFormHandle: HWND;
Procedure SetFAlphaValue (Alpha: integer);
Protected
Procedure UpdateDisplay;
Public
Constructor Create (AOwner: TComponent); override;
Published
Property AlphaValue: integer read FAlphaValue write SetFAlphaValue;
End;
Const
WS_EX_LAYERED = $80000;
LWA_ALPHA = 2;
Procedure Register;
Function SetLayeredWindowAttributes (Handle: HWND; COLORKEY: COLORREF;
Alpha: BYTE; Flags: DWORD): Boolean; stdcall; external 'USER32.DLL';
Implementation
Procedure Register;
Begin
RegisterComponents ('Standard', [TTranForm]);
End;
Procedure TTranForm.SetFAlphaValue (Alpha: integer);
Begin
if (Alpha >= 0) and (Alpha < 256) then begin
FAlphaValue:= Alpha;
UpdateDisplay ();
End;
End;
Procedure TTranForm.UpdateDisplay;
Begin
if (csDesigning in ComponentState) then Exit ;
SetLayeredWindowAttributes (FParentFormHandle, 0, FAlphaValue, 2);
End;
Constructor TTranForm.Create (AOwner: TComponent);
Begin
Inherited;
if (csDesigning in ComponentState) then Exit;
FAlphaValue:= 255;
FParentFormHandle:= TForm (AOwner). Handle;
SetWindowLong (FParentFormHandle,
GWL_EXSTYLE, GetWindowLong (FParentFormHandle, GWL_EXSTYLE) or WS_EX_LAYERED);
End;
End.
component ->install component ->into newpackpage
unitfile name ://加上 TranForm.pas(包括文件的路径)
package filename ://自己定义包文件名
package description ://自己定义描述
->ok剩下的自己看着办吧!
//////////////
Unit TranForm; {DragonPC 2001.2.21}
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms ;
Type
TTranForm = class (TComponent)
Private
FAlphaValue: integer;
FParentFormHandle: HWND;
Procedure SetFAlphaValue (Alpha: integer);
Protected
Procedure UpdateDisplay;
Public
Constructor Create (AOwner: TComponent); override;
Published
Property AlphaValue: integer read FAlphaValue write SetFAlphaValue;
End;
Const
WS_EX_LAYERED = $80000;
LWA_ALPHA = 2;
Procedure Register;
Function SetLayeredWindowAttributes (Handle: HWND; COLORKEY: COLORREF;
Alpha: BYTE; Flags: DWORD): Boolean; stdcall; external 'USER32.DLL';
Implementation
Procedure Register;
Begin
RegisterComponents ('Standard', [TTranForm]);
End;
Procedure TTranForm.SetFAlphaValue (Alpha: integer);
Begin
if (Alpha >= 0) and (Alpha < 256) then begin
FAlphaValue:= Alpha;
UpdateDisplay ();
End;
End;
Procedure TTranForm.UpdateDisplay;
Begin
if (csDesigning in ComponentState) then Exit ;
SetLayeredWindowAttributes (FParentFormHandle, 0, FAlphaValue, 2);
End;
Constructor TTranForm.Create (AOwner: TComponent);
Begin
Inherited;
if (csDesigning in ComponentState) then Exit;
FAlphaValue:= 255;
FParentFormHandle:= TForm (AOwner). Handle;
SetWindowLong (FParentFormHandle,
GWL_EXSTYLE, GetWindowLong (FParentFormHandle, GWL_EXSTYLE) or WS_EX_LAYERED);
End;
End.
#2
慢慢练吧
#3
同意C#
#4
多看一些关于组件编程的书籍,我推荐“Delphi5程序员指南”这里有大量的篇幅介绍组件的编写。
#5
编写组建和一般的编写有些差异,比如对类内的对象复制,不要用:=,用Assign方法
调试也稍微麻烦一些。
看看帮助吧。
调试也稍微麻烦一些。
看看帮助吧。
#6
写组件没有不可以可视化,慢慢来
#7
soft123(泰山) 的话怎么看不懂
#8
还是没人能够一步步教会怎么做,组件的代码知道怎么写的,书上有讲呀,可是怎么加到组件面板上呢,要注意些什么呢?这也说明DELPHI的向导不好,都不知道怎么做
#9
你不能把组件装到面版上吗?
#10
组件的代码中加一个过程
prodeure Registre;
begin
调用RegisterComponents;//注册面板
end;
再放到一个包里
prodeure Registre;
begin
调用RegisterComponents;//注册面板
end;
再放到一个包里
#11
有这么多高见,好象还是不会,再说吧,要用时自然就会。