现在使用控件, 更喜欢继承
摘要:以前写代码, 总是把主单元弄得满满当当; 现在更喜欢把控件比较独立的功能写成一个单元, 改写属性、重载方法...哪怕只有一点点和默认不同, 也喜欢独立出来.刚刚用到 TListBox, 需要能拖动元素、双击删除.unit ListBox2;interfaceuses System.Classes, Vcl.Controls, Vcl.StdCtrls, System.Types;type TListBox2 = class(TCustomListBox) protected procedure DragOver(Source: TObject; X: Integer; Y: Int...
阅读全文
posted @
2013-07-24 13:20
万一
阅读(5224)
推荐(1) 编辑
写了一个字符串的二维表: TSta
摘要:STA 单元 (用到 System.SysUtils.TStringHelper):unit STA;interfaceuses System.SysUtils, System.Classes;type TSta = record FSeparator: Char; FArr: TArray>; constructor Create(const aStr: string; const aSeparator: Char = ';'); overload; class operator Explicit(const aStr: string): TSta; clas...
阅读全文
posted @
2013-07-23 14:50
万一
阅读(3005)
推荐(1) 编辑
XP 之后, Delphi 动注册表不方便了...逼出来一个办法:
摘要:手头的程序需要修改注册表, 以让当前程序成为某格式的默认打开程序并关联图标; Vista 之后需要管理员权限才能操作注册表, 很麻烦, 所以有了下面的尝试.unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;type TForm1 = class(TForm) Memo1: TMemo; ...
阅读全文
posted @
2013-07-10 14:33
万一
阅读(2498)
推荐(0) 编辑
Delphi 资源管理器套件
摘要:需要个类似资源管理器的东西, 首先试了下 TDriveComboBox、TDirectoryListBox、TFileListBox, 嘿! Win31 时代的东西, 不是一般地丑.试了下 Vcl.Shell.ShellCtrls 下的 TShellComboBox、TShellTreeView、TShellListView, 非常满意! 并且 TShellComboBox 也可以免掉了.unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Clas.
阅读全文
posted @
2013-07-08 00:11
万一
阅读(4843)
推荐(0) 编辑
做了一个 62 进制的简单实现
摘要:62 进制需要的字符及次序: 0..9 a..z A..Z; 只实现了 62 进制字符串与正整数的互换.unit H62;interfaceuses SysUtils;function IntToH62(N: UInt64): string; //整数转到 62 进制字符串function H62ToInt(S: string): UInt64; //62 进制字符串转到整数implementationfunction _C2B(C: Char): Byte; inline;begin Result := 0; if CharInSet(C, ['0'..'9'
阅读全文
posted @
2013-07-04 18:33
万一
阅读(3935)
推荐(0) 编辑