delphin代码

合集下载

delphi 类型定义

delphi 类型定义

delphi 类型定义Delphi是一种基于Object Pascal语言的集成开发环境(IDE),在编程时经常需要定义各种类型,以表示不同的数据结构和对象。

类型定义是编程中非常重要的一部分,它可以帮助我们更好地组织和管理代码。

在Delphi中,可以通过使用Type关键字来定义各种类型。

下面是一些常见的类型定义示例:1. 简单类型:Delphi支持各种基本的简单数据类型,如整型(Integer)、字符型(Char)、字符串型(String)、浮点数型(Float)等。

可以使用Type关键字来定义这些简单类型,例如:```typeTInteger = Integer;TChar = Char;TString = String;TFloat = Float;```2. 数组类型:数组是一种由相同类型的元素组成的数据结构,在Delphi中可以使用Type关键字来定义数组类型,例如:```typeTIntegerArray = array of Integer;TStringArray = array of String;```上述代码定义了两种数组类型,TIntegerArray表示由整数元素组成的数组,TStringArray表示由字符串元素组成的数组。

3. 记录类型:记录是一种复合数据类型,它由多个字段组成。

在Delphi中,可以使用Type关键字来定义记录类型,例如:```typeTPerson = recordName: string;Age: Integer;Gender: string;end;```上述代码定义了一个TPerson类型的记录,包含三个字段:Name、Age和Gender。

4. 枚举类型:枚举是一种特殊的类型,它用于定义一组可能的取值。

在Delphi中,可以使用Type关键字来定义枚举类型,例如:```typeTColor = (Red, Green, Blue);```上述代码定义了一个TColor类型的枚举,包含三个取值:Red、Green和Blue。

delphi版本的Base64解码编码源代码

delphi版本的Base64解码编码源代码

delphi版本的Base64解码编码源代码Unit CnBase64;InterfaceUsesSysUtils, Windows;Function Base64Encode(InputData: String; Var OutputData: String): byte;{* 对数据进行BASE64编码,如编码成功返回Base64_OK|InputData:string - 要编码的数据var OutputData: string - 编码后的数据|}Function Base64Decode(InputData: String; Var OutputData: String): byte;{* 对数据进行BASE64解码,如解码成功返回Base64_OK|InputData:string - 要解码的数据var OutputData: string - 解码后的数据|}ConstBASE64_OK = 0; // 转换成功BASE64_ERROR = 1;// 转换错误(未知错误)(e.g. can't encode octet in input stream) -> error in implementation BASE64_INV ALID = 2;// 输入的字符串中有非法字符(在FilterDecodeInput=False 时可能出现)BASE64_LENGTH = 3; // 数据长度非法BASE64_DATALEFT = 4;// too much input data left (receveived 'end of encoded data' but not end of input string) BASE64_PADDING = 5; // 输入的数据未能以正确的填充字符结束ImplementationVarFilterDecodeInput: Boolean = true;ConstBase64TableLength = 64;Base64Table : String[Base64TableLength] ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+*'; Pad = '=';Function Base64Encode(InputData: String; Var OutputData: String): byte;Vari : integer;CurrentB, PrevB : byte;c : byte;s : char;InputLength : integer;Function ValueToCharacter(value: byte; Var character: char): Boolean;//****************************************************************** // 将一个在0..Base64TableLength-1区间内的值,转换为与Base64编码相对应// 的字符来表示,如果转换成功则返回True//****************************************************************** Beginresult := true;If (value > Base64TableLength - 1) Thenresult := falseElsecharacter := Base64Table[value + 1];End;BeginOutputData := '';InputLength := Length(InputData);i := 1;If (InputLength = 0) Then Beginresult := BASE64_OK;Exit;End;Repeat// 第一次转换CurrentB := Ord(InputData[i]);i := i + 1;InputLength := InputLength - 1;c := (CurrentB Shr 2);If Not ValueToCharacter(c, s) Then Beginresult := BASE64_ERROR;Exit;End;OutputData := OutputData + s;PrevB := CurrentB;// 第二次转换If InputLength = 0 ThenCurrentB := 0Else BeginCurrentB := Ord(InputData[i]);i := i + 1;End;InputLength := InputLength - 1;c := (PrevB And $03) Shl 4 + (CurrentB Shr 4);//取出XX后4位并将其左移4位与XX右移4位合并成六位If Not ValueToCharacter(c, s) Then{//检测取得的字符是否在Base64Table内} Beginresult := BASE64_ERROR;Exit;End;OutputData := OutputData + s;PrevB := CurrentB;// 第三次转换If InputLength < 0 Thens := PadElse BeginIf InputLength = 0 ThenCurrentB := 0Else BeginCurrentB := Ord(InputData[i]);i := i + 1;End;InputLength := InputLength - 1;c := (PrevB And $0F) Shl 2 + (CurrentB Shr 6);//取出XX后4位并将其左移2位与XX右移6位合并成六位If Not ValueToCharacter(c, s) Then{//检测取得的字符是否在Base64Table内} Beginresult := BASE64_ERROR;Exit;End;End;OutputData := OutputData + s;// 第四次转换If InputLength < 0 Thens := PadElse Beginc := (CurrentB And $3F); //取出XX后6位If Not ValueToCharacter(c, s) Then{//检测取得的字符是否在Base64Table内} Beginresult := BASE64_ERROR;Exit;End;End;OutputData := OutputData + s;Until InputLength <= 0;result := BASE64_OK;End;Function Base64Decode(InputData: String; Var OutputData: String): byte;Vari : integer;InputLength : integer;CurrentB, PrevB : byte;c : byte;s : char;Function CharacterToValue(character: char; Var value: byte): Boolean;//****************************************************************** // 转换字符为一在0..Base64TableLength-1区间中的值,如果转换成功则返// 回True(即字符在Base64Table中)//****************************************************************** Beginresult := true;value := Pos(character, Base64Table);If value = 0 Thenresult := falseElsevalue := value - 1;End;Function FilterLine(InputData: String): String;//****************************************************************** // 过滤所有不在Base64Table中的字符,返回值为过滤后的字符//****************************************************************** VarF : byte;i : integer;Beginresult := '';For i := 1 To Length(InputData) DoIf CharacterToValue(InputData[i], F) Or (InputData[i] = Pad) Thenresult := result + InputData[i];End;BeginIf (InputData = '') Then Beginresult := BASE64_OK;Exit;End;OutputData := '';If FilterDecodeInput ThenInputData := FilterLine(InputData);InputLength := Length(InputData);If InputLength Mod 4 <> 0 Then Beginresult := BASE64_LENGTH;Exit;End;i := 0;Repeat// 第一次转换i := i + 1;s := InputData[i];If Not CharacterToValue(s, CurrentB) Then Begin result := BASE64_INV ALID;Exit;End;i := i + 1;s := InputData[i];If Not CharacterToValue(s, PrevB) Then Begin result := BASE64_INV ALID;Exit;End;c := (CurrentB Shl 2) + (PrevB Shr 4); OutputData := OutputData + Chr(c);// 第二次转换i := i + 1;s := InputData[i];If s = Pad Then BeginIf (i <> InputLength - 1) Then Beginresult := BASE64_DATALEFT;Exit;EndElseIf InputData[i + 1] <> Pad Then Beginresult := BASE64_PADDING;Exit;End;EndElse BeginIf Not CharacterToValue(s, CurrentB) Then Begin result := BASE64_INV ALID;Exit;End;c := (PrevB Shl 4) + (CurrentB Shr 2); OutputData := OutputData + Chr(c);End;// 第三次转换i := i + 1;s := InputData[i];If s = Pad Then BeginIf (i <> InputLength) Then Beginresult := BASE64_DATALEFT;Exit;End;EndElse BeginIf Not CharacterToValue(s, PrevB) Then Begin result := BASE64_INV ALID;Exit;End;c := (CurrentB Shl 6) + (PrevB); OutputData := OutputData + Chr(c);End;Until (i >= InputLength);result := BASE64_OK;End;End.Function Base64Encode(mSource: String; mAddLine: Boolean = True): String; VarI, J: Integer;S: String;BeginResult := '';J := 0;For I := 0 To Length(mSource) Div 3 - 1 Do BeginS := Copy(mSource, I * 3 + 1, 3);Result := Result + cBase64[Ord(S[1]) Shr 2 + 1];Result := Result + cBase64[((Ord(S[1]) And $03) Shl 4) + (Ord(S[2]) Shr 4) + 1];Result := Result + cBase64[((Ord(S[2]) And $0F) Shl 2) + (Ord(S[3]) Shr 6) + 1];Result := Result + cBase64[Ord(S[3]) And $3F + 1];If mAddLine Then BeginInc(J, 4);If J >= 76 Then BeginResult := Result + #13#10;J := 0;End;End;End;I := Length(mSource) Div 3;S := Copy(mSource, I * 3 + 1, 3);Case Length(S) Of1: BeginResult := Result + cBase64[Ord(S[1]) Shr 2 + 1];Result := Result + cBase64[(Ord(S[1]) And $03) Shl 4 + 1];Result := Result + cBase64[65];Result := Result + cBase64[65];End;2: BeginResult := Result + cBase64[Ord(S[1]) Shr 2 + 1];Result := Result + cBase64[((Ord(S[1]) And $03) Shl 4) + (Ord(S[2]) Shr 4) + 1];Result := Result + cBase64[(Ord(S[2]) And $0F) Shl 2 + 1];Result := Result + cBase64[65];End;End;End; { Base64Encode }Function Base64Decode(mCode: String): String;VarI, L: Integer;S: String;BeginResult := '';L := Length(mCode);I := 1;While I <= L Do BeginIf Pos(mCode[I], cBase64) > 0 Then BeginS := Copy(mCode, I, 4);If (Length(S) = 4) Then BeginResult := Result + Chr((Pos(S[1], cBase64) - 1) Shl 2 + (Pos(S[2], cBase64) - 1) Shr 4);If S[3] <> cBase64[65] Then BeginResult := Result + Chr(((Pos(S[2], cBase64) - 1) And $0F) Shl 4 +(Pos(S[3], cBase64) - 1) Shr 2);If S[4] <> cBase64[65] ThenResult := Result + Chr(((Pos(S[3], cBase64) - 1) And $03) Shl 6 +(Pos(S[4], cBase64) - 1));End;End;Inc(I, 4);End Else Inc(I);End;End; { Base64Decode }。

delphi tidbytes 使用 方法

delphi tidbytes 使用 方法

delphi tidbytes 使用方法Delphi TidBytes 使用方法什么是 Delphi TidBytesDelphi TidBytes 是 Delphi 中一个非常有用的类型,它用于表示字节数组。

它在许多网络编程中常被使用,尤其是与 Indy 组件库一起使用时。

TidBytes 的初始化要使用 TidBytes,首先需要对其进行初始化。

可以通过以下方法初始化一个 TidBytes 变量: - 使用SetLength函数直接创建一个指定长度的 TidBytes 变量; - 将一个 TBytes 数组转换为TidBytes; - 使用RawToBytes函数将原始字节数组转换为TidBytes。

TidBytes 的转换TidBytes 可以与其他类型进行相互转换,常见的转换方法有: - 将 TidBytes 转换为字符串:使用BytesToString函数将一个TidBytes 变量转换为字符串; - 将字符串转换为 TidBytes:使用StringToBytes函数将一个字符串转换为 TidBytes。

TidBytes 的操作TidBytes 支持许多常见的操作,包括: - 添加元素:使用BytesOf函数可以将一个或多个元素添加到 TidBytes 变量的末尾;- 删除元素:使用SetLength函数可以删除 TidBytes 变量的指定元素; - 获取长度:使用Length函数可以获取 TidBytes 变量的长度; - 比较:使用CompareBytes函数可以比较两个 TidBytes 变量是否相同; - 查找元素:使用PosBytes函数可以在 TidBytes 变量中查找指定元素。

TidBytes 的使用示例下面是一个使用 TidBytes 的示例代码:varMyBytes: TidBytes;begin// 初始化 MyBytesSetLength(MyBytes, 4);// 将字符串转换为 TidBytesMyBytes := StringToBytes('Hello');// 添加元素MyBytes := BytesOf(MyBytes, [17, 23]);// 删除元素SetLength(MyBytes, 3);// 获取长度ShowMessage(IntToStr(Length(MyBytes)));// 比较两个 TidBytes 变量if CompareBytes(MyBytes, [72, 101, 108, 108, 111]) = 0 thenShowMessage('相同')elseShowMEssage('不同');// 查找元素ShowMessage(IntToStr(PosBytes([101], MyBytes))); end;以上是一些常见的 TidBytes 使用方法和示例代码,希望对你的Delphi 编程有所帮助。

delphi颜色常量 单元

delphi颜色常量 单元

delphi颜色常量单元Delphi是一种流行的编程语言,常用于开发Windows操作系统上的应用程序。

在Delphi中,颜色常量是非常重要的一部分,它们用于设置图形界面中各个控件的颜色属性。

Delphi中定义了一些常用的颜色常量,这些常量可以直接在代码中使用,而不需要手动指定具体的RGB值。

下面是一些常用的Delphi 颜色常量及其对应的颜色值:1. clBlack:黑色(#000000)2. clMaroon:褐红色(#800000)3. clGreen:绿色(#008000)4. clOlive:橄榄色(#808000)5. clNavy:海军蓝(#000080)6. clPurple:紫色(#800080)7. clTeal:蓝绿色(#008080)8. clGray:灰色(#808080)9. clSilver:银色(#C0C0C0)10. clRed:红色(#FF0000)11. clLime:酸橙色(#00FF00)12. clYellow:黄色(#FFFF00)13. clBlue:蓝色(#0000FF)14. clFuchsia:洋红(#FF00FF)15. clAqua:青色(#00FFFF)16. clLtGray:浅灰色(#C0C0C0)17. clDkGray:深灰色(#808080)18. clWhite:白色(#FFFFFF)这些颜色常量可以在编程中轻松地应用于各种图形界面控件的颜色属性设置。

例如,如果想要将一个按钮的背景颜色设置为红色,可以使用以下代码:Button1.Color := clRed;此外,Delphi还提供了其他颜色常量和函数,用于生成更多的颜色变化和效果。

比如,Delphi中有TColor类型的变量,用于存储颜色值,可以用代码:varMyColor: TColor;然后通过函数调用获取具体的颜色值,例如:MyColor := RGBToColor(255, 0, 0); //设置为红色这样,MyColor变量就被设置为了红色的颜色值。

在Delphi编程中使用C语言代码 - 调用C语言编写的DLL文件

在Delphi编程中使用C语言代码 - 调用C语言编写的DLL文件

1、使用Visual C++ 6.0编写和链接DLL打开Visual C++ 6.0集成开发环境,新建一个Win32 Dynamic-Link Library类型的工程CDLL,在工程中新建一个C语言源文件cdll.c。

源文件中的内容如下:__declspec(dllexport) int max(int x,int y) /* 比较两个整型变量大小的函数max */{if (x>y)return x;elsereturn y;}输入完毕后按下F7键来编译和链接CDLL.dll,之后可以在存放该工程的文件夹的Debug子文件夹中找到一个名为CDLL的DLL文件,该文件即以上的C语言源程序生成的DLL。

2、使用Delphi 7编写调用该DLL的应用程序打开Delphi 7集成开发环境,在默认生成的窗体Form1上拖放3个Edit 控件Edit1、Edit2、Edit3和1个Button控件Button1,并在Object Inspector中将3个Edit控件的Text属性都清空。

然后在默认生成的Unit1.pas文件的implementation后输入:function max(x,y: Integer): Integer; stdcall external'CDLL.DLL';返回Form1,双击Button1控件,在生成的事件处理程序中输入:Edit3.Text:=IntToStr(max(StrToInt(Edit1.Text),StrToInt(Edit2.Text)));输入完毕后,保存这个Project。

最后,将CDLL.dll文件copy到保存该Project的文件夹中。

3、测试在Delphi集成开发环境下,按下F9来运行刚刚编写的Project。

在Edit1中输入2,Edit2中输入4,然后单击Button1,可以看到Edit3中会出现4,测试成功。

4、基础知识4.1、回调函数软件模块之间总是存在着一定的接口,从调用方式上,可以把他们分为三类:同步调用、回调和异步调用。

Delphi程序中运行JavaScript脚本代码

Delphi程序中运行JavaScript脚本代码
聚合页的核心是相关性有一定内容支撑的聚合页收录效果尚可对于大型网站技术不是问题对于中小型网站企业官网的用蓝鲸鱼聚合页工具来制作生成的页面相关性高质量比较好比单纯的tag聚合好不少当
DeDelphi程序中运行JavaScript脚本代码
微软Windows操作系统中有一个叫ScriptControl的OCX组件
利用这个组件,可以在自己的程序中运行JavaScript或VBScript这两种脚本代码
使用很简单,新建一个工程,在窗体中放一个Button1控件
在Button1控件的Click事件中写代码如下:
procedure TForm1.Button1Click(Sender: TObject); var js:OleVariant; begin js:=CreateOleObject('ScriptControl');//创建组件 nguage:='JavaScript';//指定组件所使用的语言,也可以是VBScript ShowMessage(js.Eval('100+1'));//计算100+1的值 js:=Unassigned; end;
上例中,使用ScriptControl组件计算出100+1的值,并显示出来
Eval是ScriptControl组件的一个常用方法,返回值是string类型
另一个比较常用的方法是AddCode,如果有比较复杂的脚本代码需要运行,就先用AddCode将脚本代码添加进来,再进行运算

delphi adoquery 方法

delphi adoquery 方法

delphi adoquery 方法在Delphi中,ADOQuery是一个非常常用的数据访问对象,它提供了许多方法来执行数据库操作。

以下是ADOQuery的一些常用方法:1.Close:关闭ADOQuery,释放资源。

2.Open:打开ADOQuery,执行SQL语句并返回结果集。

3.Execute:执行SQL语句,但不返回结果集。

4.Fetch:从结果集中获取一行数据。

5.First、Next、Prior、Last:分别获取结果集中的第一行、下一行、前一行和最后一行数据。

6.Count:获取结果集中的行数。

7.Active:判断ADOQuery是否处于活动状态。

8.Parameters.ParamByName[‘字段名’].Value:获取或设置参数的值。

这些方法可以让你执行查询、插入、删除和修改等操作。

例如,你可以使用以下代码实现插入操作:delphi复制代码ADOQuery.Close;ADOQuery.SQL.Clear;ADOQuery.SQL.Add('insert into YourTable (Field1, Field2) values(:Field1, :Field2)');ADOQuery.Parameters.ParamByName('Field1').Value := 'Value1';ADOQuery.Parameters.ParamByName('Field2').Value := 'Value2';ADOQuery.ExecSQL;在执行查询操作时,你需要先关闭ADOQuery,然后清空SQL语句,添加你的查询语句,并使用Open方法执行查询。

例如:delphi复制代码ADOQuery.Close;ADOQuery.SQL.Clear;ADOQuery.SQL.Add('select * from YourTable where Field1=:Field1');ADOQuery.Parameters.ParamByName('Field1').Value := 'Value1';ADOQuery.Open;。

delphiDBGrid排序的两种方法(自己代码中,测试成功的)

delphiDBGrid排序的两种方法(自己代码中,测试成功的)

在delphi有些第三方控件确实有自带的排序功能,可是对于原始的DBGrid控件不存在自动排序功能,下面是两种不同显示的排序方法。

我自己写成函数,可以调用。

(自己程序中测试成功的)DBGrid排序(◆)procedure SortDBGrid(var DBGrid1: TDBGrid; ClientDataSet: TADOquery;Column: TColumn);vari:integer;beginif Pos('◆',Column.Title.Caption)>0 then beginif Pos(' DESC',ClientDataSet.Sort)>0 THEN BEGINClientDataSet.Sort:=Column.FieldName+' ASC';ENDELSE BEGINClientDataSet.Sort:=Column.FieldName+' DESC';ENDendelse beginfor i:=0 to DBGrid1.Columns.Count-1 do beginIF Pos('◆',DBGrid1.Columns[i].Field.DisplayLabel)>0 THEN BEGINDBGrid1.Columns[i].Title.Caption:=COPY(DBGrid1.Columns[i].Field.Displ ayLabel,1,Pos('◆',DBGrid1.Columns[i].Field.DisplayLabel)-1);ENDELSE BEGINDBGrid1.Columns[i].Title.Caption:=DBGrid1.Columns[i].Field.DisplayLab el;END;end;Column.Title.Caption:=Column.Field.DisplayName+' ◆';ClientDataSet.Sort:=Column.FieldName+' DESC';end;end;DBGrid排序(▲▼ )procedure SortDBGrid(var DBGrid1: TDBGrid; ClientDataSet: TADOquery;Column: TColumn);vari:integer;beginif (pos('▲', Column.Title.Caption)=0) and (pos('▼', Column.Title.Caption)=0) then //说明前面没有排过序beginClientDataSet.Sort:=Column.FieldName+ ' ASC'; //asc一定要大写Column.Title.Caption:='▼'+column.Title.Caption ;endelseif (pos('▲', Column.Title.Caption)=0) then //说明目前是降序beginClientDataSet.Sort:=Column.FieldName+' ASC'; // ↑占用了2个位,所以从第3位开始读真实字段Column.Title.Caption:='▲'+copy(Column.Title.Caption,3,length(Column.Title.Caption)-2);endelseif (pos('▼', Column.Title.Caption)=0) then //说明目前是升序beginClientDataSet.Sort:=Column.FieldName+' DESC';Column.Title.Caption:='▼'+copy(Column.Title.Caption,3,length(Column.Title.Caption)-2) ;end;tryClientDataSet.Active:=true;for i:=0 to DBGrid1.FieldCount-1 dobeginif (i<> Column.Index) thenbeginif (pos('▲', DBGrid1.Columns[i].Title.Caption)<>0) or (pos('▼', DBGrid1.Columns[i].Title.Caption)<>0) thenDBGrid1.Columns[i].Title.Caption:=copy(DBGrid1.Columns[i].Title.Capti on,3,length(DBGrid1.Columns[i].Title.Caption)-2);end;end;exceptshowmessage('排序发生异常!');end;end;。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

颜色:
if colordialog1.Execute then
memo1.Color:=colordialog1.Color;
字体:
if fontdialog1.Execute then
memo1.Font:=fontdialog1.Font;
工具栏:左对齐:memo1.Alignment:=taleftjustify;
m_optionleft.Checked:=true;
m_optioncenter.Checked:=false;
m_optionright.Checked:=false;
radiogroup1.ItemIndex:=0;
居中:memo1.Alignment:=tacenter;
m_optionleft.Checked:=false; //选中标记
m_optioncenter.Checked:=true;
m_optionright.Checked:=false;
radiogroup1.ItemIndex:=1; //单选按钮组第一项被选中
右对齐:memo1.Alignment:=tarightjustify;
m_optionleft.Checked:=false; //选中标记
m_optioncenter.Checked:=false;
m_optionright.Checked:=true;
radiogroup1.ItemIndex:=2; //单选按钮组第一项被选中
//设置颜色
procedure TForm1.btn_colorClick(Sender: TObject);
begin
if colordialog1.Execute then
memo1.Color:=colordialog1.Color;
end;

//设置字体
procedure TForm1.btn_fontClick(Sender: TObject);
begin
if fontdialog1.Execute then
memo1.Font:=fontdialog1.Font;
end;

//更改内容
procedure TForm1.btn_textClick(Sender: TObject);
begin
memo1.ReadOnly:=not memo1.ReadOnly;
end;

//按钮组中设定对齐方式
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
case radiogroup1.ItemIndex of
0: begin //左对齐
memo1.Alignment:=taleftjustify;
m_optionleft.Checked:=true; //菜单项选中标记
m_optioncenter.Checked:=false;
m_optionright.Checked:=false;
end;
1: begin //居中
memo1.Alignment:=tacenter;
m_optionleft.Checked:=false;
m_optioncenter.Checked:=true;
m_optionright.Checked:=false;
end;
2: begin //右对齐
memo1.Alignment:=tarightjustify;
m_optionleft.Checked:=false;
m_optioncenter.Checked:=false;
m_optionright.Checked:=true;
end;
//居中菜单命令项
procedure TForm1.m_optioncenterClick(Sender: TObject);
begin
memo1.Alignment:=tacenter;
m_optionleft.Checked:=false; //选中标记
m_optioncenter.Checked:=true;
m_optionright.Checked:=false;
radiogroup1.ItemIndex:=1; //单选按钮组第一项被选中
end;

//左对齐菜单命令项
procedure TForm1.m_optionleftClick(Sender: TObject);
begin
memo1.Alignment:=taleftjustify;
m_optionleft.Checked:=true;
m_optioncenter.Checked:=false;
m_optionright.Checked:=false;
radiogroup1.ItemIndex:=0;
end;

//右对齐菜单命令项
procedure TForm1.m_optionrightClick(Sender: TObject);
begin
memo1.Alignment:=tarightjustify;
m_optionleft.Checked:=false; //选中标记
m_optioncenter.Checked:=false;
m_optionright.Checked:=true;
radiogroup1.ItemIndex:=2; //单选按钮组第一项被选中
end;

//"隐藏"帮助菜单标题项
procedure TForm1.m_optionhideClick(Sender: TObject);
begin
m_help.Visible:=not m_help.Visible;
if m_help.Visible then
m_optionhide.Caption:='隐藏'
else
m_optionhide.Caption:='显示'
end;

//工具栏中“加粗“
procedure TForm1.ToolButton8Click(Sender: TObject);
begin
if toolbutton8.Down then
memo1.Font.Style:=memo1.Font.Style+[fsbold] else
memo1.Font.Style:=memo1.Font.Style-[fsbold]
end;

//倾斜
procedure TForm1.ToolButton9Click(Sender: TObject);
begin
if toolbutton9.Down then
memo1.Font.Style:=memo1.Font.Style+[fsItalic] else
memo1.Font.Style:=memo1.Font.Style-[fsItalic]
end;

//下划线
procedure TForm1.ToolButton10Click(Sender: TObject);
begin
if toolbutton10.Down then
memo1.Font.Style:=memo1.Font.Style+[fsUnderline] else
memo1.Font.Style:=memo1.Font.Style-[fsUnderline]
end;
添加:table1.Append;
修改:table1.Insert;
删除:b:=messagedlg('',mtconfirmation,[mbyes,mbno],0);
if b=mryes then
table1.Delete;
保存:table1.Post;
查询:table1.EditKey;
table1.FieldByName('id').AsString:= edit1.Text;
table1.GotoKey;
取消:table1.Cancel;
对话框查询:a:=inputbox('输入','请输入学号','');
table1.EditKey;
table1.FieldByName('id').AsString:= a;
table1.GotoKey;
退出:table1.close;
首行:table1.First;
上一行:table1.Prior;
下一行:table1.Next;

相关文档
最新文档