首页 > TAG信息列表 > delphi

Delphi 经典游戏程序设计40例 的学习 例30 残留的轨迹是圆形运动

unit R30; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TRei30 = class(TForm) Panel1: TPanel; Button1: TButton; ScrollBar1: TScrollBar; ScrollBar2: TScr

Delphi 新语法:泛型

  这里的新语法一般指Delphi7不支持的语法,高版本中会经常遇到,所以花一点时间学会使用它。泛型是一种特殊的类型。你不用一开始就指明参数的具体类型,而是先定义一个类型变量,在使用的时候再确定参数的具体类型。准备从万一博客中学习,节约翻找资料的时间。 最简单的泛型 一开始我们

Delphi 经典游戏程序设计40例 的学习 例29 残留的轨迹是钟摆线

    unit R29; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TRei29 = class(TForm) Panel1: TPanel; Button1: TButton; ScrollBar1: TScrollBar; ScrollBar2:

Delphi 新语法:For in语句

据说Delphi 2005开始支持For in语句.并没有深入调查,依然从万一博客学习并整理. 一、遍历 TStrings var List: TStrings; s: string; begin List := TStringList.Create; List.CommaText := 'aaa,bbb,ccc'; for s in List do ShowMessage(s); List.Free; end;

delphi 常用控件属性设置说明

常用DELPHI控件属性设置说明目录TForm Class TPanel组件 TToolBar Class TToolButton Class TTimer Class TADOConnection Class TADOQuery Class TADODataSet Class TDBGrid Class TADOStoredProc Class TButton Class TBitBtn Class TComboBox Class TStaticTex

delphi dxBarManager的dxBarEdit输入问题

问题:dxBarManager1 里面添加了cxBarEditItem1 这是个文本框,运行可以输入内容,但是当焦点失去时,刚刚输入的内容没了.只能每次输完内容后一定要按回车才能保存内容.这里面所有能改变值的控件都是这样子的,有没有什么办法可以在控件去焦点时,自动保存刚刚的更改?我试过sendmessage

delphi TcxGrid网格组件:OnGetContentStyle 获取内容UI样式事件 的应用

1.位置:OnGetContentStyle事件,在事件列表的Style下. 2.OnGetContentStyle何时触发: 当获取内容数据的UI样式(style)时触发此事件. 注意,用户每次点击单元格时,都会触发此事件! 3.参数解释 procedure TForm1.cxGrid1DBTableView1StylesGetContentStyle(Sender: TcxCustomGridTabl

delphi 各新版本特性收集(转)

Delphi XE6新增了一些特性并增强了原有的功能,主要有以下几个方面:   IDE(整合开发环境)   Internet XML(扩展标记语言) Compiler(编译器) COM/Active X Database support(数据库支持) CORBA Actions(动作) Custom Variants(可定义的可变类型) VCL 单元和特性 RTL单元和特性 Cross-platform de

Delphi各个版本和发展历史(转)

Delphi,是Windows平台下著名的快速应用程序开发工具(Rapid Application Development,简称RAD)。它的前身,即是DOS时代盛行一时的“BorlandTurbo Pascal”,最早的版本由美国Borland(宝兰)公司于1995年开发。主创者为Anders Hejlsberg。经过数年的发展,此产品也转移至Embarcadero公司旗下。

Delphi:StringList Delimiter默认受空格字符影响,如何解决

stringlist通过Delimiter方法获取切割字符,默认受空格字符影响。   var   sl: TStringList;   str: string;   i: Integer;begin   str := 'aa,b b,cc,dd';   sl := TStringList.Create;   sl.Delimiter := ',';      //设置判断特殊字符截取不同内容   sl.De

Delphi 中constructor、destructor、property关键字的用法

首先搜索现成的文章学习 原文:https://www.cnblogs.com/guorongtao/p/15132445.html 其次自己理解并总结最常见的用法 constructor用来定义构造函数,destructor用来定义析构函数,property用来定义属性。 constructor后面一般跟Create,destructor后面一般跟Destroy; override; 创建一

delphi TMS FlexCel 导出PDF

TMS FlexCel 导出PDF 属性和方法 TFlexCelPdfExport 用于将Excel文件导出为PDF的组件。 unit FlexCel.Render TFlexCelPdfExport.Create constructor Create(const aWorkbook: TExcelFile); constructor Create(const aWorkbook: TExcelFile; const aAllowOverwritingFiles: Boole

Delphi 高低字节交换

内存中的字节顺序与网络传输的字节顺序是不一样的,用名词说就是大端存储和小端存储的区别,有时候就需要转换。 Delphi7不支持inline内联函数,可以把inline去掉。 function Swap16(const Value: Word): Word; inline; begin Result := Swap(Value); end; function Swap32(const Val

Delphi 中的换行符sLineBreak

其实就是#13#10 //Delphi7中: const sLineBreak = {$IFDEF LINUX} #10 {$ENDIF} {$IFDEF MSWINDOWS} #13#10 {$ENDIF}; //Delphi11中: const sLineBreak = {$IFDEF POSIX} _AnsiStr(#10) {$ENDIF} {$IFDEF MSWINDOWS} _AnsiStr(#13#10) {$ENDIF};

delphi 调用编写Word、Execl

使用VBA接口实现。 VBA官方接口: Office Visual Basic for Applications (VBA) 参考 | Microsoft Docs 常用办公三件套的接口和其他的软件接口齐全。 打开Word : uses ComObj ///声明,所有VBA相关的对象都使用Variant实现 wApp,eApp,wordRange:Variant; ///实现 try wApp:=Get

解决Delphi传stream参数时出现Stream read error错误提示

有时候我们会把内存流,文件流等作为参数传递给函数内部使用。 在传参之前必须加上 dMem.Position := 0; 不然就会出错。 因为如果dMem流是作为其他函数输出流的话,它的Position是在最后的。 dMem.Position := 0; Base64Encode(dMem, Result);

delphi 做一个动态PopupMenu菜单

效果要求: 点击树形结构不同的行,弹出不一样的下拉菜单 窗体设计:    数据库设计:   实际效果:   核心代码: procedure TForm1.PopupMenu1Popup(Sender: TObject); var iType: Integer; begin with FDQuery1 do begin if RecordCount = 0 then // 当没有数

[delphi踩坑] ActiveList成员取名不能与属性名相同

   刚开始新建时,我acok是取名为mrok,acno是取名mrno,所以直接弹错"TModalResult" 与 "TAction"不兼容 最后是在重写 ModalResult:=mr....时,看到mrok和mrno提示后面的属性,居然是TAction,才明白原来是取名不规范造成的! 大致如下:    正常情况是这样的:  

delphi基于结构的CRUD(JSON)

delphi基于结构的CRUD(JSON) 以采购订单为例。 unit rest.tcgddtcgdd2; //代码由代码工厂自动生成 //2022-08-20 16:04:54 {$I def.inc} interface uses {$IFDEF firedac} db.firedac, db.firedacPool, {$ENDIF} {$IFDEF unidac}db.unidac, db.unidacpool, {$ENDIF} class

Delphi 让Listview中的item可以显示不同的颜色

procedure TFormAlissaA.ListViewAAdvancedCustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage; var DefaultDraw: Boolean); begin if Item.SubItems[0] = 'Send' then begin Sender.Canvas.Fon

Delphi获取进程的窗口句柄的三种方式

handle := FindWindow(nil,PChar('窗口的标题')); 或者: procedure TForm1.Button1Click(Sender: TObject); var   hCurrentWindow: HWnd;   WndText:String; begin   hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST); while hCurrentWindow <> 0 do begin   Wnd

Delphi 判断某个系统服务是否存在及相关状态

1 记得use WinSvc; 2 3 //------------------------------------- 4 // 获取某个系统服务的当前状态 5 // 6 // return status code if successful 7 // -1 if not 8 // 9 // return codes: 10 // SERVICE_STOPPED 11 // SERVICE_RUNNING 12 // SERVICE_PAUS

Delphi 更改扩展名函数ChangeFileExt

function ChangeFileExt(const FileName, Extension: string): string; var I: Integer; begin I := LastDelimiter('.' + PathDelim + DriveDelim,Filename); if (I = 0) or (FileName[I] <> '.') then I := MaxInt; Result := Copy(FileN

Delphi 生成随机字符串函数RandomStr

可以生成自定义长度的随机字符串,字符串可以是大小写字母、数字或者是他们的混合。 function RandomStr(StrLength: Integer; Lowercase: Boolean = True; Number: Boolean = True; Uppercase: Boolean = False): string; const UpperStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; Lowe

Delphi 生成随机汉字函数GenerateChineseWords

根据c#改编而来,很多年了。 function GenerateChineseWords(count: integer): string; var i: integer; regionCode, positionCode: integer; regionCode_Machine, positionCode_Machine: integer; chineseWords: string; begin Randomize; for i := 0 to count - 1 do