Reapply "速度优化"

This reverts commit fe777b3e7c.
This commit is contained in:
sgwp 2024-11-27 14:49:38 +08:00
parent fe777b3e7c
commit b48ad48221
10 changed files with 696 additions and 503 deletions

View File

@ -7,8 +7,8 @@ object BaseDataLink: TBaseDataLink
Kind = lfFlat
NativeStyle = False
ScrollbarMode = sbmClassic
ScrollMode = scmSmooth
SkinName = 'WXI'
RenderMode = rmGDI
ShowFormShadow = bFalse
UseSkinsInPopupMenus = False
Left = 288
@ -16,30 +16,30 @@ object BaseDataLink: TBaseDataLink
end
object cxEditStyleController1: TcxEditStyleController
Style.BorderColor = clSilver
Style.BorderStyle = ebsSingle
Style.BorderStyle = ebsNone
Style.Color = clWhite
Style.Font.Charset = ANSI_CHARSET
Style.Font.Color = clWindowText
Style.Font.Height = -16
Style.Font.Name = #24494#36719#38597#40657
Style.Font.Style = []
Style.LookAndFeel.Kind = lfFlat
Style.LookAndFeel.NativeStyle = False
Style.LookAndFeel.SkinName = 'WXI'
Style.LookAndFeel.Kind = lfOffice11
Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.Kind = lfFlat
StyleDisabled.LookAndFeel.NativeStyle = False
StyleDisabled.LookAndFeel.SkinName = 'WXI'
StyleDisabled.LookAndFeel.Kind = lfOffice11
StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.BorderColor = clSkyBlue
StyleFocused.BorderStyle = ebsSingle
StyleFocused.LookAndFeel.Kind = lfFlat
StyleFocused.LookAndFeel.NativeStyle = False
StyleFocused.LookAndFeel.SkinName = 'WXI'
StyleFocused.LookAndFeel.Kind = lfOffice11
StyleFocused.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.BorderColor = clSkyBlue
StyleHot.BorderStyle = ebsSingle
StyleHot.LookAndFeel.Kind = lfFlat
StyleHot.LookAndFeel.NativeStyle = False
StyleHot.LookAndFeel.SkinName = 'WXI'
StyleHot.LookAndFeel.Kind = lfOffice11
StyleHot.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.SkinName = ''
Left = 75
Top = 64
PixelsPerInch = 96
@ -48,8 +48,8 @@ object BaseDataLink: TBaseDataLink
Kind = lfFlat
NativeStyle = False
ScrollbarMode = sbmClassic
ScrollMode = scmSmooth
SkinName = 'WXI'
RenderMode = rmGDI
Left = 253
Top = 12
end

View File

@ -5,9 +5,9 @@ interface
uses
System.SysUtils,windows,forms, System.Classes,
dxSkinsDefaultPainters, dxCore, cxClasses,
cxLookAndFeels, dxSkinsForm, cxContainer, cxEdit,
cxLookAndFeels, cxContainer, cxEdit,
System.ImageList, Vcl.ImgList, Vcl.Controls, cxImageList, cxGraphics, cxStyles,
dxLayoutLookAndFeels,cxLocalization;
dxLayoutLookAndFeels,cxLocalization, dxSkinsForm;
type
TBaseDataLink = class(TDataModule)
@ -54,11 +54,14 @@ var
str :String;
pathStr:String;
I: Integer;
thread:Tthread;
thread:TThread;
begin
RootLookAndFeel.NativeStyle := false;
gFontSize:=0;
///////////////////
dxSkinController1.BeginUpdate;
//////////////////////
thread:=TThread.CreateAnonymousThread(
procedure
begin
if (fileexists(ExtractFilePath(Application.ExeName) + 'devchs.ini') = true)
then
@ -68,21 +71,48 @@ begin
cxLocalizer1.Active := true;
cxLocalizer1.LanguageIndex := 1;
end;
//
if not isUseSkin() then
begin
dxSkinController1.UseSkins:=false;
dxSkinController1.SkinName:='';
end
else
begin
pathStr:=ExtractFilePath(Application.ExeName) + '\AllSkins.skinres';
if FileExists(pathStr) then
begin
dxSkinsUserSkinLoadFromFile(pathStr, 'WXI');
RootLookAndFeel.SkinName := sdxSkinsUserSkinName;
end;
end);
thread.FreeOnTerminate := True;
thread.Start;
RootLookAndFeel.NativeStyle := FALSE;
gFontSize:=0;
// if (fileexists(ExtractFilePath(Application.ExeName) + 'devchs.ini') = true)
// then
// begin
// cxLocalizer1.FileName := ExtractFilePath(Application.ExeName) +
// 'devchs.ini';
// cxLocalizer1.Active := true;
// cxLocalizer1.LanguageIndex := 1;
// end;
//
getSystemIni();
if not gIsUseSkin then
begin
dxSkinController1.UseSkins:=false;
dxSkinController1.SkinName:='';
end
else
begin
// pathStr:=ExtractFilePath(Application.ExeName) + '\AllSkins.skinres';
// if FileExists(pathStr) then
// begin
// dxSkinsUserSkinLoadFromFile(pathStr, 'WXI');
// RootLookAndFeel.SkinName := sdxSkinsUserSkinName;
// end;
end;
dxSkinController1.EndUpdate;
end;

View File

@ -33,7 +33,7 @@ procedure TfrmBaseHelp.FormCreate(Sender: TObject);
var
mFontSize:integer;
begin
getSystemIni();
// getSystemIni();
if gFontSize<9 then
begin
mFontSize := 12;
@ -56,7 +56,7 @@ end;
procedure TfrmBaseHelp.FormShow(Sender: TObject);
begin
fWindowDesign.FormStyleInit(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd);
fWindowDesign.FormStyleInit1(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd);
end;
end.

View File

@ -36,18 +36,18 @@ procedure TfrmBaseInput.FormCreate(Sender: TObject);
var
mFontSize:integer;
begin
getSystemIni();
//getSystemIni();
self.DoubleBuffered:=gIsUseSkin;
if gFontSize<9 then
begin
mFontSize := 12;
mFontSize := 9;
end
else
begin
mFontSize:=gFontSize ;
end;
self.Font.Size := gFontSize;
if self.Font.Size<>gFontSize then
self.Font.Size := gFontSize;
if trim(gFontName)<>'' then
self.Font.Name:=gFontName;
fWindowDesign:=TWindowFormDeSign.Create();
@ -59,11 +59,26 @@ begin
end;
procedure TfrmBaseInput.FormShow(Sender: TObject);
//var
// thread:TThread;
begin
if trim(gStructVer)='' then
fWindowDesign.FormStyleInit1(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd)
else
fWindowDesign.FormStyleInit(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd) ;
// thread:=TThread.CreateAnonymousThread(
// procedure
// begin
// TThread.Synchronize(nil,
// procedure
// begin
if trim(gStructVer)='' then
fWindowDesign.FormStyleInit1(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd)
else
fWindowDesign.FormStyleInit(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd) ;
// end)
// end);
//
// thread.FreeOnTerminate := True;
// thread.Start;
end;
end.

View File

@ -17,34 +17,28 @@ object frmBaseList: TfrmBaseList
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 17
object loadProcess: TPanel
Left = 288
Top = 168
Width = 169
Height = 30
BevelInner = bvRaised
BevelOuter = bvLowered
Caption = 'loading...'
TabOrder = 0
Visible = False
end
object cxProgressBar2: TcxProgressBar
Left = 288
Top = 120
Margins.Left = 1
Margins.Top = 1
Margins.Right = 1
Margins.Bottom = 1
ParentFont = False
Properties.AnimationSpeed = 2
Properties.BarStyle = cxbsGradientLEDs
Properties.BeginColor = 65408
Properties.Marquee = True
Properties.Text = 'loading...'
Style.Font.Charset = ANSI_CHARSET
Style.Font.Color = clSilver
Style.Font.Height = -14
Style.Font.Name = #24494#36719#38597#40657
Style.Font.Style = []
Style.LookAndFeel.SkinName = 'VS2010'
Style.Shadow = False
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = 'VS2010'
StyleFocused.LookAndFeel.SkinName = 'VS2010'
StyleHot.LookAndFeel.SkinName = 'VS2010'
TabOrder = 0
Transparent = True
Top = 112
Enabled = False
Style.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 1
Visible = False
Width = 153
Width = 177
end
object ADOQueryBaseCmd: TADOQuery
Parameters = <>

View File

@ -5,17 +5,14 @@ interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB,
Data.Win.ADODB, U_WindowFormdesign, cxGraphics, cxControls, cxLookAndFeels,
cxLookAndFeelPainters,
cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator,
dxDateRanges, dxScrollbarAnnotations, cxDBData, cxGridLevel, cxClasses,
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGrid, cxContainer, cxProgressBar;
Data.Win.ADODB, cxGraphics, U_WindowFormdesign, cxEdit, Vcl.ExtCtrls,
cxControls, cxProgressBar, cxLookAndFeels, cxLookAndFeelPainters, cxContainer;
type
TfrmBaseList = class(TForm)
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
loadProcess: TPanel;
cxProgressBar2: TcxProgressBar;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
@ -77,18 +74,19 @@ procedure TfrmBaseList.FormCreate(Sender: TObject);
var
mFontSize:integer;
begin
getSystemIni();
self.Color:=clBtnFace;
//getSystemIni();
self.DoubleBuffered:=gIsUseSkin;
if gFontSize<9 then
begin
mFontSize := 12;
mFontSize := 9;
end
else
begin
mFontSize:=gFontSize ;
end;
self.Font.Size := gFontSize;
if self.Font.Size<>gFontSize then
self.Font.Size := gFontSize;
if trim(gFontName)<>'' then
self.Font.Name:=gFontName;
// ´°¿Ú±³¾°É«
@ -111,8 +109,6 @@ begin
fWindowDesign.FormStyleInit(self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd, '', fParameters10);
end;
// TFormInitThread.Create(fWindowDesign,self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd,trim(gStructVer));
// SendMessage(self.Handle, WM_SETREDRAW, 1, 0);
end;

View File

@ -8,25 +8,25 @@ uses
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,StrUtils,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl,
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit, dxSkinsDefaultPainters;
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit;
//function saveLayOut(dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):Boolean;
function readLayOut(dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:string):Boolean;
//function mustInCheck(dxLayoutControl1:TdxLayoutControl ;textFlag:string='*'):Boolean;
procedure SetFormOperRight(app:Tapplication;mParent: TwinControl; mRightCaptions: PWideChar)stdcall;external 'rtCommon.dll' Name 'SetFormOperRight_A';
function getSystemFontSize(ADOTmp: TADOQuery;mStyleCode:PWideChar): Integer;stdcall;external 'rtCommon.dll' Name 'getSystemFontSize_A';
function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl;textFlag:PWideChar):boolean;stdcall;external 'rtCommon.dll' Name 'mustInCheck_A';
function isHasDesignRight(ADOTmp: TADOQuery;userId:PWideChar): boolean;stdcall;external 'rtCommon.dll' Name 'isHasDesignRight_A';
function isUseSkin(): boolean;stdcall;external 'rtCommon.dll' Name 'isUseSkin_A';
function isGridNativeSet(): boolean;stdcall;external 'rtCommon.dll' Name 'isGridNativeSet_A';
//procedure SetFormOperRight(app:Tapplication;mParent: TwinControl; mRightCaptions: PWideChar)stdcall;external 'rtCommon.dll' Name 'SetFormOperRight_A';
//function getSystemFontSize(ADOTmp: TADOQuery;mStyleCode:PWideChar): Integer;stdcall;external 'rtCommon.dll' Name 'getSystemFontSize_A';
function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl;textFlag:string='*'):boolean;
//function isHasDesignRight(ADOTmp: TADOQuery;userId:PWideChar): boolean;stdcall;external 'rtCommon.dll' Name 'isHasDesignRight_A';
//function isUseSkin(): boolean;stdcall;external 'rtCommon.dll' Name 'isUseSkin_A';
//function isGridNativeSet(): boolean;stdcall;external 'rtCommon.dll' Name 'isGridNativeSet_A';
//function readLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'readLayOut_A';
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'saveLayOut_A';
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:PWideChar )stdcall;external 'rtCommon.dll' Name 'layoutDesign_A';
procedure SetShowModalHide(mHandle:Thandle;form:Tform)stdcall;external 'rtCommon.dll';
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):boolean;
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string );
procedure SetShowModalHide(mHandle:Thandle;form:Tform);
procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
function GetsysParam(AdoTmp:Tadoquery;StyleRepository:TcxStyleRepository;muserId: pchar; fparam1: pchar): Boolean;
procedure addQryCondition1(Application:Tapplication;AdoTmp:Tadoquery;Panel_zdy:Tpanel;layOut: TdxLayoutControl;mdesignCode:PWideChar;rowCount:integer=4)stdcall;external 'rtCommon.dll' Name 'addQryCondition';
//procedure addQryCondition1(Application:Tapplication;AdoTmp:Tadoquery;Panel_zdy:Tpanel;layOut: TdxLayoutControl;mdesignCode:PWideChar;rowCount:integer=4)stdcall;external 'rtCommon.dll' Name 'addQryCondition';
procedure addQryCondition( AdoTmp:Tadoquery;formId:Integer;gridName:string;FlowPanel1:TFlowPanel;rowCount:integer=4);
procedure addQryContionByLay(AdoTmp:Tadoquery;formId:Integer;gridName:string;layOut:TdxLayoutControl;rowCount:integer=4);
procedure initWinData(AdoTmp:TadoQuery;obj:TwinControl;sqlStr:string);
@ -67,70 +67,6 @@ begin
end;
end;
//必须输入控制
// function mustInCheck(dxLayoutControl1:TdxLayoutControl ;textFlag:string='*'):Boolean;
// var
// i:integer;
// j:Integer;
// mcatpion:string;
// layGroup:TdxLayoutGroup;
// begin
// result:=false;
// for I := 0 to dxLayoutControl1.Items.Count-1 do
// begin
// // mcatpion:= TdxLayoutItem(dxLayoutControl1.Controls[i].Parent).caption ;
// // if pos(textFlag, mcatpion)>=0 then
// // begin
// // ShowMessage(dxLayoutControl1.Items[i].name);
// // end;
//
// if dxLayoutControl1.Items[i] is TdxLayoutGroup then
// begin
// layGroup := TdxLayoutGroup( dxLayoutControl1.Items[i]) ;
// for j := 0 to layGroup.Count -1 do
// begin
// // ShowMessage(layGroup.items[j].name);
// mcatpion:= TdxLayoutItem(layGroup.items[j]).Caption ;
// if pos(textFlag, mcatpion)>0 then
// begin
// if TdxLayoutItem(layGroup.items[j]).Control is TcxTextEdit then
// begin
// if Trim(TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
// begin
// //
// mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
// TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='请输入数据!';
// TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
// ShowMessage('【'+mcatpion+'】,数据不能为空!');
//
// exit ;
// end;
// continue;
// end;
// //
// if TdxLayoutItem(layGroup.items[j]).Control is TcxButtonEdit then
// begin
// if Trim(TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
// begin
// //
// mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
// // TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='请输入数据!';
// TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
// ShowMessage('【'+mcatpion+'】,数据不能为空!');
//
// exit ;
// end;
// continue;
// end;
//
// end;
// end;
//
// end;
//
// end;
// result:=true;
// end;
////////////////////////////////////
procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
@ -162,13 +98,13 @@ begin
open;
DServerDate := fieldByName('dt').AsDatetime;
end;
gFontSize:= getSystemFontSize(AdoTmp,PWideChar('01'));
for i := 0 to StyleRepository.Count-1 do
begin
if gFontSize>=9 then
TcxStyle( StyleRepository.Items[i] ).Font.Size:=gFontSize;
end;
// gFontSize:= getSystemFontSize(AdoTmp,PWideChar('01'));
//
// for i := 0 to StyleRepository.Count-1 do
// begin
// if gFontSize>=9 then
// TcxStyle( StyleRepository.Items[i] ).Font.Size:=gFontSize;
// end;
result := true;
end;
@ -423,6 +359,7 @@ begin
textEdit.Text:='';
textEdit.AlignWithMargins:=true;
textEdit.Style.Font.Size:=gFontSize;
// textEdit.Properties.OnEditValueChanged:=TfilterClick;
textEdit.TabOrder:=cnt;
textEdit.tag:=2;
@ -578,9 +515,126 @@ begin
gGridNativeSet := programIni.ReadBool('窗口设置', 'grid',true);
gfontSize := programIni.ReadInteger('窗口设置', '字体大小', 12);
gfontName := programIni.ReadString('窗口设置', '字体名称', '');
gIsYsUse := programIni.ReadBool('窗口设置', 'stand', false);
finally
programIni.Free;
end;
end;
//必须输入控制
function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl ;textFlag:string='*'):Boolean;
var
i:integer;
j:Integer;
mcatpion:string;
layGroup:TdxLayoutGroup;
begin
result:=false;
if textFlag='' then textFlag:='*';
for I := 0 to dxLayoutControl1.Items.Count-1 do
begin
// mcatpion:= TdxLayoutItem(dxLayoutControl1.Controls[i].Parent).caption ;
// if pos(textFlag, mcatpion)>=0 then
// begin
// ShowMessage(dxLayoutControl1.Items[i].name);
// end;
//ShowMessage(mcatpion);
if dxLayoutControl1.Items[i] is TdxLayoutGroup then
begin
layGroup := TdxLayoutGroup( dxLayoutControl1.Items[i]) ;
for j := 0 to layGroup.Count -1 do
begin
mcatpion:= TdxLayoutItem(layGroup.items[j]).Caption ;
// ShowMessage(mcatpion);
if pos(textFlag, mcatpion)>0 then
begin
if TdxLayoutItem(layGroup.items[j]).Control is TcxTextEdit then
begin
if Trim(TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
begin
//
mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='请输入数据!';
TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
ShowMessage('【'+mcatpion+'】,数据不能为空!');
exit ;
end;
continue;
end;
//
if TdxLayoutItem(layGroup.items[j]).Control is TcxButtonEdit then
begin
if Trim(TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
begin
//
mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
// TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='请输入数据!';
TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
ShowMessage('【'+mcatpion+'】,数据不能为空!');
exit ;
end;
continue;
end;
end;
end;
end;
end;
result:=true;
end;
///////////////////////////////////////////////////////
procedure SetShowModalHide(mHandle:Thandle;form:Tform);
begin
enablewindow(mHandle,true);
end;
/////////////////////////////////
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string );
begin
// if not IsHasDesignRight(ADOTmp,PWideChar(userId)) then
// exit;
dxLayoutControl1.Customization := True;
end;
/////////////////////////////////////
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):Boolean;
var
LayoutStream: TMemoryStream;
begin
LayoutStream := TMemoryStream.Create;
try
dxLayoutControl1.SaveToStream(LayoutStream);
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('select A.* ');
sql.Add('from SD_Design_FormLayout A');
sql.Add('where A.designCode=' + quotedStr(mdesignCode));
open;
if RecordCount>0 then
begin
edit;
end
else
begin
append;
FieldByName('designCode').value:=mdesignCode;
FieldByName('fileGroup').value:='1';
FieldByName('height').value:=0;
end;
TBlobField(FieldByName('fileContent')).LoadFromStream(LayoutStream);
Post;
end;
finally
LayoutStream.Free; // 释放内存流
end;
end;
end.

View File

@ -8,9 +8,9 @@ uses
Dialogs, Menus, DB, ADODB, cxLabel, BtnEdit, RTComboBox, cxTextEdit, cxMRUEdit,
cxDBData, cxGridLevel, cxButtonEdit, cxCurrencyEdit, cxGridTableView, cxGrid,
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, U_cxGridCustomCss,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, U_cxGridCustomCss,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels,dxLayoutControl,
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit,FrameDateSel;
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit;
type
TWindowFormDeSign = class(TObject)
@ -28,7 +28,7 @@ type
// procedure SetCxGridColumnBestWidth(cxGrid: TcxGridDBTableView);
// function SaveFormGridInfo(mCxGridView: TcxGridDBTableView; ADOCmd: TADOQuery; mdesignCode: string; mGridName: string; mGridType: integer): boolean;
// procedure SetFormOperRight(mParent: TwinControl; mRightCaptions: string);
procedure SetFormOperRight(mParent: TwinControl; mRightCaptions: string);
function GetMaxId(): integer;
procedure cxGridViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
@ -80,13 +80,15 @@ var
mdesignCode: string;
setGridButton: TToolButton;
begin
if gIsYsUse then exit;
ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp;
fDllName := gDllFileName;
fFormName := mForm.name;
fFormId := mFormId;
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
//if trim(mStyleCode) = '' then
// mStyleCode := '01';
@ -96,12 +98,14 @@ begin
fFontSize:= gFontSize ;
end
else
begin
fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
if fFontSize < 9 then
fFontSize := 12;
gFontSize:=fFontSize;
end;
fFontSize:=9;
// else
// begin
// fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
// if fFontSize < 9 then
// fFontSize := 12;
// gFontSize:=fFontSize;
// end;
mForm.Font.Size := fFontSize;
// 窗口背景色
@ -148,15 +152,15 @@ begin
TcxCurrencyEdit(mForm.Components[i]).ParentFont:=True;
continue;
end;
if mForm.Components[i] is TfrmFrameDateSel then
begin
TfrmFrameDateSel(mForm.Components[i]).Font.Size:= fFontSize;
TfrmFrameDateSel(mForm.Components[i]).cbbType.ParentFont:= true;
TfrmFrameDateSel(mForm.Components[i]).BegDate.ParentFont:=true;
TfrmFrameDateSel(mForm.Components[i]).endDate.ParentFont:=true;
// TfrmFrameDateSel(mForm.Components[i]).TimeType.ParentFont:=true;
continue;
end;
// if mForm.Components[i] is TfrmFrameDateSel then
// begin
// TfrmFrameDateSel(mForm.Components[i]).Font.Size:= fFontSize;
// TfrmFrameDateSel(mForm.Components[i]).cbbType.ParentFont:= true;
// TfrmFrameDateSel(mForm.Components[i]).BegDate.ParentFont:=true;
// TfrmFrameDateSel(mForm.Components[i]).endDate.ParentFont:=true;
// // TfrmFrameDateSel(mForm.Components[i]).TimeType.ParentFont:=true;
// continue;
// end;
if mForm.Components[i] is TcxMemo then
begin
if mForm.Components[i].Tag<999 then
@ -210,7 +214,7 @@ begin
TToolBar(mForm.Components[i]).List := mToolBarList;
end;
if mRightCaptions<>'' then
SetFormOperRight(application,TToolBar(mForm.Components[i]), PWideChar(mRightCaptions));
SetFormOperRight(TToolBar(mForm.Components[i]), PWideChar(mRightCaptions));
continue;
end;
if mForm.Components[i] is TcxTabControl then
@ -323,7 +327,7 @@ begin
mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + TcxGrid(mForm.Components[i]).name;
CreateCxGridColumn(application, TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode));
CreateCxGridColumn( TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode));
continue;
end;
@ -339,84 +343,69 @@ end;
function TWindowFormDeSign.FormStyleInit1(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
var
i: integer;
cxStyle_GridOddRow: TcxStyle;
cxStyle_GridEvenRow: TcxStyle;
cxStyle_active: TcxStyle;
cxStyle_gridGroupBox: TcxStyle;
cxStyle_gridFoot: TcxStyle;
cxStyle_selection: TcxStyle;
mvalue: TcxStyleValues;
mCtl3D, mToolBarList: boolean;
mIsCustomBackColor: boolean;
mIsDrawGridHeader: boolean;
// mIsDrawGridHeader: boolean;
mdesignCode: string;
setGridButton: TToolButton;
SaveRedraw:boolean;
comp: TComponent;
view: TcxGridDBTableView;
grid: TcxGrid;
toolBar: TToolBar;
layoutControl: TdxLayoutControl;
begin
if gIsYsUse then
exit;
ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp;
fDllName := gDllFileName;
fFormName := mForm.name;
fFormId := mFormId;
// gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
// if gFontSize>=9 then
// begin
// fFontSize:= gFontSize ;
// end
// else
// begin
// fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
// if fFontSize < 9 then
// fFontSize := 12;
// gFontSize:=fFontSize;
// end;
// mForm.Font.Size := fFontSize;
//if gFontName<>'' then
// mForm.Font.Name:=gFontName;
// 窗口背景色
//exit;
try
// SaveRedraw := (GetWindowLong(mForm.Handle, GWL_STYLE) and WS_VISIBLE) <> 0;
for i := 0 to mForm.ComponentCount - 1 do
begin
if not ( mForm.Components[i] is TcxGrid) and not( mForm.Components[i] is TToolBar) and not( mForm.Components[i] is TdxCustomLayoutControl) then Continue;
comp := mForm.Components[i];
if not ( comp is TcxGrid) and not( comp is TToolBar) and not( comp is TdxCustomLayoutControl) then Continue;
if mForm.Components[i] is TcxGrid then
if comp is TcxGrid then
begin
if mForm.Components[i].Tag>=999 then Continue;
TcxGrid(mForm.Components[i]).ParentFont:=true;
grid := TcxGrid(comp);
if grid.Tag>=999 then Continue;
grid.BeginUpdate();
// TcxGrid(mForm.Components[i]).ParentFont:=true;
view := TcxGridDBTableView(grid.Views[0]);
//自动响应过滤
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).dataController.filter.AutoDataSetFilter := true;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).optionsCustomize.columnfiltering := true;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnSelectionChanged := cxGridViewSelectionChanged;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).optionsCustomize.columnfiltering := true;
mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + TcxGrid(mForm.Components[i]).name;
CreateCxGridColumn(application, TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode));
view.dataController.filter.AutoDataSetFilter := true;
view.optionsCustomize.columnfiltering := true;
view.OnSelectionChanged := cxGridViewSelectionChanged;
view.OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell;
view.optionsCustomize.columnfiltering := true;
mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + grid.name;
grid.EndUpdate ;
CreateCxGridColumn( view,ADOQueryTmp,PWideChar(mdesignCode));
continue;
end;
//continue;
end
//
if mForm.Components[i] is TToolBar then
else if mForm.Components[i] is TToolBar then
begin
if mForm.Components[i].Tag>=999 then exit;
if mForm.Components[i].Tag<999 then
TToolBar(mForm.Components[i]).ParentFont:=True;
TToolBar(mForm.Components[i]).AutoSize := true;
TToolBar(mForm.Components[i]).Flat := true;
toolBar := TToolBar(comp);
if toolBar.Tag>=999 then exit;
if toolBar.Tag<999 then
toolBar.ParentFont:=True;
toolBar.AutoSize := true;
toolBar.Flat := true;
//
if gIsCanDesign then
begin
if mForm.Components[i].FindComponent('TgridLiSet')=nil then
if (mForm.Components[i].FindComponent('TgridLiSet')=nil) or (mForm.Components[i].FindComponent('TgridSet')=nil) then
begin
TToolBar(mForm.Components[i]).Wrapable:=false;
toolBar.Wrapable:=false;
setGridButton := TToolButton.Create(mForm); //
setGridButton.Left := TToolBar(mForm.Components[i]).ButtonWidth * TToolBar(mForm.Components[i]).ButtonCount;
setGridButton.Parent := TToolBar(mForm.Components[i]);
setGridButton.Left := toolBar.ButtonWidth * toolBar.ButtonCount;
setGridButton.Parent := toolBar;
setGridButton.ImageIndex := 16; //
setGridButton.Caption:='表格列设置';
// setGridButton.Name:='TgridLiSet';
@ -427,26 +416,27 @@ begin
end;
end;
if mIsCustomBackColor then
TToolBar(mForm.Components[i]).Color := clToolBarBack;
if mForm.Components[i].Tag = 0 then
toolBar.Color := clToolBarBack;
if toolBar.Tag = 0 then
begin
if ADOTmp.IsEmpty then
TToolBar(mForm.Components[i]).List := false
toolBar.List := false
else
TToolBar(mForm.Components[i]).List := mToolBarList;
toolBar.List := mToolBarList;
end;
if mRightCaptions<>'' then
SetFormOperRight(application,TToolBar(mForm.Components[i]), PWideChar(mRightCaptions));
continue;
end;
if mForm.Components[i] is TdxCustomLayoutControl then
SetFormOperRight(toolBar, PWideChar(mRightCaptions));
//continue;
end
else if mForm.Components[i] is TdxLayoutControl then
begin
if mForm.Components[i].Tag<999 then
TdxLayoutControl(mForm.Components[i]).ParentFont:=true;
if mForm.Components[i].Tag<>1000 then
layoutControl := TdxLayoutControl(comp);
if layoutControl.Tag<999 then
layoutControl.ParentFont:=true;
if layoutControl.Tag<>1000 then
begin
TdxLayoutControl(mForm.Components[i]).OnDblClick := dxLayoutControl1DblClick ;
readLayOut(TdxLayoutControl(mForm.Components[i]),ADOTmp,PWideChar( fDllFileName+'|'+mForm.name+'|'+TdxLayoutControl(mForm.Components[i]).Name+'.ini'));
layoutControl.OnDblClick := dxLayoutControl1DblClick ;
readLayOut(layoutControl,ADOTmp,PWideChar( fDllFileName+'|'+mForm.name+'|'+layoutControl.Name+'.ini'));
end;
continue;
end;
@ -483,170 +473,22 @@ begin
fFormId := mFormId;
exit;
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
if gFontSize>=9 then
begin
if gFontSize>=9 then
begin
fFontSize:= gFontSize ;
end
else
begin
fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
if fFontSize < 9 then
fFontSize := 12;
gFontSize:=fFontSize;
end;
end
else
begin
fFontSize:= 9;//
end;
mForm.Font.Size := fFontSize;
end;
/// ////////////////////////////////////////////////////////////////////
// 保存窗口表格列的原始信息
/// ///////////////////////////////////////////////////////////////////////
//function TWindowFormDeSign.SaveFormGridInfo(mCxGridView: TcxGridDBTableView; ADOCmd: TADOQuery; mdesignCode: string; mGridName: string; mGridType: integer): boolean;
//var
// i: integer;
// mfieldName: string;
//begin
// result := false;
// try
// /// ////////////////
// /// ////////////////
// with ADOQueryCmd do
// begin
// close;
// sql.Clear;
// sql.Add('select * from SD_FormGrid_Main A');
// sql.Add('where A.designCode=' + quotedStr(mdesignCode));
// open;
// if RecordCount <= 0 then
// begin
// append;
// fieldByName('designCode').value := mdesignCode;
// fieldByName('GridType').value := mGridType;
// fieldByName('gridName').value := TcxGrid(TcxGridLevel(mCxGridView.level).Control).name;
// end
// else
// edit;
//
// fieldByName('ProcedureParam').value := '';
// fieldByName('newProcedureName').value := '';
// post;
//
// close;
//
// end;
// // 子信息
// with ADOCmd do
// begin
// close;
// sql.Clear;
// sql.Add('select * from SD_FormGrid_Design');
// sql.Add('where designCode=' + quotedStr(mdesignCode));
// sql.Add('and formId=' + intTostr(fFormId));
// sql.Add('and formName=' + quotedStr(fFormName));
// // sql.Add('and GridName='+QuotedStr(mgridName));
// open;
//
// for i := mCxGridView.ColumnCount - 1 downto 0 do
// begin
// mfieldName := TcxGridDBColumn(mCxGridView.Columns[i]).DataBinding.FieldName;
//
// if locate('fieldName', mfieldName, []) then
// begin
// continue;
// end
// else
// begin
// append;
// fieldByName('Id').value := GetMaxId();
// fieldByName('formId').value := fFormId;
// fieldByName('formName').value := fFormName;
// fieldByName('designCode').value := mdesignCode;
// fieldByName('GridName').value := mGridName;
//
// fieldByName('ColumnName').value := mCxGridView.Columns[i].name;
// fieldByName('Visible').value := mCxGridView.Columns[i].Visible;
// fieldByName('ColumnHide').value := mCxGridView.Columns[i].Hidden;
// fieldByName('oldCaption').value := mCxGridView.Columns[i].Caption;
// fieldByName('Valid').value := 1;
// end;
//
// fieldByName('GridIndex').value := mGridType;
// fieldByName('FieldName').value := trim(TcxGridDBColumn(mCxGridView.Columns[i]).DataBinding.FieldName);
// fieldByName('Caption').value := mCxGridView.Columns[i].Caption;
// fieldByName('ColumnType').value := trim(TcxGridDBColumn(mCxGridView.Columns[i]).DataBinding.ValueType);
//
// fieldByName('Width').value := mCxGridView.Columns[i].Width;
// fieldByName('IsOrder').value := 1;
// fieldByName('ColumnFilter').value := mCxGridView.Columns[i].Filtered;
// fieldByName('ColumnOrder').value := mCxGridView.Columns[i].Index;
// if mCxGridView.Columns[i].FixedKind= fkLeftDynamic then
// begin
// fieldByName('fixColumn').value := True;
// end
// else
// begin
// fieldByName('fixColumn').value := false;
// end;
// post;
// end;
//
// close;
// end;
//
// /// /////////////////////////////////////////////
// //
// for i := 0 to mCxGridView.dataController.DataSet.FieldCount - 1 do
// begin
// mfieldName := trim(mCxGridView.dataController.DataSet.Fields[i].FieldName);
// if mfieldName = '' then
// continue;
// with ADOCmd do
// begin
// close;
// sql.Clear;
// sql.Add('select * from SD_FormGrid_Design');
// sql.Add('where designCode=' + quotedStr(mdesignCode));
// // sql.Add('and GridName='+QuotedStr(mgridName));
// sql.Add('and fieldName=' + quotedStr(mfieldName));
// open;
// if RecordCount <= 0 then
// begin
// append;
// fieldByName('Id').value := GetMaxId();
// fieldByName('formName').value := fFormName;
// fieldByName('formId').value := fFormId;
// fieldByName('GridName').value := mGridName;
// fieldByName('GridIndex').value := mGridType;
// fieldByName('designCode').value := mdesignCode;
//
// fieldByName('fieldName').value := mfieldName;
//
// fieldByName('ColumnType').value := mCxGridView.dataController.DataSet.Fields[i].DataType;
// fieldByName('Caption').value := '未启用';
// fieldByName('ColumnName').value := mCxGridView.name + mfieldName;
// fieldByName('Visible').value := false;
// fieldByName('AddFlag').value := true;
//
// fieldByName('Width').value := 60;
// fieldByName('ColumnOrder').value := 99;
//
// fieldByName('Valid').value := 0;
// post;
// end;
// close;
// end;
// end;
// result := true;
// except
// application.MessageBox('保存窗口表格信息时发生错误', '提示信息', 0);
// end;
//end;
/// /////////////////////////////////////////////////
//
/// ///////////////////////////////////////////////////
@ -804,8 +646,8 @@ begin
if not gIsCanDesign then
exit;
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName));
CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,fFormName ,mGridName,fDllFileName,fformId,0,fProcedureName);
CreateCxGridColumn( mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end;
/// ////////////////////////////////////////////////////////////////
@ -813,8 +655,8 @@ end;
/// /////////////////////////////////////////////////////////////////
procedure TWindowFormDeSign.OpenGridDesignWin10(mdesignCode:string;mGridName:string;mCxGridView: TcxGridDBTableView);
begin
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName));
CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,fFormName ,mGridName,fDllFileName,fformId,0,fProcedureName);
CreateCxGridColumn( mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end;
/// //////////////////////////////////////
@ -844,84 +686,84 @@ end;
/// //////////////////////////////////////////////////////////////
// 设置toolbar按钮权限参数
/// //////////////////////////////////////////////////////////////
//procedure TWindowFormDeSign.SetFormOperRight(mParent: TwinControl; mRightCaptions: string);
//var
// i: integer;
// mCaption: string;
// mOperRight: string;
//begin
// mOperRight := mRightCaptions;
//
// if mOperRight = '' then
// exit;
//
// try
// /// ////////////////////////////////////////////
// if mParent is TToolBar then
// begin
// for i := 0 to TToolBar(mParent).ButtonCount - 1 do
// begin
// mCaption := trim(TToolBar(mParent).Buttons[i].Caption);
// if (mCaption = '关闭') or (mCaption = '退出') or (mCaption = '放弃') then
// exit;
// /// //////////////////////////
// if trim(mOperRight) = '查询' then
// begin
// if pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0 then // ,查看,详细
// begin
// TToolBar(mParent).Buttons[i].Visible := true;
// end
// else
// begin
// TToolBar(mParent).Buttons[i].Visible := false;
// end;
// end
// else
// begin
// if (pos(mCaption, mOperRight) > 0) or (pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0) then // 查看,
// begin
// TToolBar(mParent).Buttons[i].Visible := true;
// end
// else
// begin
// TToolBar(mParent).Buttons[i].Visible := false;
// end;
// end;
// end;
// exit;
// end;
// /// ////////////////////////////////////////////////
// if trim(mOperRight) = '查询' then
// exit;
// with mParent do
// begin
// for i := 0 to ControlCount - 1 do
// begin
// mCaption := '';
// if (Controls[i] is TBitBtn) then
// mCaption := trim(TBitBtn(Controls[i]).Caption)
// else if (Controls[i] is TButton) then
// mCaption := trim(TButton(Controls[i]).Caption)
// else if (Controls[i] is TSpeedButton) then
// mCaption := trim(TSpeedButton(Controls[i]).Caption)
// else
// continue;
// if (Controls[i] is TBitBtn) or (Controls[i] is TButton) or (Controls[i] is TSpeedButton) then
// begin
// if (pos(mCaption, mOperRight) > 0) or (mCaption = '查询') or (mCaption = '过滤') or (mCaption = '高级过滤') then
// begin
// Controls[i].Visible := true;
// end
// else
// Controls[i].Visible := false;
// end;
// end;
// end;
//
// except
// application.MessageBox('初始化窗口按钮权限发生错误', '警告信息', 0);
// end;
//end;
procedure TWindowFormDeSign.SetFormOperRight(mParent: TwinControl; mRightCaptions: string);
var
i: integer;
mCaption: string;
mOperRight: string;
begin
mOperRight := mRightCaptions;
if mOperRight = '' then
exit;
try
/// ////////////////////////////////////////////
if mParent is TToolBar then
begin
for i := 0 to TToolBar(mParent).ButtonCount - 1 do
begin
mCaption := trim(TToolBar(mParent).Buttons[i].Caption);
if (mCaption = '关闭') or (mCaption = '退出') or (mCaption = '放弃') then
exit;
/// //////////////////////////
if trim(mOperRight) = '查询' then
begin
if pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0 then // ,查看,详细
begin
TToolBar(mParent).Buttons[i].Visible := true;
end
else
begin
TToolBar(mParent).Buttons[i].Visible := false;
end;
end
else
begin
if (pos(mCaption, mOperRight) > 0) or (pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0) then // 查看,
begin
TToolBar(mParent).Buttons[i].Visible := true;
end
else
begin
TToolBar(mParent).Buttons[i].Visible := false;
end;
end;
end;
exit;
end;
/// ////////////////////////////////////////////////
if trim(mOperRight) = '查询' then
exit;
with mParent do
begin
for i := 0 to ControlCount - 1 do
begin
mCaption := '';
if (Controls[i] is TBitBtn) then
mCaption := trim(TBitBtn(Controls[i]).Caption)
else if (Controls[i] is TButton) then
mCaption := trim(TButton(Controls[i]).Caption)
else if (Controls[i] is TSpeedButton) then
mCaption := trim(TSpeedButton(Controls[i]).Caption)
else
continue;
if (Controls[i] is TBitBtn) or (Controls[i] is TButton) or (Controls[i] is TSpeedButton) then
begin
if (pos(mCaption, mOperRight) > 0) or (mCaption = '查询') or (mCaption = '过滤') or (mCaption = '高级过滤') then
begin
Controls[i].Visible := true;
end
else
Controls[i].Visible := false;
end;
end;
end;
except
application.MessageBox('初始化窗口按钮权限发生错误', '警告信息', 0);
end;
end;
/// ////////////////////////////////////////////////////////////
//

View File

@ -16,33 +16,31 @@ uses
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit;
// procedure createFindLayout(dxLayoutControl1: TdxLayoutControl; ADOTmp: TADOQuery; mdesignCode: string);
procedure CreateCxGridColumn(application: TApplication; tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; mdesignCode: string);
procedure CreateCxGridColumn(tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; pdesignCode: PWideChar);
// stdcall;external 'rtCommon.dll' Name 'CreateCxGridColumn_A';
procedure CreateCxGridColumn_A(application: TApplication;
tv1: TcxGridDBTableView; ADOQueryTmp: TADOQuery; mdesignCode: string);
stdcall; external 'rtCommon.dll';
//procedure CreateCxGridColumn_A(application: TApplication;
// tv1: TcxGridDBTableView; ADOQueryTmp: TADOQuery; mdesignCode: string);
// stdcall; external 'rtCommon.dll';
procedure ShowCxGridDesign(application: TApplication;
mCxGridView: TcxGridDBTableView; client1: TClientDataSet; ADOCmd: TADOQuery;
mFormName: PWideChar; mGridName: PWideChar; mDllName: PWideChar;
mFormId: integer; mGridType: integer = 0;mProcedureName: PWideChar=nil); stdcall;
external 'rtCommon.dll' Name 'ShowCxGridDesign_A';
function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView;
ADOCmd: TADOQuery; designCode: PWideChar): Boolean; stdcall;
external 'rtCommon.dll' Name 'SaveGridSetInfoToBase_A';
mFormName: string; mGridName: string; mDllName: string;mFormId: integer; mGridType: integer = 0;mProcedureName: string='');
//function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView;
// ADOCmd: TADOQuery; designCode: PWideChar): Boolean; stdcall;
// external 'rtCommon.dll' Name 'SaveGridSetInfoToBase_A';
//
function checkColumnMustIn(app: TApplication; tv1: TcxGridDBTableView;
mFlag: integer): Boolean;
// stdcall;external 'rtCommon.dll' Name 'checkColumnMustIn_A';
function checkColumnMustIn_A(app: TApplication; tv1: TcxGridDBTableView;
client1: TClientDataSet; mFlag: integer): Boolean; stdcall;
external 'rtCommon.dll';
client1: TClientDataSet; mFlag: integer): Boolean;
procedure getColumnRelation(tv1: TcxGridDBTableView; client1: TClientDataSet);
function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView; client1:TClientDataSet;
ADOCmd: TADOQuery; designCode: string): Boolean;
implementation
// uses
// U_globalVar, U_DataLink;
uses
U_globalVar;
/// ////////////////////////////////////////////////////////////////
// 显示表格设计窗口
@ -246,8 +244,8 @@ implementation
/// ////////////////////////////////////////////////////////
// 函数功能动态创建CxGrid列
/// ////////////////////////////////////////////////////////
procedure CreateCxGridColumn(application: TApplication; tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; mdesignCode: string);
procedure CreateCxGridColumn( tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; pdesignCode: PWideChar);
var
ADBColumn: TcxGridDBColumn;
strField, strCaption: string;
@ -257,20 +255,23 @@ var
mAvgWidth, mGridWidth: integer;
HeaderStyle: TcxStyle;
footsumitem:tcxdatasummaryitem;
mdesignCode:string;
begin mWidth := 12;
mGridWidth := TcxGrid(TcxGridLevel(tv1.level).Control).Width;
mdesignCode:=pdesignCode ;
with ADOQueryTmp do begin close;
sql.Clear;
sql.Add('select A.* ');
sql.Add('from SD_FormGrid_Design A');
sql.Add('where A.designCode=' + quotedStr(mdesignCode));
open;
if IsEmpty then exit;
if IsEmpty then
exit;
end;
try
HeaderStyle := TcxStyle.Create(nil);
HeaderStyle.Font := TcxGrid(TcxGridLevel(tv1.level).Control).Font;
// HeaderStyle.Font := TcxGrid(TcxGridLevel(tv1.level).Control).Font;
HeaderStyle.TextColor := clBlue;
tv1.BeginUpdate;
@ -501,5 +502,264 @@ begin
end;
end;
//////////////////////////////////////////////////
/// //
function checkColumnMustIn_A(app:TApplication;tv1: TcxGridDBTableView;client1:TClientDataSet; mFlag: integer): Boolean;
var
i: integer;
mfieldName:string;
begin
result:=false;
for i := 0 to tv1.ColumnCount-1 do
begin
// ADBColumn :=TcxGridDBColumn( tv1.Columns[i] );
if tv1.Columns[i].Tag = mFlag then
begin
with tv1.DataController.DataSet do //
begin
if not client1.Locate('caption',tv1.Columns[i].Caption,[]) then Continue;
mfieldName :=trim( client1.FieldByName('fieldName').AsString);
if locate( mfieldName, null, []) or locate( mfieldName, '', []) then
begin
Application.MessageBox(PChar(tv1.Columns[i].Caption + '不能为空!'), '提示', 0);
exit;
end;
end;
end;
end;
result:=true;
end;
///////////////////////////////////
//////////////////////////////////////////////////
/// /// ////////////////////////////////////////////////////////////////////
// 保存表格列信息
/// ///////////////////////////////////////////////////////////////////////
function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView; client1:TClientDataSet;
ADOCmd: TADOQuery; designCode: string): Boolean;
var
i: integer;
mfieldName: string;
begin
result := false;
try
ADOCmd.close;
// ADOCmd.LockType := ltBatchOptimistic;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('select * from SD_FormGrid_Design');
sql.Add('where designCode=' + quotedStr(designCode));
open;
for i := mCxGridView.ColumnCount - 1 downto 0 do
begin
if not client1.Locate('caption',mCxGridView.Columns[i].Caption,[]) then Continue;
mfieldName :=trim( client1.FieldByName('fieldName').AsString);
if locate('fieldName', mfieldName, []) then
begin
continue;
end
else
begin
Append;
fieldByName('designCode').value := designCode;
fieldByName('ColumnName').value := mCxGridView.Columns[i].Name;
fieldByName('oldCaption').value := mCxGridView.Columns[i].Caption;
fieldByName('ColumnLock').value := 0;
fieldByName('ColumnHide').value := mCxGridView.Columns[i].Hidden;
fieldByName('ColumnOrder').value := mCxGridView.Columns[i].SortOrder;
fieldByName('Visible').value := mCxGridView.Columns[i].Visible;
fieldByName('Valid').value := 1;
end;
fieldByName('FieldName').value :=mfieldName;
fieldByName('Caption').value := mCxGridView.Columns[i].Caption;
fieldByName('ColumnType').value :=trim( client1.FieldByName('valueType').AsString);
if mCxGridView.Columns[i].FixedKind = fkLeftDynamic then
begin
fieldByName('fixColumn').value := True;
end
else
begin
fieldByName('fixColumn').value := false;
end;
fieldByName('Width').value := mCxGridView.Columns[i].Width;
if mCxGridView.Columns[i].Tag=9 then
begin
fieldByName('mustIn').value := true;
end
else
begin
fieldByName('mustIn').value := false;
end;
fieldByName('IsOrder').value := 1;
Post;
end;
end;
ADOCmd.UpdateBatch();
/// /////////////////////////////////////////////
//
for i := 0 to mCxGridView.DataController.DataSet.FieldCount - 1 do
begin
mfieldName := trim(mCxGridView.DataController.DataSet.Fields[i].FieldName);
if mfieldName = '' then
continue;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('select * from SD_FormGrid_Design');
sql.Add('where designcode=' + quotedStr(designCode));
sql.Add('and fieldName=' + quotedStr(mfieldName));
open;
if RecordCount <= 0 then
begin
Append;
fieldByName('designcode').value := designCode;
fieldByName('fieldName').value := mfieldName;
fieldByName('Caption').value := '未起用';
fieldByName('ColumnName').value := mCxGridView.Name + mfieldName;
if (mCxGridView.DataController.DataSet.Fields[i].DataType=ftString) or (mCxGridView.DataController.DataSet.Fields[i].DataType=ftWideString) then
fieldByName('ColumnType').value :='String'
else if (mCxGridView.DataController.DataSet.Fields[i].DataType=ftInteger) or (mCxGridView.DataController.DataSet.Fields[i].DataType=ftSmallInt) then
fieldByName('ColumnType').value :='Integer'
else if (mCxGridView.DataController.DataSet.Fields[i].DataType=ftFloat) or (mCxGridView.DataController.DataSet.Fields[i].DataType=ftBcd) then
fieldByName('ColumnType').value :='Float'
else if mCxGridView.DataController.DataSet.Fields[i].DataType=ftDateTime then
fieldByName('ColumnType').value :='DateTime'
else if mCxGridView.DataController.DataSet.Fields[i].DataType=ftBoolean then
fieldByName('ColumnType').value :='Boolean'
else
fieldByName('ColumnType').value :=TFieldType( mCxGridView.DataController.DataSet.Fields[i].DataType);
if fields.FindField('fieldValue')<>nil then
fieldByName('fieldValue').value :=mCxGridView.DataController.DataSet.Fields[i].Value;
fieldByName('Visible').value := false;
fieldByName('AddFlag').value := True;
fieldByName('Width').value := 60;
fieldByName('ColumnOrder').value := 99;
fieldByName('Valid').value := 0;
Post;
end
else
begin
edit;
if fields.FindField('fieldValue')<>nil then
fieldByName('fieldValue').value :=mCxGridView.DataController.DataSet.Fields[i].Value;
post;
end;
end;
end;
ADOCmd.UpdateBatch();
////////////////////////////////////////////
///更新字段值
ADOCmd.close;
ADOCmd.LockType:=ltOptimistic ;
result := True;
except
ADOCmd.close;
ADOCmd.LockType:=ltOptimistic ;
Application.MessageBox('保存信息时发生错误', '提示信息', 0);
end;
end;
///////////////////////////
procedure ShowCxGridDesign(application: TApplication;
mCxGridView: TcxGridDBTableView; client1: TClientDataSet; ADOCmd: TADOQuery;
mFormName: string; mGridName: string; mDllName: string;mFormId: integer; mGridType: integer = 0;mProcedureName: string='');
type
TMyFunc = function(App: Tapplication; FormH: hwnd; FormID: integer;
UID: String; UName: String; dataBase: string; Title: string; Def1: string;
Def2: string): hwnd; stdcall;
var
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
newh: hwnd;
mdesignCode: string;
begin
mdesignCode := mDllName +'|'+mFormName+ '|' + intTostr(mFormId) + '|' + mGridName;
///////////////////
if mProcedureName<>'' then
begin
with ADOCmd do
begin
close;
sql.Clear ;
sql.Add('select * from SD_FormGrid_Main A');
sql.Add('where A.designCode='+quotedStr(mdesignCode));
Open;
if RecordCount<=0 then
begin
append;
fieldByName('designCode').Value :=mdesignCode;
fieldByName('gridName').Value :=mGridName;
fieldByName('ProcedureParam').Value :='';
end
else
edit;
fieldByName('newProcedureName').Value :=trim(mProcedureName);
post;
end;
end;
/// ////////////////////////////////////////
// 保存当前控件信息
if not SaveGridSetInfoToBase(mCxGridView,client1, ADOCmd, mdesignCode) then
begin
exit;
end;
/// ////////////////////////////////////////
//
Th := LoadLibrary('rtDesign.dll');
if Th > 0 then
begin
try
Tp := GetProcAddress(Th, 'GetDllForm');
if Tp <> nil then
begin
Tf := TMyFunc(Tp);
newh := Tf(Application, 0, 2, PChar(gUserId), PChar(gUserName),
PChar(ADOCmd.Connection.ConnectionString), PChar('表格设计'), PChar(mdesignCode), PChar(''));
end
else
begin
ShowMessage('调用rtDesign.dll时发生错误!');
end;
finally
// FreeLibrary();
end;
end
else
begin
ShowMessage('找不到rtDesign.dll');
end;
end;
end.

View File

@ -15,6 +15,8 @@ var
gFontName:string;
gIsUseSkin:boolean;
gStructVer:string;
gSystemId:string;
gIsYsUse:boolean;
const
WM_CloseForm = WM_USER + 100 ;