老道的程式設計師們都知道,在軟體業界有乙個預設的原則,那就是軟體各界面的風格要統一。包括介面上各控制項的字型顏色和大小。是不是每要新加乙個介面都要設定字型的顏色和大小呢。答案是可以不用那麼麻煩。
首先設計乙個父窗體,供其它窗體繼承。在父窗體的建構函式裡寫上對介面控制項字型風格的處理**,那麼其它子窗體就會自動復用了。
procedure tfrmfather.clearime;//輸入法
vari:integer
begin
if self.enabled and self.visible then self.setfocus;
for i:= 0 to componentcount - 1 do
begin
if component[i] is tmemo then
tmemo(components[i]).imename :=''
else if component[i] is tedit then
tedit(components[i]).imename :=''
else if component[i] is tdatetimepicker then
tdatetimepicker(components[i]).imename :=''
else if component[i] is tcombobox then
tcombobox(components[i]).imename :=''
else if component[i] is tdbgrideh then
tdbgrideh(components[i]).imename :=''
end;
end;
procedure inituserinte***ce;
begin
if (width >= screen.width) or (height >= screen.height) then windowstate := wsmaximized;
self.font.charset := sysparams.fontcharset;//sysparams可以是乙個類的例項也可以是乙個紀錄。引數可以儲存在資料庫或ini中
self.font.name := sysparams.fontname;
self.font.size := sysparams.fontsize;
for i := 0 to self.componentcount - 1 do
begin
if self.components[i].tag >=100 then continue;
if self.components[i].inheritsfrom(tedit) then
begin
tedit(self.components[i]).text := '';
tedit(self.components[i]).color := sysparams.editclr;
continue;
end;
if self.components[i].inheritsfrom(tmemo) then
begin
tmemo(self.components[i]).text := '';
tmemo(self.components[i]).color := sysparams.editclr;
continue;
end;
if self.components[i].inheritsfrom(tcombobox) then
begin
tcombobox(self.components[i]).itemindex := -1;
tcombobox(self.components[i]).color := sysparams.editclr;
continue;
end;
if self.components[i].inheritsfrom(tdatetimepicker) then
begin
tdatetimepicker(self.components[i]).color := sysparams.editclr;
continue;
end;
if self.components[i].inheritsfrom(tlistbox) then
begin
tlistbox(self.components[i]).color := sysparams.editclr;
continue;
end;
if self.components[i].inheritsfrom(tchecklistbox) then
begin
tchecklistbox(self.components[i]).color := sysparams.editclr;
continue;
end;
if self.components[i].inheritsfrom(tspinedit) then
begin
tspinedit(self.components[i]).color := sysparams.editclr;
continue;
end;
if self.components[i].inheritsfrom(tlistview) then
begin
tlistview(self.components[i]).color := sysparams.treeclr;
tlistview(self.components[i]).readonly := true;
continue;
end;
if self.components[i].inheritsfrom(ttreeview) then
begin
ttreeview(self.components[i]).color := sysparams.treeclr;
ttreeview(self.components[i]).readonly := true;
continue;
end;
if self.components[i].inheritsfrom(tchecktree) then
begin
tchecktree(self.components[i]).color := sysparams.treeclr;
tchecktree(self.components[i]).readonly := true;
continue;
end;
if self.components[i].inheritsfrom(tdbgrideh) then
begin
tdbgrideh(self.components[i]).color := sysparams.gridclr;
tdbgrideh(self.components[i]).fixedcolor := sysparams.titleclr;
tdbgrideh(self.components[i]).readonly := true;
continue;
end;
if self.components[i].inheritsfrom(tdbgrid) then
begin
tdbgrid(self.components[i]).color := sysparams.gridclr;
tdbgrid(self.components[i]).fixedcolor := sysparams.titleclr;
tdbgrid(self.components[i]).readonly := true;
continue;
end;
end;
end;
關於介面的統一驗證
核心基類呼叫統一驗證 use framework lib controller use framework extend des 控制器到父類做一些公共到業務處理 class commoncontroller class commoncontroller extends controller 執行父...
UML RUP統一軟體開發過程
軟體危機的出現,主要在軟體生命中週期 成本 軟體質量等三個方面,主要表現在定位需求 模組難整合 最後才發現問題 軟體質量差 負載時效能差 團隊問題 不斷修改 發布問題等。在以上各個方面的產生下,rup統一軟體開發過程應運而生。rup rational unified process,統一軟體開發過程...
qt實現汽車銷售管理系統(一) 登入介面的實現
執行程式 登入介面 驗證使用者名稱和密碼 進入主介面 建立乙個cardb資料庫,並使用該資料庫 create database cardb use cardb 建立使用者表 user 並往裡面插入資料 create table user id int not null auto increment ...