zoukankan      html  css  js  c++  java
  • 学用 TStringGrid [7] ColWidths[0]、RowHeights[0]、GridLineWidth

    本例效果图:


    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;
        Button6: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure Button4Click(Sender: TObject);
        procedure Button5Click(Sender: TObject);
        procedure Button6Click(Sender: TObject);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    {左单元+}
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      TButton(Sender).Caption := '左单元+';
      StringGrid1.ColWidths[0] := StringGrid1.ColWidths[0] + 10;
    end;
    
    {左单元-}
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      TButton(Sender).Caption := '左单元-';
      StringGrid1.ColWidths[0] := StringGrid1.ColWidths[0] - 10;
    end;
    
    {上单元+}
    procedure TForm1.Button3Click(Sender: TObject);
    begin
      TButton(Sender).Caption := '上单元+';
      StringGrid1.RowHeights[0] := StringGrid1.RowHeights[0] + 10;
    end;
    
    {上单元-}
    procedure TForm1.Button4Click(Sender: TObject);
    begin
      TButton(Sender).Caption := '上单元-';
      StringGrid1.RowHeights[0] := StringGrid1.RowHeights[0] - 10;
    end;
    
    {方格线+}
    procedure TForm1.Button5Click(Sender: TObject);
    begin
      TButton(Sender).Caption := '方格线+';
      StringGrid1.GridLineWidth := StringGrid1.GridLineWidth + 1;
    end;
    
    {方格线-}
    procedure TForm1.Button6Click(Sender: TObject);
    begin
      TButton(Sender).Caption := '方格线-';
      StringGrid1.GridLineWidth := StringGrid1.GridLineWidth - 1;
    end;
    
    end.
    
  • 相关阅读:
    python 装饰器
    python操作hbase
    python 数据压缩
    JsonSchema 启蒙
    python在webservice接口测试中的应用
    简单的python http接口自动化脚本
    解决python2安装MySQL-python模块报错
    实用小工具推荐(一)
    linux和mac使用virtualenv使用和安装
    少年,来点正能量吧!
  • 原文地址:https://www.cnblogs.com/del/p/1094130.html
Copyright © 2011-2022 走看看