delphi 开发使用的基类D

unit Common;

interface

uses Classes, Windows, Forms, SysUtils, StdCtrls, Grids, Types, Registry,
  Messages, ShellAPI, Graphics;

type
  TCommon = class(TComponent)
  public
    function GetAppPath: string; // 取应用程序当前路径
    function GetTempDirectory: string; //取得操作系统临时目录的位置
    function DelFolder(const AsFolder: string): Boolean; //删除一个文件夹
    function DoubleToSingle(ADoubleStr: string): string;//将全角变成半角
    function JudgeAnsiChar(AStr: string): Boolean; //判断一个字符串是否为全英文字符
    function FillDigit(AText: string; ADigitCount: Integer): string;//设置字符的长度,如果不足补0
    function IfListExist(AString: TStrings; AFindString: string): Boolean;  //查找在列表中是否存在
    procedure QueryPress(Sender: TObject; var Key: Char);// 限制在查询输入框中不能输入单引号及双引号}
    procedure PressNumber(Sender: TObject; var Key: Char);// 限制只能输入数字、退格、TAB及回车键
    procedure PressFloat(Sender: TObject; var Key: Char);// 限制只能输入数字、退格、TAB及回车键和小数点

    procedure ShowInfo(AHelpString: string);  // 弹出 MessageBox 对话框(普通的对话框)
    procedure ShowError(AHelpString: string); // 弹出 MessageBox 对话框(显示错误的对话框)
    function IfShowOk(AHelpString: string): Boolean; // 弹出 MessageBox 对话框(有两个选项的选择对话框)
    function IfShowYesNoCancel(AHelpString: string): Integer; // 弹出 MessageBox 对话框(有三个选项的选择对话框)
    procedure ShowIconInfo(AInfoStr: string; AIconFlag: LongInt);  //弹一个可选择图标的提示框
    function ShowIconOKCancel(AInfoStr: string; AIconFlag: LongInt): Boolean;  //弹出可选择图标MessageBox 对话框(有两个选项的选择对话框)
    function ShowIconYesNoCancel(AInfoStr: string; AIconFlag: LongInt): Integer;  //弹出可选择图标的 MessageBox 对话框(有三个选项的选择对话框)

    procedure IdentityCard(AIdentity: string; var ASex: string;
              var ABirthDay: TDateTime; var AErrorCount: Integer);  //身份证的验证和属性分解
    procedure SetSgPos(ASg: TStringGrid; ACol, ARow: Integer; ARect: TRect; APos: string); //改变StringGrid内容的位置

    function EncryptStr(AStr: string): string; //加密字符串
    function DecodeStr(AStr: string): string; //解密字符串
    function ExistName(AName: string; AStringList: TStrings): Boolean;

    procedure ComboBoxLength(AComboBox: TComboBox);
    procedure ShowSql(ASqlText: string);
    function GetTimeString(AiTime: Integer): string;
    procedure DoTip(AifShow: Boolean; AStr: string = '');  //弹出数据处理提示框(过渡窗口)
  end;

const
  cCheck = '√';

var
  Common: TCommon;
  SDGsSkin, SDGsUseSkin: string;
  SDGiYear, SDGiMonth, SDGiDay: Word;
  SDGdtStart, SDGdtEnd: TDateTime;

implementation

uses afrmSqlMemo, afrmTip;

{ TCommon }

function TCommon.GetAppPath: string;
begin
  Result := ExtractFilePath(Application.ExeName);
end;

//弹一个可改变提示图标的对话框
procedure TCommon.ShowIconInfo(AInfoStr: string; AIconFlag: Integer);
begin
  Application.MessageBox(Pchar(AInfoStr), PChar('系统提示:'), AIconFlag + MB_OK);
end;

// 弹出可选择图标MessageBox对话框(有两个选项的选择对话框)
function TCommon.ShowIconOKCancel(AInfoStr: string;
  AIconFlag: Integer): Boolean;
begin
  if App

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值