zoukankan      html  css  js  c++  java
  • 学用 TStringGrid [5] FixedCols、FixedRows、Color、FixedColor

    本例运行效果图:


    //示例代码:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, Grids;
    
    type
      TForm1 = class(TForm)
        StringGrid1: TStringGrid;
        Panel1: TPanel;
        Button1: TButton;
        Button2: TButton;
        Button3: TButton;
        Button4: TButton;
        Button5: TButton;
        Button6: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure Button4Click(Sender: TObject);
        procedure Button6Click(Sender: TObject);
        procedure Button5Click(Sender: TObject);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    {赋值}
    procedure TForm1.FormCreate(Sender: TObject);
    var
      i,j: Integer;
    begin
      with StringGrid1 do
        for i := 0 to ColCount - 1 do
          for j := 0 to RowCount - 1 do
            Cells[i,j] := Format('%d%d',[i,j]);
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if StringGrid1.FixedCols < StringGrid1.ColCount-1 then
        StringGrid1.FixedCols := StringGrid1.FixedCols + 1;
    end;
    
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      if StringGrid1.FixedCols > 0 then
        StringGrid1.FixedCols := StringGrid1.FixedCols - 1;
    end;
    
    procedure TForm1.Button3Click(Sender: TObject);
    begin
      if StringGrid1.FixedRows < StringGrid1.RowCount-1 then
        StringGrid1.FixedRows := StringGrid1.FixedRows + 1;
    end;
    
    procedure TForm1.Button4Click(Sender: TObject);
    begin
      if StringGrid1.FixedRows > 0 then
        StringGrid1.FixedRows := StringGrid1.FixedRows - 1;
    end;
    
    procedure TForm1.Button5Click(Sender: TObject);
    begin
      StringGrid1.Color := Random($FFFFFF);
    end;
    
    procedure TForm1.Button6Click(Sender: TObject);
    begin
      StringGrid1.FixedColor := Random($FFFFFF);
    end;
    
    end.
    
  • 相关阅读:
    QOMO Linux 4.0 正式版发布
    LinkChecker 8.1 发布,网页链接检查
    pgBadger 2.1 发布,PG 日志分析
    Aletheia 0.1.1 发布,HTTP 调试工具
    Teiid 8.2 Beta1 发布,数据虚拟化系统
    zLogFabric 2.2 发布,集中式日志存储系统
    开源电子工作套件 Arduino Start Kit 登场
    Piwik 1.9 发布,网站访问统计系统
    Ruby 1.9.3p286 发布,安全修复版本
    toBraille 1.1.2 发布,Java 盲文库
  • 原文地址:https://www.cnblogs.com/del/p/1092123.html
Copyright © 2011-2022 走看看