儲存form配置資訊INI

2022-01-22 17:10:24 字數 2763 閱讀 3710

(* 

功能:iniformstate

1 儲存和讀取 窗體的大小

2 儲存和讀取 窗體在螢幕上的位置

//讓程式第1次出現在螢幕的中心點

獲取螢幕的中心點

position:poscreencenter

//不行

*)//implementation

//usesinifiles;//引用inifiles

/// 寫入資訊到ini檔案 

procedurewriteformstate

(section

:string;

filename

:string;

form

:tform

);varinifile

:tinifile

;begin

inifile

:=tinifile

.create

(extractfilepath(.

exename

)+filename

);try

inifile

.writeinteger

(section

,'left'

,form

.left

);inifile

.writeinteger

(section

,'top'

,form

.top

);inifile

.writeinteger

(section

,'height'

,form

.height

);inifile

.writeinteger

(section

,'width'

,form

.width

);finally

inifile

.free

;end;

end;

/// 從ini讀取資訊並賦值

procedurereadformstate

(section

:string;

filename

:string;

form

:tform

);var

inifile

:tinifile

;frm1left

,frm1top

:integer

;begin

//form1 處於螢幕中心點時的left top的值 用於第1次執行本程式時程式出現 在螢幕中心

frm1left

:=(screen

.width

-form

.width

)div2

;frm1top

:=(screen

.height

-form

.height

)div2

;inifile

:=tinifile

.create

(extractfilepath(.

exename

)+filename

);try

form

.left

:=inifile

.readinteger

(section

,'left'

,frm1left

);form

.top

:=inifile

.readinteger

(section

,'top'

,frm1top

);form

.height

:=inifile

.readinteger

(section

,'height'

,form

.height

);form

.width

:=inifile

.readinteger

(section

,'width'

,form

.width

);finally

inifile

.free

;end;

end;

//呼叫

//讀取資訊

readformstate

('mainform'

,'config.ini'

,form1

);//寫入資訊 

writeformstate

('mainform'

,'config.ini'

,form1

);

來自為知筆記(wiz)

配置資訊 類

常用的配置包括 資料庫連線,系統配置 檔案分布之類 應用配置 業務邏輯資料 其它 為方便程式獲取配置資訊,設計此類 獲取配置資訊類 class sconfig private static database 快取資料庫配置資訊 private static system 快取系統配置資訊 priva...

Hystrix 配置資訊

在hystrix中我們一般是用的預設配置,有些時候需要調整一些引數來獲取更好的處理效能 配置官方文件 這些引數可以應用於hystrix的thread和semaphore策略 collapser properties 相關引數 requests per second at peak when heal...

Hystrix 配置資訊

在hystrix中我們一般是用的預設配置,有些時候需要調整一些引數來獲取更好的處理效能 配置官方文件 這些引數可以應用於hystrix的thread和semaphore策略 執行緒數預設值10適用於大部分情況 有時可以設定得更小 如果需要設定得更大,那有個基本得公式可以follow requests...