Revert "速度优化"

This reverts commit e16ba6fa53.
This commit is contained in:
sgwp 2024-11-27 14:49:17 +08:00
parent e16ba6fa53
commit fe777b3e7c
10 changed files with 502 additions and 695 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -17,28 +17,34 @@ object frmBaseList: TfrmBaseList
OnShow = FormShow OnShow = FormShow
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 17 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 object cxProgressBar2: TcxProgressBar
Left = 288 Left = 288
Top = 112 Top = 120
Enabled = False Margins.Left = 1
Style.LookAndFeel.NativeStyle = True Margins.Top = 1
StyleDisabled.LookAndFeel.NativeStyle = True Margins.Right = 1
StyleFocused.LookAndFeel.NativeStyle = True Margins.Bottom = 1
StyleHot.LookAndFeel.NativeStyle = True ParentFont = False
TabOrder = 1 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
Visible = False Visible = False
Width = 177 Width = 153
end end
object ADOQueryBaseCmd: TADOQuery object ADOQueryBaseCmd: TADOQuery
Parameters = <> Parameters = <>

View File

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

View File

@ -8,25 +8,25 @@ uses
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,StrUtils, cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,StrUtils,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink, cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl, cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl,
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit; cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit, dxSkinsDefaultPainters;
//function saveLayOut(dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):Boolean; //function saveLayOut(dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):Boolean;
function readLayOut(dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:string):Boolean; function readLayOut(dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:string):Boolean;
//function mustInCheck(dxLayoutControl1:TdxLayoutControl ;textFlag:string='*'):Boolean; //function mustInCheck(dxLayoutControl1:TdxLayoutControl ;textFlag:string='*'):Boolean;
//procedure SetFormOperRight(app:Tapplication;mParent: TwinControl; mRightCaptions: PWideChar)stdcall;external 'rtCommon.dll' Name 'SetFormOperRight_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 getSystemFontSize(ADOTmp: TADOQuery;mStyleCode:PWideChar): Integer;stdcall;external 'rtCommon.dll' Name 'getSystemFontSize_A';
function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl;textFlag:string='*'):boolean; 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 isHasDesignRight(ADOTmp: TADOQuery;userId:PWideChar): boolean;stdcall;external 'rtCommon.dll' Name 'isHasDesignRight_A';
//function isUseSkin(): boolean;stdcall;external 'rtCommon.dll' Name 'isUseSkin_A'; function isUseSkin(): boolean;stdcall;external 'rtCommon.dll' Name 'isUseSkin_A';
//function isGridNativeSet(): boolean;stdcall;external 'rtCommon.dll' Name 'isGridNativeSet_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 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:string):boolean; 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:string ); procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:PWideChar )stdcall;external 'rtCommon.dll' Name 'layoutDesign_A';
procedure SetShowModalHide(mHandle:Thandle;form:Tform); procedure SetShowModalHide(mHandle:Thandle;form:Tform)stdcall;external 'rtCommon.dll';
procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer); procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
function GetsysParam(AdoTmp:Tadoquery;StyleRepository:TcxStyleRepository;muserId: pchar; fparam1: pchar): Boolean; 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 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 addQryContionByLay(AdoTmp:Tadoquery;formId:Integer;gridName:string;layOut:TdxLayoutControl;rowCount:integer=4);
procedure initWinData(AdoTmp:TadoQuery;obj:TwinControl;sqlStr:string); procedure initWinData(AdoTmp:TadoQuery;obj:TwinControl;sqlStr:string);
@ -67,6 +67,70 @@ begin
end; end;
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); procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
@ -98,13 +162,13 @@ begin
open; open;
DServerDate := fieldByName('dt').AsDatetime; DServerDate := fieldByName('dt').AsDatetime;
end; end;
// gFontSize:= getSystemFontSize(AdoTmp,PWideChar('01')); gFontSize:= getSystemFontSize(AdoTmp,PWideChar('01'));
//
// for i := 0 to StyleRepository.Count-1 do for i := 0 to StyleRepository.Count-1 do
// begin begin
// if gFontSize>=9 then if gFontSize>=9 then
// TcxStyle( StyleRepository.Items[i] ).Font.Size:=gFontSize; TcxStyle( StyleRepository.Items[i] ).Font.Size:=gFontSize;
// end; end;
result := true; result := true;
end; end;
@ -359,7 +423,6 @@ begin
textEdit.Text:=''; textEdit.Text:='';
textEdit.AlignWithMargins:=true; textEdit.AlignWithMargins:=true;
textEdit.Style.Font.Size:=gFontSize; textEdit.Style.Font.Size:=gFontSize;
// textEdit.Properties.OnEditValueChanged:=TfilterClick;
textEdit.TabOrder:=cnt; textEdit.TabOrder:=cnt;
textEdit.tag:=2; textEdit.tag:=2;
@ -515,126 +578,9 @@ begin
gGridNativeSet := programIni.ReadBool('窗口设置', 'grid',true); gGridNativeSet := programIni.ReadBool('窗口设置', 'grid',true);
gfontSize := programIni.ReadInteger('窗口设置', '字体大小', 12); gfontSize := programIni.ReadInteger('窗口设置', '字体大小', 12);
gfontName := programIni.ReadString('窗口设置', '字体名称', ''); gfontName := programIni.ReadString('窗口设置', '字体名称', '');
gIsYsUse := programIni.ReadBool('窗口设置', 'stand', false);
finally finally
programIni.Free; programIni.Free;
end; end;
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. end.

View File

@ -10,7 +10,7 @@ uses
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView, cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, U_cxGridCustomCss, cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, U_cxGridCustomCss,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels,dxLayoutControl, cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels,dxLayoutControl,
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit; cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit,FrameDateSel;
type type
TWindowFormDeSign = class(TObject) TWindowFormDeSign = class(TObject)
@ -28,7 +28,7 @@ type
// procedure SetCxGridColumnBestWidth(cxGrid: TcxGridDBTableView); // procedure SetCxGridColumnBestWidth(cxGrid: TcxGridDBTableView);
// function SaveFormGridInfo(mCxGridView: TcxGridDBTableView; ADOCmd: TADOQuery; mdesignCode: string; mGridName: string; mGridType: integer): boolean; // 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; function GetMaxId(): integer;
procedure cxGridViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure cxGridViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
@ -80,15 +80,13 @@ var
mdesignCode: string; mdesignCode: string;
setGridButton: TToolButton; setGridButton: TToolButton;
begin begin
if gIsYsUse then exit;
ADOQueryCmd := ADOQCmd; ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp; ADOQueryTmp := ADOTmp;
fDllName := gDllFileName; fDllName := gDllFileName;
fFormName := mForm.name; fFormName := mForm.name;
fFormId := mFormId; fFormId := mFormId;
//gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ; gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
// //
//if trim(mStyleCode) = '' then //if trim(mStyleCode) = '' then
// mStyleCode := '01'; // mStyleCode := '01';
@ -98,14 +96,12 @@ begin
fFontSize:= gFontSize ; fFontSize:= gFontSize ;
end end
else else
fFontSize:=9; begin
// else fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
// begin if fFontSize < 9 then
// fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode)); fFontSize := 12;
// if fFontSize < 9 then gFontSize:=fFontSize;
// fFontSize := 12; end;
// gFontSize:=fFontSize;
// end;
mForm.Font.Size := fFontSize; mForm.Font.Size := fFontSize;
// 窗口背景色 // 窗口背景色
@ -152,15 +148,15 @@ begin
TcxCurrencyEdit(mForm.Components[i]).ParentFont:=True; TcxCurrencyEdit(mForm.Components[i]).ParentFont:=True;
continue; continue;
end; end;
// if mForm.Components[i] is TfrmFrameDateSel then if mForm.Components[i] is TfrmFrameDateSel then
// begin begin
// TfrmFrameDateSel(mForm.Components[i]).Font.Size:= fFontSize; TfrmFrameDateSel(mForm.Components[i]).Font.Size:= fFontSize;
// TfrmFrameDateSel(mForm.Components[i]).cbbType.ParentFont:= true; TfrmFrameDateSel(mForm.Components[i]).cbbType.ParentFont:= true;
// TfrmFrameDateSel(mForm.Components[i]).BegDate.ParentFont:=true; TfrmFrameDateSel(mForm.Components[i]).BegDate.ParentFont:=true;
// TfrmFrameDateSel(mForm.Components[i]).endDate.ParentFont:=true; TfrmFrameDateSel(mForm.Components[i]).endDate.ParentFont:=true;
// // TfrmFrameDateSel(mForm.Components[i]).TimeType.ParentFont:=true; // TfrmFrameDateSel(mForm.Components[i]).TimeType.ParentFont:=true;
// continue; continue;
// end; end;
if mForm.Components[i] is TcxMemo then if mForm.Components[i] is TcxMemo then
begin begin
if mForm.Components[i].Tag<999 then if mForm.Components[i].Tag<999 then
@ -214,7 +210,7 @@ begin
TToolBar(mForm.Components[i]).List := mToolBarList; TToolBar(mForm.Components[i]).List := mToolBarList;
end; end;
if mRightCaptions<>'' then if mRightCaptions<>'' then
SetFormOperRight(TToolBar(mForm.Components[i]), PWideChar(mRightCaptions)); SetFormOperRight(application,TToolBar(mForm.Components[i]), PWideChar(mRightCaptions));
continue; continue;
end; end;
if mForm.Components[i] is TcxTabControl then if mForm.Components[i] is TcxTabControl then
@ -327,7 +323,7 @@ begin
mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + TcxGrid(mForm.Components[i]).name; mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + TcxGrid(mForm.Components[i]).name;
CreateCxGridColumn( TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode)); CreateCxGridColumn(application, TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode));
continue; continue;
end; end;
@ -343,69 +339,84 @@ end;
function TWindowFormDeSign.FormStyleInit1(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean; function TWindowFormDeSign.FormStyleInit1(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
var var
i: integer; 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; mCtl3D, mToolBarList: boolean;
mIsCustomBackColor: boolean; mIsCustomBackColor: boolean;
// mIsDrawGridHeader: boolean; mIsDrawGridHeader: boolean;
mdesignCode: string; mdesignCode: string;
setGridButton: TToolButton; setGridButton: TToolButton;
comp: TComponent; SaveRedraw:boolean;
view: TcxGridDBTableView;
grid: TcxGrid;
toolBar: TToolBar;
layoutControl: TdxLayoutControl;
begin begin
if gIsYsUse then
exit;
ADOQueryCmd := ADOQCmd; ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp; ADOQueryTmp := ADOTmp;
fDllName := gDllFileName; fDllName := gDllFileName;
fFormName := mForm.name; fFormName := mForm.name;
fFormId := mFormId; fFormId := mFormId;
try // 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 for i := 0 to mForm.ComponentCount - 1 do
begin begin
comp := mForm.Components[i]; if not ( mForm.Components[i] is TcxGrid) and not( mForm.Components[i] is TToolBar) and not( mForm.Components[i] is TdxCustomLayoutControl) then Continue;
if not ( comp is TcxGrid) and not( comp is TToolBar) and not( comp is TdxCustomLayoutControl) then Continue;
if comp is TcxGrid then if mForm.Components[i] is TcxGrid then
begin begin
grid := TcxGrid(comp); if mForm.Components[i].Tag>=999 then Continue;
if grid.Tag>=999 then Continue; TcxGrid(mForm.Components[i]).ParentFont:=true;
grid.BeginUpdate();
// TcxGrid(mForm.Components[i]).ParentFont:=true;
view := TcxGridDBTableView(grid.Views[0]);
//自动响应过滤 //自动响应过滤
view.dataController.filter.AutoDataSetFilter := true; TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).dataController.filter.AutoDataSetFilter := true;
view.optionsCustomize.columnfiltering := true; TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).optionsCustomize.columnfiltering := true;
view.OnSelectionChanged := cxGridViewSelectionChanged; TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnSelectionChanged := cxGridViewSelectionChanged;
view.OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell; TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell;
view.optionsCustomize.columnfiltering := true; TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).optionsCustomize.columnfiltering := true;
mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + grid.name; mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + TcxGrid(mForm.Components[i]).name;
grid.EndUpdate ; CreateCxGridColumn(application, TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode));
CreateCxGridColumn( view,ADOQueryTmp,PWideChar(mdesignCode));
//continue; continue;
end end;
// //
else if mForm.Components[i] is TToolBar then if mForm.Components[i] is TToolBar then
begin begin
toolBar := TToolBar(comp); if mForm.Components[i].Tag>=999 then exit;
if toolBar.Tag>=999 then exit; if mForm.Components[i].Tag<999 then
if toolBar.Tag<999 then TToolBar(mForm.Components[i]).ParentFont:=True;
toolBar.ParentFont:=True; TToolBar(mForm.Components[i]).AutoSize := true;
toolBar.AutoSize := true; TToolBar(mForm.Components[i]).Flat := true;
toolBar.Flat := true;
// //
if gIsCanDesign then if gIsCanDesign then
begin begin
if (mForm.Components[i].FindComponent('TgridLiSet')=nil) or (mForm.Components[i].FindComponent('TgridSet')=nil) then if mForm.Components[i].FindComponent('TgridLiSet')=nil then
begin begin
toolBar.Wrapable:=false; TToolBar(mForm.Components[i]).Wrapable:=false;
setGridButton := TToolButton.Create(mForm); // setGridButton := TToolButton.Create(mForm); //
setGridButton.Left := toolBar.ButtonWidth * toolBar.ButtonCount; setGridButton.Left := TToolBar(mForm.Components[i]).ButtonWidth * TToolBar(mForm.Components[i]).ButtonCount;
setGridButton.Parent := toolBar; setGridButton.Parent := TToolBar(mForm.Components[i]);
setGridButton.ImageIndex := 16; // setGridButton.ImageIndex := 16; //
setGridButton.Caption:='表格列设置'; setGridButton.Caption:='表格列设置';
// setGridButton.Name:='TgridLiSet'; // setGridButton.Name:='TgridLiSet';
@ -416,27 +427,26 @@ begin
end; end;
end; end;
if mIsCustomBackColor then if mIsCustomBackColor then
toolBar.Color := clToolBarBack; TToolBar(mForm.Components[i]).Color := clToolBarBack;
if toolBar.Tag = 0 then if mForm.Components[i].Tag = 0 then
begin begin
if ADOTmp.IsEmpty then if ADOTmp.IsEmpty then
toolBar.List := false TToolBar(mForm.Components[i]).List := false
else else
toolBar.List := mToolBarList; TToolBar(mForm.Components[i]).List := mToolBarList;
end; end;
if mRightCaptions<>'' then if mRightCaptions<>'' then
SetFormOperRight(toolBar, PWideChar(mRightCaptions)); SetFormOperRight(application,TToolBar(mForm.Components[i]), PWideChar(mRightCaptions));
//continue; continue;
end end;
else if mForm.Components[i] is TdxLayoutControl then if mForm.Components[i] is TdxCustomLayoutControl then
begin begin
layoutControl := TdxLayoutControl(comp); if mForm.Components[i].Tag<999 then
if layoutControl.Tag<999 then TdxLayoutControl(mForm.Components[i]).ParentFont:=true;
layoutControl.ParentFont:=true; if mForm.Components[i].Tag<>1000 then
if layoutControl.Tag<>1000 then
begin begin
layoutControl.OnDblClick := dxLayoutControl1DblClick ; TdxLayoutControl(mForm.Components[i]).OnDblClick := dxLayoutControl1DblClick ;
readLayOut(layoutControl,ADOTmp,PWideChar( fDllFileName+'|'+mForm.name+'|'+layoutControl.Name+'.ini')); readLayOut(TdxLayoutControl(mForm.Components[i]),ADOTmp,PWideChar( fDllFileName+'|'+mForm.name+'|'+TdxLayoutControl(mForm.Components[i]).Name+'.ini'));
end; end;
continue; continue;
end; end;
@ -473,6 +483,8 @@ begin
fFormId := mFormId; fFormId := mFormId;
exit; exit;
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
if gFontSize>=9 then if gFontSize>=9 then
begin begin
@ -480,8 +492,10 @@ begin
end end
else else
begin begin
fFontSize:= 9;// fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
if fFontSize < 9 then
fFontSize := 12;
gFontSize:=fFontSize;
end; end;
mForm.Font.Size := fFontSize; mForm.Font.Size := fFontSize;
@ -489,6 +503,150 @@ begin
end; 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;
/// ///////////////////////////////////////////////// /// /////////////////////////////////////////////////
// //
/// /////////////////////////////////////////////////// /// ///////////////////////////////////////////////////
@ -646,8 +804,8 @@ begin
if not gIsCanDesign then if not gIsCanDesign then
exit; exit;
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,fFormName ,mGridName,fDllFileName,fformId,0,fProcedureName); ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName));
CreateCxGridColumn( mCxGridView,ADOQueryTmp,PWideChar(mdesignCode)); CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end; end;
/// //////////////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////////////
@ -655,8 +813,8 @@ end;
/// ///////////////////////////////////////////////////////////////// /// /////////////////////////////////////////////////////////////////
procedure TWindowFormDeSign.OpenGridDesignWin10(mdesignCode:string;mGridName:string;mCxGridView: TcxGridDBTableView); procedure TWindowFormDeSign.OpenGridDesignWin10(mdesignCode:string;mGridName:string;mCxGridView: TcxGridDBTableView);
begin begin
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,fFormName ,mGridName,fDllFileName,fformId,0,fProcedureName); ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName));
CreateCxGridColumn( mCxGridView,ADOQueryTmp,PWideChar(mdesignCode)); CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end; end;
/// ////////////////////////////////////// /// //////////////////////////////////////
@ -686,84 +844,84 @@ end;
/// ////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////
// 设置toolbar按钮权限参数 // 设置toolbar按钮权限参数
/// ////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////
procedure TWindowFormDeSign.SetFormOperRight(mParent: TwinControl; mRightCaptions: string); //procedure TWindowFormDeSign.SetFormOperRight(mParent: TwinControl; mRightCaptions: string);
var //var
i: integer; // i: integer;
mCaption: string; // mCaption: string;
mOperRight: string; // mOperRight: string;
begin //begin
mOperRight := mRightCaptions; // mOperRight := mRightCaptions;
//
if mOperRight = '' then // if mOperRight = '' then
exit; // exit;
//
try // try
/// //////////////////////////////////////////// // /// ////////////////////////////////////////////
if mParent is TToolBar then // if mParent is TToolBar then
begin // begin
for i := 0 to TToolBar(mParent).ButtonCount - 1 do // for i := 0 to TToolBar(mParent).ButtonCount - 1 do
begin // begin
mCaption := trim(TToolBar(mParent).Buttons[i].Caption); // mCaption := trim(TToolBar(mParent).Buttons[i].Caption);
if (mCaption = '关闭') or (mCaption = '退出') or (mCaption = '放弃') then // if (mCaption = '关闭') or (mCaption = '退出') or (mCaption = '放弃') then
exit; // exit;
/// ////////////////////////// // /// //////////////////////////
if trim(mOperRight) = '查询' then // if trim(mOperRight) = '查询' then
begin // begin
if pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0 then // ,查看,详细 // if pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0 then // ,查看,详细
begin // begin
TToolBar(mParent).Buttons[i].Visible := true; // TToolBar(mParent).Buttons[i].Visible := true;
end // end
else // else
begin // begin
TToolBar(mParent).Buttons[i].Visible := false; // TToolBar(mParent).Buttons[i].Visible := false;
end; // end;
end // end
else // else
begin // begin
if (pos(mCaption, mOperRight) > 0) or (pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0) then // 查看, // if (pos(mCaption, mOperRight) > 0) or (pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0) then // 查看,
begin // begin
TToolBar(mParent).Buttons[i].Visible := true; // TToolBar(mParent).Buttons[i].Visible := true;
end // end
else // else
begin // begin
TToolBar(mParent).Buttons[i].Visible := false; // TToolBar(mParent).Buttons[i].Visible := false;
end; // end;
end; // end;
end; // end;
exit; // exit;
end; // end;
/// //////////////////////////////////////////////// // /// ////////////////////////////////////////////////
if trim(mOperRight) = '查询' then // if trim(mOperRight) = '查询' then
exit; // exit;
with mParent do // with mParent do
begin // begin
for i := 0 to ControlCount - 1 do // for i := 0 to ControlCount - 1 do
begin // begin
mCaption := ''; // mCaption := '';
if (Controls[i] is TBitBtn) then // if (Controls[i] is TBitBtn) then
mCaption := trim(TBitBtn(Controls[i]).Caption) // mCaption := trim(TBitBtn(Controls[i]).Caption)
else if (Controls[i] is TButton) then // else if (Controls[i] is TButton) then
mCaption := trim(TButton(Controls[i]).Caption) // mCaption := trim(TButton(Controls[i]).Caption)
else if (Controls[i] is TSpeedButton) then // else if (Controls[i] is TSpeedButton) then
mCaption := trim(TSpeedButton(Controls[i]).Caption) // mCaption := trim(TSpeedButton(Controls[i]).Caption)
else // else
continue; // continue;
if (Controls[i] is TBitBtn) or (Controls[i] is TButton) or (Controls[i] is TSpeedButton) then // if (Controls[i] is TBitBtn) or (Controls[i] is TButton) or (Controls[i] is TSpeedButton) then
begin // begin
if (pos(mCaption, mOperRight) > 0) or (mCaption = '查询') or (mCaption = '过滤') or (mCaption = '高级过滤') then // if (pos(mCaption, mOperRight) > 0) or (mCaption = '查询') or (mCaption = '过滤') or (mCaption = '高级过滤') then
begin // begin
Controls[i].Visible := true; // Controls[i].Visible := true;
end // end
else // else
Controls[i].Visible := false; // Controls[i].Visible := false;
end; // end;
end; // end;
end; // end;
//
except // except
application.MessageBox('初始化窗口按钮权限发生错误', '警告信息', 0); // application.MessageBox('初始化窗口按钮权限发生错误', '警告信息', 0);
end; // end;
end; //end;
/// //////////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////////
// //

View File

@ -16,31 +16,33 @@ uses
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit; cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit;
// procedure createFindLayout(dxLayoutControl1: TdxLayoutControl; ADOTmp: TADOQuery; mdesignCode: string); // procedure createFindLayout(dxLayoutControl1: TdxLayoutControl; ADOTmp: TADOQuery; mdesignCode: string);
procedure CreateCxGridColumn(tv1: TcxGridDBTableView; procedure CreateCxGridColumn(application: TApplication; tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; pdesignCode: PWideChar); ADOQueryTmp: TADOQuery; mdesignCode: string);
// stdcall;external 'rtCommon.dll' Name 'CreateCxGridColumn_A'; // stdcall;external 'rtCommon.dll' Name 'CreateCxGridColumn_A';
//procedure CreateCxGridColumn_A(application: TApplication; procedure CreateCxGridColumn_A(application: TApplication;
// tv1: TcxGridDBTableView; ADOQueryTmp: TADOQuery; mdesignCode: string); tv1: TcxGridDBTableView; ADOQueryTmp: TADOQuery; mdesignCode: string);
// stdcall; external 'rtCommon.dll'; stdcall; external 'rtCommon.dll';
procedure ShowCxGridDesign(application: TApplication; procedure ShowCxGridDesign(application: TApplication;
mCxGridView: TcxGridDBTableView; client1: TClientDataSet; ADOCmd: TADOQuery; mCxGridView: TcxGridDBTableView; client1: TClientDataSet; ADOCmd: TADOQuery;
mFormName: string; mGridName: string; mDllName: string;mFormId: integer; mGridType: integer = 0;mProcedureName: string=''); mFormName: PWideChar; mGridName: PWideChar; mDllName: PWideChar;
//function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView; mFormId: integer; mGridType: integer = 0;mProcedureName: PWideChar=nil); stdcall;
// ADOCmd: TADOQuery; designCode: PWideChar): Boolean; stdcall; external 'rtCommon.dll' Name 'ShowCxGridDesign_A';
// external 'rtCommon.dll' Name 'SaveGridSetInfoToBase_A'; function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView;
ADOCmd: TADOQuery; designCode: PWideChar): Boolean; stdcall;
external 'rtCommon.dll' Name 'SaveGridSetInfoToBase_A';
// //
function checkColumnMustIn(app: TApplication; tv1: TcxGridDBTableView; function checkColumnMustIn(app: TApplication; tv1: TcxGridDBTableView;
mFlag: integer): Boolean; mFlag: integer): Boolean;
// stdcall;external 'rtCommon.dll' Name 'checkColumnMustIn_A'; // stdcall;external 'rtCommon.dll' Name 'checkColumnMustIn_A';
function checkColumnMustIn_A(app: TApplication; tv1: TcxGridDBTableView; function checkColumnMustIn_A(app: TApplication; tv1: TcxGridDBTableView;
client1: TClientDataSet; mFlag: integer): Boolean; client1: TClientDataSet; mFlag: integer): Boolean; stdcall;
external 'rtCommon.dll';
procedure getColumnRelation(tv1: TcxGridDBTableView; client1: TClientDataSet); procedure getColumnRelation(tv1: TcxGridDBTableView; client1: TClientDataSet);
function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView; client1:TClientDataSet;
ADOCmd: TADOQuery; designCode: string): Boolean;
implementation implementation
uses // uses
U_globalVar; // U_globalVar, U_DataLink;
/// //////////////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////////////
// 显示表格设计窗口 // 显示表格设计窗口
@ -244,8 +246,8 @@ implementation
/// //////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////
// 函数功能动态创建CxGrid列 // 函数功能动态创建CxGrid列
/// //////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////
procedure CreateCxGridColumn( tv1: TcxGridDBTableView; procedure CreateCxGridColumn(application: TApplication; tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; pdesignCode: PWideChar); ADOQueryTmp: TADOQuery; mdesignCode: string);
var var
ADBColumn: TcxGridDBColumn; ADBColumn: TcxGridDBColumn;
strField, strCaption: string; strField, strCaption: string;
@ -255,23 +257,20 @@ var
mAvgWidth, mGridWidth: integer; mAvgWidth, mGridWidth: integer;
HeaderStyle: TcxStyle; HeaderStyle: TcxStyle;
footsumitem:tcxdatasummaryitem; footsumitem:tcxdatasummaryitem;
mdesignCode:string;
begin mWidth := 12; begin mWidth := 12;
mGridWidth := TcxGrid(TcxGridLevel(tv1.level).Control).Width; mGridWidth := TcxGrid(TcxGridLevel(tv1.level).Control).Width;
mdesignCode:=pdesignCode ;
with ADOQueryTmp do begin close; with ADOQueryTmp do begin close;
sql.Clear; sql.Clear;
sql.Add('select A.* '); sql.Add('select A.* ');
sql.Add('from SD_FormGrid_Design A'); sql.Add('from SD_FormGrid_Design A');
sql.Add('where A.designCode=' + quotedStr(mdesignCode)); sql.Add('where A.designCode=' + quotedStr(mdesignCode));
open; open;
if IsEmpty then if IsEmpty then exit;
exit;
end; end;
try try
HeaderStyle := TcxStyle.Create(nil); HeaderStyle := TcxStyle.Create(nil);
// HeaderStyle.Font := TcxGrid(TcxGridLevel(tv1.level).Control).Font; HeaderStyle.Font := TcxGrid(TcxGridLevel(tv1.level).Control).Font;
HeaderStyle.TextColor := clBlue; HeaderStyle.TextColor := clBlue;
tv1.BeginUpdate; tv1.BeginUpdate;
@ -502,264 +501,5 @@ begin
end; end;
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. end.

View File

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