• AdvStringGrid 获取值


    stringGrid.row stringgrid.col分别为当前行和列


    stringGrid.cells[stringgrid.col,stringGrid.row]就是当前cell的值

    ----------------------------------------------------------------

    unit Unit6;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, AdvUtil, Vcl.StdCtrls, Vcl.Grids,
      AdvObj, BaseGrid, AdvGrid;
    
    type
      TForm6 = class(TForm)
        AdvStringGrid1: TAdvStringGrid;
        Button1: TButton;
        Button2: TButton;
        Button3: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form6: TForm6;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm6.Button1Click(Sender: TObject);
    begin
      AdvStringGrid1.Cells[0, 1] := '小李飞刀';
      AdvStringGrid1.Cells[1, 1] := '1111111';
      AdvStringGrid1.Cells[2, 1] := '2222222';
    
      AdvStringGrid1.Cells[0, 2] := '火云邪神';
      AdvStringGrid1.Cells[1, 2] := '33333333';
      AdvStringGrid1.Cells[2, 2] := '44444444';
    end;
    
    procedure TForm6.Button2Click(Sender: TObject);
    begin
      //取当前姓名
      ShowMessage(AdvStringGrid1.Cells[0, AdvStringGrid1.Row]);
    end;
    
    procedure TForm6.Button3Click(Sender: TObject);
    begin
      //去当前单元格
      ShowMessage(AdvStringGrid1.Cells[AdvStringGrid1.Col, AdvStringGrid1.Row]);
    end;
    
    end.
  • 相关阅读:
    Discuz论坛自动发帖机
    C#测试数据库连接是否成功
    JS重写提示框(confirm)
    随笔 选择
    随笔 诚实
    web项目经理手册【1】版本控制流程
    Asp.net多层架构中的变量引用与传递
    ASP.NET跨页面传值技巧总结
    web项目经理手册【3】Code Review
    web项目经理手册【7】项目经理需要铭记在心的话
  • 原文地址:https://www.cnblogs.com/del88/p/6918278.html
Copyright © 2020-2023  润新知