Delphi

Print a TDBGrid [duplicate]

萝らか妹 提交于 2020-02-01 05:36:39
问题 This question already has answers here : Printing a TDBGrid (4 answers) Closed 2 years ago . How can I print a DBGrid without installing or downloading components? OR How can I get a DBGrid's data into a RichEdit so that I can print it from there? 回答1: Data aware controls get their data from DataSource property, use that. You have to manually traverse it though, no instant way possible (without third party libraries / components). 回答2: You will need to be able to work out an appropriate print

Debug information {$D+} increases the size of my EXE with 6MB

戏子无情 提交于 2020-02-01 04:45:05
问题 Delphi documentation says that "Debug information [...] it does not affect the size or speed of the executable program." However, when I activate Debug information (in Project Options -> Linker) my EXE goes from 1.8MB to 7MB. What am I doing wrong? Note: I suppose that the 'Debug information' under 'Linking' is the same as 'Debug information' under 'Compiling' since they have the same compiler directive ( {$D} ). 回答1: Your assumption is incorrect. Compiling with debug information means that

DELPHI判断是否联网

此生再无相见时 提交于 2020-02-01 03:24:43
判断是否联网 在uses中加入WinInet if InternetCheckConnection('http://www.sina.com.cn',1,0) then begin showmessage('在线'); end else begin showmessage('离线'); end; 或直接用ping后,查看(0% loss)或(100% loss),可知在线或离线 来源: CSDN 作者: qq_18932003 链接: https://blog.csdn.net/qq_18932003/article/details/103599486

关于Delphi中的字符串的浅析

谁都会走 提交于 2020-02-01 02:11:41
只是浅浅的解析下,让大家可以快速的理解字符串。 其中的所有代码均在Delphi7下测试通过。 Delphi 4,5,6,7中有字符串类型包括了: 短字符串(Short String) 长字符串(Long String) 宽字符串(Wide String) 零结尾字符串(Null-Terminated String)、PChar和字符数组 1、短字符串(Short String) 固定长度,最大字符数个数为255,短字符串也成为长度字节(Length-byte)字符串,这时因为短字符串的第0个元素包含了这个字符串的长度(字符串中字符的个数)。因此ShortString的缺省最大长度为256个字节(255个字符+1个长度字节=256),声明一个短字符串有两种方式,如下: var S: ShortString; { 255个字符长度,256个字节} S1: String[255]; { S1和S的字符类型一样} Len: Integer; begin S := 'Hello'; Len := Ord(S[0]); { Len现在包含S的长度为5,Ord函数可以把一个字符类型转换为整数类型} Len := SizeOf(S); { Len现在包含的是ShortString类型的大小,为256字节} end; 以上例子通过S[0]可以获得S的字符串长度

Delphi中一些DLL的运用。

微笑、不失礼 提交于 2020-02-01 01:21:51
临时转载一些别人的代码: 代码 dll 调用部分: { **************************************************************** } { } {  Project: DllDebug             } {  Copyright(c) 2003, 2005                 } {  Unit for UCommonUnit                   } {  Create : 2003-01-05 by 林红卫             } {  Modify : 2003-01-16 by 林红卫             } { } { **************************************************************** } unit UCommonUnit; interface uses Windows, SysUtils, Forms; type TRunDLL = procedure (DLLName, FormName, FormCaption: PChar; aApp: TApplication; Scr: TScreen) stdcall ; procedure RunDLLForm(DLLName, FormName,

Delphi中的参数传递

眉间皱痕 提交于 2020-02-01 01:15:30
Delphi中的参数传递 大家在使用C++的时候可以使用引用和值拷贝来传递参数,其实在Delphi中也是可以的。 下面讲怎么使用,使用拷贝参数传递,用法就是我们一般的使用的方法,下面是一个例子 1 procedure noRef(i : integer ); 2 begin 3 i := i * 5 ; 4 end ; 如果是引用参数传递,可以看下面的例子 1 procedure ref( var i : integer ); 2 begin 3 i := i * 5 ; 4 end ; 这两个例子的差别就是在参数列表中相差一个 var,使用var的就是引用传参数了。引用比拷贝参数的运行效率高,但用的时候需要更多的注意,应该会改变参数的值。 下面是一个例子程序 可以 下载 download 来源: https://www.cnblogs.com/BlueMagic/archive/2006/04/29/389095.html

Delphi中一些DLL的运用(要传递Application和Screen,似乎还忘了传递提示控件)

浪尽此生 提交于 2020-02-01 00:21:46
dll 调用部分: {****************************************************************} { } { Project: DllDebug             } { Copyright(c) 2003, 2005                 } { Unit for UCommonUnit                   } { Create : 2003-01-05 by 林红卫             } { Modify : 2003-01-16 by 林红卫             } { } {****************************************************************} unit UCommonUnit; interface uses Windows, SysUtils, Forms; type TRunDLL = procedure(DLLName, FormName, FormCaption: PChar; aApp: TApplication; Scr: TScreen) stdcall; procedure RunDLLForm(DLLName, FormName, FormCaption: string; aApp:

delphi之self

本秂侑毒 提交于 2020-01-31 19:24:24
在使用delphi的对象技术的时候,经常会看到一个词汇:self,它到底指的是什么呢?我们还要从对象与类的关系谈起。类是对将要创建的对象的性质的描述,是一种文档。这很重要:类只是一段描述性的文字,它并不会真去分配内存,无论在其中定义多少变量。如果打个比方,类就是图纸,而对象就是根据图纸盖的房子。对象是真正在内存中存在的东西,是运行“实体”。根据一份图纸可以盖多个相似的房子,同样道理,根据一个类,可以创建多个类似的对象,这个过程叫做“实例化”。在delphi中使用对象技术,要遵循以下的步骤: 1。定义一个类 2。用该类声明一个名字(实质是一个指针) 3。用该类实例化一个对象,并使它与先前的名字联系起来 4。调用对象的方法或属性 5。释放对象 下面我们写一个最简单的表达累加器功能的类 type TCount = class private FNum: integer; // 记录有多少个数字被累加 FSum: integer; // 当前的累加和 pubic procedure Add(n: integer) // 把整数n累加进去 procedure clear; // 清零 procedure show; // 显示当前信息 constructor create; // 构造函数 end; .... 使用的过程是这样的: var a: TCount; // 这里只是声明了一个名字

delphi 动态数组

元气小坏坏 提交于 2020-01-31 19:19:27
在设计一些需要数组的例程时,可能不知道该数组中会需要多少个元素,可能是10个,100个,1000个等.这些都只有到了实际运行的时候才能得到答案.由于对数组不确定大小,因此很难将数组声明一个局部变量(声明过大,会使栈负担过重),所以在堆上进行分配. delphi支持的第一种技术 type PMyArray:^TMyArray; TMyArray : Array[0..0] of TMyType; //声明一个TMyType类型的数组begin GetMem(PMyArray,42 * SizeOf(TMyType));//分配42个TMyType内存大小 //释放PMyArray FreeMem(PMyArray,42 * SizeOf(TMyType));end; 直到释放内存,PMyArray都指向一个包含42个TMyType元素的数组,编译代码时无法使用{$R+}进行越界检查,因为编译器认为数组中只有一个元素.因此只有一个下标能使用=>0 第二种方法 通过将数组类型的上界置为一个很大的数,也可以解决,但会带来一个负面的作用:作何未达到上界的限制的下标值都将变得合法.如 对于一个42个某种类型的元素数组,若分配以1000个元素,在编译进行越界检查时,所以42~999的下标都将合法 第二个问题 是所分配的变量对于数组中有多少元素没有记录,一般情况下,必须将元素的个数保存为一个变量

Are there any “mind mapping” components for Delphi? (native VCL preferably) [closed]

允我心安 提交于 2020-01-31 18:03:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm looking for a pre-written component (w/source) for a Delphi project that I'm working on, to generate mind-maps / concept-maps similar to these: http://en.wikipedia.org/wiki/Image:MindMeister_screenshot_OS_X.jpg http://en.wikipedia.org/wiki/Image:XMIND_2008_in_Windows_Vista.png Any ideas? 回答1: As a former