Skip to content

NiceGridBasicDemo 项目分析

项目信息

文件结构

NiceGridBasicDemo/
├── Extractor_Icon.ico
├── Project1.py
├── Project1.xml
├── main.py
├── main.pydfm
├── main.sct
├── main.sfm

主程序文件: Project1.py

from glcl import *
from main import *

def main():
    Application.Initialize()
    Application.Title = 'Project1'
    Application.MainFormOnTaskbar = True
    Application.Icon.LoadFromFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Extractor_Icon.ico"))
    mForm = MainForm(Application)
    mForm.Show()
    FreeConsole()
    Application.Run()
    mForm.Free()

if __name__ == '__main__':
    main()

设计文件: main.sct

def NiceGrid1DrawHeader(Sender, ACanvas, Rc, Str, Handled): 
def NiceGrid1InsertRow(Sender, ARow): 
def CheckBox1Click(Sender): 
def CheckBox2Click(Sender): 
def CheckBox3Click(Sender): 
def CheckBox5Click(Sender): 
def CheckBox4Click(Sender): 
def CheckBox6Click(Sender): 
def Button2Click(Sender): 
def Button3Click(Sender): 
def Button1Click(Sender): 
def Button4Click(Sender): 

设计文件: main.sfm

object MainForm: TForm
  Left = 0
  Top = 0
  Caption = 'NiceGrid Demo'
  ClientHeight = 514
  ClientWidth = 651
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  Position = poDesktopCenter
  DesignSize = (
    651
    514)
  TextHeight = 13
  object Label1: TLabel
    Left = 16
    Top = 16
    Width = 199
    Height = 13
    Caption = '- Try to copy paste a block between Excel'
    Color = clBtnFace
    ParentColor = False
  end
  object Label2: TLabel
    Left = 16
    Top = 32
    Width = 307
    Height = 13
    Caption = 
      '- Try type something then press * and Enter. Try also > and Ente' +
      'r.'
    Color = clBtnFace
    ParentColor = False
  end
  object NiceGrid1: TNiceGrid
    Left = 16
    Top = 56
    Width = 601
    Height = 373
    Cursor = 101
    ColCount = 5
    RowCount = 20
    AutoAddRow = True
    DefColWidth = 100
    GridColor = clSilver
    HeaderLine = 2
    HeaderColor = 14614528
    HeaderLightColor = 16744448
    HeaderDarkColor = clBlack
    HeaderFont.Charset = DEFAULT_CHARSET
    HeaderFont.Color = clWhite
    HeaderFont.Height = -11
    HeaderFont.Name = 'MS Sans Serif'
    HeaderFont.Style = []
    FooterFont.Charset = DEFAULT_CHARSET
    FooterFont.Color = clRed
    FooterFont.Height = -11
    FooterFont.Name = 'MS Sans Serif'
    FooterFont.Style = []
    SelectionColor = 13816575
    Columns = <
      item
        Title = 'Merged;Multilined|Merged;Multilined'
        Footer = 'Footer 0'
        Width = 100
        CanResize = False
      end
      item
        Title = 'First Group|One'
        Footer = 'Footer 1'
        Width = 100
        Color = 14024703
        HorzAlign = haCenter
        Strings.Strings = (
          'Satu'
          'Dua'
          'Tiga')
      end
      item
        Title = 'First Group|Two'
        Footer = 'Footer 2'
        Width = 100
      end
      item
        Title = 'Second Group|One'
        Footer = 'Footer 3'
        Width = 100
        Color = clWhite
        HorzAlign = haRight
      end
      item
        Title = 'Second Group|Two'
        Footer = 'Footer 4'
        Width = 100
        HorzAlign = haCenter
      end>
    GutterKind = gkNumber
    GutterWidth = 40
    GutterFont.Charset = DEFAULT_CHARSET
    GutterFont.Color = clWhite
    GutterFont.Height = -11
    GutterFont.Name = 'MS Sans Serif'
    GutterFont.Style = []
    ShowFooter = True
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    Anchors = [akLeft, akTop, akRight, akBottom]
    TabOrder = 0
  end
  object CheckBox1: TCheckBox
    Left = 16
    Top = 439
    Width = 37
    Height = 19
    Anchors = [akLeft, akBottom]
    Caption = 'Flat'
    Checked = True
    State = cbChecked
    TabOrder = 1
    OnClick = CheckBox1Click
  end
  object CheckBox2: TCheckBox
    Left = 88
    Top = 439
    Width = 93
    Height = 19
    Anchors = [akLeft, akBottom]
    Caption = 'System Colors'
    Checked = True
    State = cbChecked
    TabOrder = 2
    OnClick = CheckBox2Click
  end
  object CheckBox3: TCheckBox
    Left = 192
    Top = 439
    Width = 80
    Height = 19
    Anchors = [akLeft, akBottom]
    Caption = 'Fit to Width'
    TabOrder = 3
    OnClick = CheckBox3Click
  end
  object CheckBox4: TCheckBox
    Left = 288
    Top = 439
    Width = 125
    Height = 19
    Anchors = [akLeft, akBottom]
    Caption = 'Auto Column Width'
    TabOrder = 4
    OnClick = CheckBox4Click
  end
  object CheckBox5: TCheckBox
    Left = 424
    Top = 439
    Width = 77
    Height = 19
    Anchors = [akLeft, akBottom]
    Caption = 'Show Grids'
    Checked = True
    State = cbChecked
    TabOrder = 5
    OnClick = CheckBox5Click
  end
  object Button1: TButton
    Left = 272
    Top = 476
    Width = 129
    Height = 25
    Anchors = [akLeft, akBottom]
    Caption = '&Hide 3rd Column'
    TabOrder = 8
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 16
    Top = 476
    Width = 121
    Height = 25
    Anchors = [akLeft, akBottom]
    Caption = '&Insert New Row'
    TabOrder = 6
    OnClick = Button2Click
  end
  object Button3: TButton
    Left = 144
    Top = 476
    Width = 121
    Height = 25
    Anchors = [akLeft, akBottom]
    Caption = '&Delete Current Row'
    TabOrder = 7
    OnClick = Button3Click
  end
  object Button4: TButton
    Left = 416
    Top = 476
    Width = 182
    Height = 25
    Anchors = [akLeft, akBottom]
    Caption = 'Toggle ReadOnly 3rd Column'
    TabOrder = 9
    OnClick = Button4Click
  end
  object CheckBox6: TCheckBox
    Left = 528
    Top = 439
    Width = 84
    Height = 19
    Anchors = [akLeft, akBottom]
    Caption = 'Show Footer'
    TabOrder = 10
    OnClick = CheckBox6Click
  end
end

其他文件

  • Extractor_Icon.ico
  • main.py
  • Project1.xml

详细分析

功能概述

网格组件演示

使用的组件

(未检测到具体组件)

技术特点

(未检测到特殊技术特点)

代码分析