csdn代码收集
2004-12-28 17:38
417 查看
winexec('net use //xxx.xxx.xxx.xxx psw /user:administrator',sw_hide);
先登陆到那台机子
然后就可以用"//"来访问了
sendmessage(self.handel,WM_CLOSE,0,0);//发送关闭窗口的消息
你的问题应该是窗体没有free掉
在formclose事件中写入 Action := CaFree;
怎样让Edit只能输入中文
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if ord(key)<128 then key:=#0;
end;
不过要判断一下delete和backspace
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (ord(key)<128) then
if (key<>#8) and (key<>#32) then key:=#0;
end;
edit组件中显示的文字,如何让它居中或者居右对齐啊!
不胜感谢
对着控件单击右键,有个 position 属性
Top
回复人: luke5678(奇异) ( ) 信誉:101 2004-9-23 10:23:56 得分: 0
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong(Edit1.Handle, GWL_STYLE,
GetWindowlong(Edit1.Handle, GWL_STYLE) + ES_CENTER); //居中
Edit1.Refresh;
SetWindowLong(Edit2.Handle, GWL_STYLE,
GetWindowlong(Edit2.Handle, GWL_STYLE) + ES_RIGHT); //居右
Edit2.Refresh;
end;
var
defstyle: dWord;
begin
defstyle := GetWindowLong(Edit1.Handle, GWL_STYLE);
SetWindowLong(Edit1.Handle, GWL_STYLE, defstyle or ES_RIGHT)
end;
Top
回复人: lzy6204(为了忘却的记忆) ( ) 信誉:101 2004-9-23 10:36:40 得分: 20
重载,自己写
[转]:将下面控件安装到你的delphi中就行了
--------------------------------------
unit AEdit;
interface
uses
Windows,
SysUtils,
Messages,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
Menus,
StdCtrls,
ExtCtrls;
type
TEoCEdit = class(TEdit)
private
{ Private declarations }
FAlignment: TAlignment;
protected
{ Protected declarations }
function GetAlignment: TAlignment; virtual;
procedure SetAlignment(newValue: TAlignment); virtual;
procedure CreateParams(var Params: TCreateParams); override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published properties and events }
property Alignment: TAlignment read GetAlignment write SetAlignment; { Published }
end; { TEoCEdit }
procedure Register;
implementation
function TEoCEdit.GetAlignment: TAlignment;
{ Returns the value of data member FAlignment. }
begin
GetAlignment := FAlignment;
end; { GetAlignment }
procedure TEoCEdit.SetAlignment(newValue: TAlignment);
{ Sets data member FAlignment to newValue. }
begin
if FAlignment <> newValue then
begin
FAlignment := newValue;
if not (csLoading in componentstate) then ReCreateWnd;
end;
end; { SetAlignment }
destructor TEoCEdit.Destroy;
begin
inherited Destroy;
end; { Destroy }
constructor TEoCEdit.Create(AOwner: TComponent);
{ Creates an object of type TEoCEdit, and initializes properties. }
begin
inherited Create(AOwner);
{ Initialize properties with default values: }
FAlignment := taLeftJustify;
end; { Create }
procedure TEoCEdit.CreateParams(var Params: TCreateParams);
const
Alignments: array[TAlignment] of WORD = (ES_LEFT, ES_RIGHT, ES_CENTER);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or Alignments[FAlignment];
end;
procedure Register;
begin
RegisterComponents('EoC', [TEoCEdit]);
end; { Register }
end.
这段代码行
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong(Edit1.Handle, GWL_STYLE,
GetWindowlong(Edit1.Handle, GWL_STYLE) + ES_CENTER); //居中
Edit1.Refresh;
SetWindowLong(Edit2.Handle, GWL_STYLE,
GetWindowlong(Edit2.Handle, GWL_STYLE) + ES_RIGHT); //居右
Edit2.Refresh;
end;
//opendialog的使用方法
if openDialog1.Execute then
begin
s:=ExtractFilePath(opendialog1.FileName);
edit3.text:=s+'lklb.mdb';
end;
//显示内存总数,内存是使用率
label2.Caption:=
formatfloat('#,###"KB"',mymemorystatus.dwTotalPhys/1024);
label4.Caption:=
format('%d%%',[mymemorystatus.dwmemoryload]);
先登陆到那台机子
然后就可以用"//"来访问了
sendmessage(self.handel,WM_CLOSE,0,0);//发送关闭窗口的消息
你的问题应该是窗体没有free掉
在formclose事件中写入 Action := CaFree;
怎样让Edit只能输入中文
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if ord(key)<128 then key:=#0;
end;
不过要判断一下delete和backspace
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (ord(key)<128) then
if (key<>#8) and (key<>#32) then key:=#0;
end;
edit组件中显示的文字,如何让它居中或者居右对齐啊!
不胜感谢
对着控件单击右键,有个 position 属性
Top
回复人: luke5678(奇异) ( ) 信誉:101 2004-9-23 10:23:56 得分: 0
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong(Edit1.Handle, GWL_STYLE,
GetWindowlong(Edit1.Handle, GWL_STYLE) + ES_CENTER); //居中
Edit1.Refresh;
SetWindowLong(Edit2.Handle, GWL_STYLE,
GetWindowlong(Edit2.Handle, GWL_STYLE) + ES_RIGHT); //居右
Edit2.Refresh;
end;
var
defstyle: dWord;
begin
defstyle := GetWindowLong(Edit1.Handle, GWL_STYLE);
SetWindowLong(Edit1.Handle, GWL_STYLE, defstyle or ES_RIGHT)
end;
Top
回复人: lzy6204(为了忘却的记忆) ( ) 信誉:101 2004-9-23 10:36:40 得分: 20
重载,自己写
[转]:将下面控件安装到你的delphi中就行了
--------------------------------------
unit AEdit;
interface
uses
Windows,
SysUtils,
Messages,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
Menus,
StdCtrls,
ExtCtrls;
type
TEoCEdit = class(TEdit)
private
{ Private declarations }
FAlignment: TAlignment;
protected
{ Protected declarations }
function GetAlignment: TAlignment; virtual;
procedure SetAlignment(newValue: TAlignment); virtual;
procedure CreateParams(var Params: TCreateParams); override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published properties and events }
property Alignment: TAlignment read GetAlignment write SetAlignment; { Published }
end; { TEoCEdit }
procedure Register;
implementation
function TEoCEdit.GetAlignment: TAlignment;
{ Returns the value of data member FAlignment. }
begin
GetAlignment := FAlignment;
end; { GetAlignment }
procedure TEoCEdit.SetAlignment(newValue: TAlignment);
{ Sets data member FAlignment to newValue. }
begin
if FAlignment <> newValue then
begin
FAlignment := newValue;
if not (csLoading in componentstate) then ReCreateWnd;
end;
end; { SetAlignment }
destructor TEoCEdit.Destroy;
begin
inherited Destroy;
end; { Destroy }
constructor TEoCEdit.Create(AOwner: TComponent);
{ Creates an object of type TEoCEdit, and initializes properties. }
begin
inherited Create(AOwner);
{ Initialize properties with default values: }
FAlignment := taLeftJustify;
end; { Create }
procedure TEoCEdit.CreateParams(var Params: TCreateParams);
const
Alignments: array[TAlignment] of WORD = (ES_LEFT, ES_RIGHT, ES_CENTER);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or Alignments[FAlignment];
end;
procedure Register;
begin
RegisterComponents('EoC', [TEoCEdit]);
end; { Register }
end.
这段代码行
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong(Edit1.Handle, GWL_STYLE,
GetWindowlong(Edit1.Handle, GWL_STYLE) + ES_CENTER); //居中
Edit1.Refresh;
SetWindowLong(Edit2.Handle, GWL_STYLE,
GetWindowlong(Edit2.Handle, GWL_STYLE) + ES_RIGHT); //居右
Edit2.Refresh;
end;
//opendialog的使用方法
if openDialog1.Execute then
begin
s:=ExtractFilePath(opendialog1.FileName);
edit3.text:=s+'lklb.mdb';
end;
//显示内存总数,内存是使用率
label2.Caption:=
formatfloat('#,###"KB"',mymemorystatus.dwTotalPhys/1024);
label4.Caption:=
format('%d%%',[mymemorystatus.dwmemoryload]);
相关文章推荐
- csdn编辑代码收集
- 时间滚动选择器---csdn收集的大神代码,忘了是哪位大神了,共享下,看到的都可以用
- [CSDN代码夏令营]spark-webserver 第一周报告
- css特殊效果代码收集
- 收集了几款开源和商业的支持JavaScript代码覆盖率的工具
- 复制CSDN的BLOG代码,去掉前面行号的方法
- iPhone代码片段收集(持续更新)
- mysql相关攻击代码收集
- Android开发人员不得不收集的代码(blankj:utilcode)
- 收集的网络上大型的开源图像处理软件代码(提供下载链接)
- 收集的网络上大型的开源图像处理软件代码(提供下载链接)
- Hook IofCallDriver 代码收集
- csdn发表文章的时候去除代码中的span标签
- 关于.net的设计模式的几篇文章--收集自CSDN
- iOS中 最新收集的代码块(汇总) 韩俊强的博客
- 优秀代码收集
- 如何在CSDN博客中的所贴的代码进行【代码块】显示
- 代码片段收集
- js 返回代码收集