还有个问题,就是我想用一个按钮来选择要进行打字的文档,用什么代码啊

解决方案 »

  1.   

    用OpenDialog直接弹出对话框procedure TForm1.Button6Click(Sender: TObject);
    begin
      if self.OpenDialog1.Execute then
        self.Memo1.Lines.LoadFromFile(self.OpenDialog1.FileName);
    end;
      

  2.   

    [Error] Unit1.pas(31): Undeclared identifier: 'OpenDialog1'
    [Error] Unit1.pas(31): 'THEN' expected but identifier 'Execute' found为什么有这么多的错误啊
      

  3.   

    OpenDialog1是个控件,在dialogs里
      

  4.   

    打开之后光标怎么不能定位到Memo2上进行输入了啊
      

  5.   

    [Error] Unit1.pas(121): Undeclared identifier: 'start_time'
      

  6.   

    不是吧,老兄你是学delphi的吗?
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Excel2000, OleServer, StdCtrls, ComCtrls,TLHelp32;type
      TForm1 = class(TForm)
        Button1: TButton;
        ExcelWorksheet1: TExcelWorksheet;
        ExcelApplication1: TExcelApplication;
        ExcelWorkbook1: TExcelWorkbook;
        TreeView1: TTreeView;
        Button2: TButton;
        Label1: TLabel;
        Button3: TButton;
        Memo1: TMemo;
        Memo2: TMemo;
        Button4: TButton;
        Button5: TButton;
        ListBox1: TListBox;
        OpenDialog1: TOpenDialog;
        Button6: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure Button4Click(Sender: TObject);
        procedure Button5Click(Sender: TObject);
        procedure Memo2Click(Sender: TObject);
        procedure Button6Click(Sender: TObject);
      private
        { Private declarations }
        procedure onminsize(var msg:TMessage);message WM_syscommand;
      public
        { Public declarations }
        start_time,end_time:TDateTime;
      

  7.   

    最后要用一个label控件输出被测试者的速度,用什么函数啊
      

  8.   

    var
      l:Real;
      i:integer;
    begin
      end_time:=Now;
      l:=(end_time-start_time)*24*3600;
      i:=Trunc(l);
      self.Label1.Caption:='每秒:'+IntToStr(cou div i);
    end;
      

  9.   

    label出错
    [Error] Unit1.pas(135): Undeclared identifier: 'cou'
    这个是不是也要定义全局啊
      

  10.   

    label出错
    [Error] Unit1.pas(135): Undeclared identifier: 'cou'
    这个是不是也要定义全局啊
      

  11.   

    为什么定义之后出现的是每秒0个
    还有那个lable要单击一下才会出现成绩的
      

  12.   

    那个cou是你得出的输入正确的字符个数,在另一段代码中(你看看你发的另一个帖子,就是字符串匹配的那个)那是刷新的问题,加上label1.refresh;试试
      

  13.   


    procedure TForm1.Button4Click(Sender: TObject);
    var
      i,j,m,n:Integer;
      cou:Integer;
      s1,s2,s3,s4:WideString;
    begin
      s1:=self.Memo1.Lines.Text;
      s2:=self.Memo2.Lines.Text;
      i:=Length(s1);
      j:=Length(s2);
      cou:=0;
      if i>j then
        m:=j
      else
        m:=i;
      for n:=1 to m-1 do
      begin
        s3:=s1[n];
        s4:=s2[n];
        if s1[n]=s2[n] then
        begin
          cou:=cou+1;
          self.ListBox1.Items.Add(s1[n]);
        end;
      end;
      MessageBox(Application.Handle,PChar('相同的字符个数为:'+inttostr(cou)),'信息',MB_OK or MB_ICONINFORMATION);
    end;那个cou就是这段代码中的cou