博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
给 Memo 排序的函数
阅读量:6991 次
发布时间:2019-06-27

本文共 1428 字,大约阅读时间需要 4 分钟。

  hot3.png

本例效果图:
26153503_jNmT.gif

代码文件:

unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls;type  TForm1 = class(TForm)    Memo1: TMemo;    Button1: TButton;    procedure Button1Click(Sender: TObject);    procedure FormCreate(Sender: TObject);  end;var  Form1: TForm1;implementation{$R *.dfm}{给 Memo 排序的函数}procedure SortMemo(const m: TMemo);begin  with TStringList.Create do  begin    Sorted := True;    Text := m.Text;    m.Text := Text;    Free;  end;end;{测试}procedure TForm1.FormCreate(Sender: TObject);begin  Memo1.Align := alLeft;  Memo1.Lines.CommaText := 'zzz,xxx,yyy,aaa,ccc,bbb,333,222,111';  Button1.Caption := '排序';end;procedure TForm1.Button1Click(Sender: TObject);begin  SortMemo(Memo1);end;end.
窗体文件:

object Form1: TForm1  Left = 0  Top = 0  Caption = 'Form1'  ClientHeight = 143  ClientWidth = 166  Color = clBtnFace  Font.Charset = DEFAULT_CHARSET  Font.Color = clWindowText  Font.Height = -11  Font.Name = 'Tahoma'  Font.Style = []  OldCreateOrder = False  Position = poDesktopCenter  OnCreate = FormCreate  PixelsPerInch = 96  TextHeight = 13  object Memo1: TMemo    Left = 0    Top = 8    Width = 73    Height = 89    Lines.Strings = (      'Memo1')    TabOrder = 0  end  object Button1: TButton    Left = 79    Top = 32    Width = 75    Height = 25    Caption = 'Button1'    TabOrder = 1    OnClick = Button1Click  endend

转载于:https://my.oschina.net/hermer/blog/320038

你可能感兴趣的文章
LVS调度策略
查看>>
MySql游标使用
查看>>
监控IO性能| free命令 |ps命令 |查看网络状态 |linux下抓包
查看>>
上传文件绕过姿势
查看>>
STP与MSTP概述
查看>>
Nginx日志分析和参数详解
查看>>
【有奖征文】51CTO男/女子图鉴 哪一面才是真的你
查看>>
MATLAB编程与应用系列-第2章 数组及矩阵的创建及操作(2)
查看>>
一步一步实现web程序信息管理系统之二----后台框架实现跳转登陆页面
查看>>
接口和抽象类是否继承了Object
查看>>
小白都能看懂的Linux系统下安装配置Zabbix
查看>>
服务器被传***怎么办
查看>>
ios获取设备信息总结
查看>>
如何避免「温水煮码农」?
查看>>
AJPFX总结内部类
查看>>
Spring Boot Security 整合 JWT 实现 无状态的分布式API接口
查看>>
指向结构体变量的指针作函数参数
查看>>
MR程序重要组件-combiner
查看>>
HDFS 文件操作命令(2)
查看>>
深入理解typedef
查看>>