优化提交

This commit is contained in:
sgwp 2024-11-27 14:57:52 +08:00
parent f084f24621
commit 777304e5ff
9 changed files with 694 additions and 501 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 = ebsSingle Style.BorderStyle = ebsNone
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 = lfFlat Style.LookAndFeel.Kind = lfOffice11
Style.LookAndFeel.NativeStyle = False Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = 'WXI' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.Kind = lfFlat StyleDisabled.LookAndFeel.Kind = lfOffice11
StyleDisabled.LookAndFeel.NativeStyle = False StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.SkinName = 'WXI' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.BorderColor = clSkyBlue StyleFocused.BorderColor = clSkyBlue
StyleFocused.BorderStyle = ebsSingle StyleFocused.BorderStyle = ebsSingle
StyleFocused.LookAndFeel.Kind = lfFlat StyleFocused.LookAndFeel.Kind = lfOffice11
StyleFocused.LookAndFeel.NativeStyle = False StyleFocused.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.SkinName = 'WXI' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.BorderColor = clSkyBlue StyleHot.BorderColor = clSkyBlue
StyleHot.BorderStyle = ebsSingle StyleHot.BorderStyle = ebsSingle
StyleHot.LookAndFeel.Kind = lfFlat StyleHot.LookAndFeel.Kind = lfOffice11
StyleHot.LookAndFeel.NativeStyle = False StyleHot.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.SkinName = 'WXI' StyleHot.LookAndFeel.SkinName = ''
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, dxSkinsForm, cxContainer, cxEdit, cxLookAndFeels, cxContainer, cxEdit,
System.ImageList, Vcl.ImgList, Vcl.Controls, cxImageList, cxGraphics, cxStyles, System.ImageList, Vcl.ImgList, Vcl.Controls, cxImageList, cxGraphics, cxStyles,
dxLayoutLookAndFeels,cxLocalization; dxLayoutLookAndFeels,cxLocalization, dxSkinsForm;
type type
TBaseDataLink = class(TDataModule) TBaseDataLink = class(TDataModule)
@ -54,11 +54,14 @@ var
str :String; str :String;
pathStr:String; pathStr:String;
I: Integer; I: Integer;
thread:Tthread; thread:TThread;
begin begin
///////////////////
RootLookAndFeel.NativeStyle := false; dxSkinController1.BeginUpdate;
gFontSize:=0; //////////////////////
thread:=TThread.CreateAnonymousThread(
procedure
begin
if (fileexists(ExtractFilePath(Application.ExeName) + 'devchs.ini') = true) if (fileexists(ExtractFilePath(Application.ExeName) + 'devchs.ini') = true)
then then
@ -68,21 +71,48 @@ begin
cxLocalizer1.Active := true; cxLocalizer1.Active := true;
cxLocalizer1.LanguageIndex := 1; cxLocalizer1.LanguageIndex := 1;
end; end;
//
if not isUseSkin() then
begin
dxSkinController1.UseSkins:=false;
dxSkinController1.SkinName:='';
end
else
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);
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; end;
dxSkinController1.EndUpdate;
end; end;

View File

@ -36,18 +36,18 @@ 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 := 12; mFontSize := 9;
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;
fWindowDesign:=TWindowFormDeSign.Create(); fWindowDesign:=TWindowFormDeSign.Create();
@ -59,11 +59,26 @@ begin
end; end;
procedure TfrmBaseInput.FormShow(Sender: TObject); procedure TfrmBaseInput.FormShow(Sender: TObject);
//var
// thread:TThread;
begin begin
if trim(gStructVer)='' then // thread:=TThread.CreateAnonymousThread(
fWindowDesign.FormStyleInit1(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd) // procedure
else // begin
fWindowDesign.FormStyleInit(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd) ; // 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;
end. end.

View File

@ -17,34 +17,28 @@ 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 = 120 Top = 112
Margins.Left = 1 Enabled = False
Margins.Top = 1 Style.LookAndFeel.NativeStyle = True
Margins.Right = 1 StyleDisabled.LookAndFeel.NativeStyle = True
Margins.Bottom = 1 StyleFocused.LookAndFeel.NativeStyle = True
ParentFont = False StyleHot.LookAndFeel.NativeStyle = True
Properties.AnimationSpeed = 2 TabOrder = 1
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 = 153 Width = 177
end end
object ADOQueryBaseCmd: TADOQuery object ADOQueryBaseCmd: TADOQuery
Parameters = <> Parameters = <>

View File

@ -5,17 +5,14 @@ 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, U_WindowFormdesign, cxGraphics, cxControls, cxLookAndFeels, Data.Win.ADODB, cxGraphics, U_WindowFormdesign, cxEdit, Vcl.ExtCtrls,
cxLookAndFeelPainters, cxControls, cxProgressBar, cxLookAndFeels, cxLookAndFeelPainters, cxContainer;
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);
@ -77,18 +74,19 @@ procedure TfrmBaseList.FormCreate(Sender: TObject);
var var
mFontSize:integer; mFontSize:integer;
begin begin
getSystemIni(); self.Color:=clBtnFace;
//getSystemIni();
self.DoubleBuffered:=gIsUseSkin; self.DoubleBuffered:=gIsUseSkin;
if gFontSize<9 then if gFontSize<9 then
begin begin
mFontSize := 12; mFontSize := 9;
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;
// ´°¿Ú±³¾°É« // ´°¿Ú±³¾°É«
@ -111,8 +109,6 @@ 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, dxSkinsDefaultPainters; cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit;
//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:PWideChar):boolean;stdcall;external 'rtCommon.dll' Name 'mustInCheck_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 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:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'saveLayOut_A'; function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):boolean;
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:PWideChar )stdcall;external 'rtCommon.dll' Name 'layoutDesign_A'; procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string );
procedure SetShowModalHide(mHandle:Thandle;form:Tform)stdcall;external 'rtCommon.dll'; procedure SetShowModalHide(mHandle:Thandle;form:Tform);
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,70 +67,6 @@ 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);
@ -162,13 +98,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;
@ -423,6 +359,7 @@ 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;
@ -578,9 +515,126 @@ 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,FrameDateSel; cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit;
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,13 +80,15 @@ 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';
@ -96,12 +98,14 @@ begin
fFontSize:= gFontSize ; fFontSize:= gFontSize ;
end end
else else
begin fFontSize:=9;
fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode)); // else
if fFontSize < 9 then // begin
fFontSize := 12; // fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
gFontSize:=fFontSize; // if fFontSize < 9 then
end; // fFontSize := 12;
// gFontSize:=fFontSize;
// end;
mForm.Font.Size := fFontSize; mForm.Font.Size := fFontSize;
// 窗口背景色 // 窗口背景色
@ -148,15 +152,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
@ -210,7 +214,7 @@ begin
TToolBar(mForm.Components[i]).List := mToolBarList; TToolBar(mForm.Components[i]).List := mToolBarList;
end; end;
if mRightCaptions<>'' then if mRightCaptions<>'' then
SetFormOperRight(application,TToolBar(mForm.Components[i]), PWideChar(mRightCaptions)); SetFormOperRight(TToolBar(mForm.Components[i]), PWideChar(mRightCaptions));
continue; continue;
end; end;
if mForm.Components[i] is TcxTabControl then if mForm.Components[i] is TcxTabControl then
@ -323,7 +327,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(application, TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode)); CreateCxGridColumn( TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode));
continue; continue;
end; end;
@ -339,84 +343,69 @@ 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;
SaveRedraw:boolean; comp: TComponent;
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;
// 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 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
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 begin
if mForm.Components[i].Tag>=999 then Continue; grid := TcxGrid(comp);
TcxGrid(mForm.Components[i]).ParentFont:=true; 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; view.dataController.filter.AutoDataSetFilter := true;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).optionsCustomize.columnfiltering := true; view.optionsCustomize.columnfiltering := true;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnSelectionChanged := cxGridViewSelectionChanged; view.OnSelectionChanged := cxGridViewSelectionChanged;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell; view.OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).optionsCustomize.columnfiltering := true; view.optionsCustomize.columnfiltering := true;
mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + TcxGrid(mForm.Components[i]).name; mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + grid.name;
CreateCxGridColumn(application, TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode)); grid.EndUpdate ;
CreateCxGridColumn( view,ADOQueryTmp,PWideChar(mdesignCode));
continue; //continue;
end; end
// //
if mForm.Components[i] is TToolBar then else if mForm.Components[i] is TToolBar then
begin begin
if mForm.Components[i].Tag>=999 then exit; toolBar := TToolBar(comp);
if mForm.Components[i].Tag<999 then if toolBar.Tag>=999 then exit;
TToolBar(mForm.Components[i]).ParentFont:=True; if toolBar.Tag<999 then
TToolBar(mForm.Components[i]).AutoSize := true; toolBar.ParentFont:=True;
TToolBar(mForm.Components[i]).Flat := true; toolBar.AutoSize := true;
toolBar.Flat := true;
// //
if gIsCanDesign then if gIsCanDesign then
begin 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 begin
TToolBar(mForm.Components[i]).Wrapable:=false; toolBar.Wrapable:=false;
setGridButton := TToolButton.Create(mForm); // setGridButton := TToolButton.Create(mForm); //
setGridButton.Left := TToolBar(mForm.Components[i]).ButtonWidth * TToolBar(mForm.Components[i]).ButtonCount; setGridButton.Left := toolBar.ButtonWidth * toolBar.ButtonCount;
setGridButton.Parent := TToolBar(mForm.Components[i]); setGridButton.Parent := toolBar;
setGridButton.ImageIndex := 16; // setGridButton.ImageIndex := 16; //
setGridButton.Caption:='表格列设置'; setGridButton.Caption:='表格列设置';
// setGridButton.Name:='TgridLiSet'; // setGridButton.Name:='TgridLiSet';
@ -427,26 +416,27 @@ begin
end; end;
end; end;
if mIsCustomBackColor then if mIsCustomBackColor then
TToolBar(mForm.Components[i]).Color := clToolBarBack; toolBar.Color := clToolBarBack;
if mForm.Components[i].Tag = 0 then if toolBar.Tag = 0 then
begin begin
if ADOTmp.IsEmpty then if ADOTmp.IsEmpty then
TToolBar(mForm.Components[i]).List := false toolBar.List := false
else else
TToolBar(mForm.Components[i]).List := mToolBarList; toolBar.List := mToolBarList;
end; end;
if mRightCaptions<>'' then if mRightCaptions<>'' then
SetFormOperRight(application,TToolBar(mForm.Components[i]), PWideChar(mRightCaptions)); SetFormOperRight(toolBar, PWideChar(mRightCaptions));
continue; //continue;
end; end
if mForm.Components[i] is TdxCustomLayoutControl then else if mForm.Components[i] is TdxLayoutControl then
begin begin
if mForm.Components[i].Tag<999 then layoutControl := TdxLayoutControl(comp);
TdxLayoutControl(mForm.Components[i]).ParentFont:=true; if layoutControl.Tag<999 then
if mForm.Components[i].Tag<>1000 then layoutControl.ParentFont:=true;
if layoutControl.Tag<>1000 then
begin begin
TdxLayoutControl(mForm.Components[i]).OnDblClick := dxLayoutControl1DblClick ; layoutControl.OnDblClick := dxLayoutControl1DblClick ;
readLayOut(TdxLayoutControl(mForm.Components[i]),ADOTmp,PWideChar( fDllFileName+'|'+mForm.name+'|'+TdxLayoutControl(mForm.Components[i]).Name+'.ini')); readLayOut(layoutControl,ADOTmp,PWideChar( fDllFileName+'|'+mForm.name+'|'+layoutControl.Name+'.ini'));
end; end;
continue; continue;
end; end;
@ -483,170 +473,22 @@ begin
fFormId := mFormId; fFormId := mFormId;
exit; exit;
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
if gFontSize>=9 then if gFontSize>=9 then
begin begin
fFontSize:= gFontSize ; fFontSize:= gFontSize ;
end end
else else
begin begin
fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode)); fFontSize:= 9;//
if fFontSize < 9 then
fFontSize := 12; end;
gFontSize:=fFontSize;
end;
mForm.Font.Size := fFontSize; mForm.Font.Size := fFontSize;
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;
/// ///////////////////////////////////////////////// /// /////////////////////////////////////////////////
// //
/// /////////////////////////////////////////////////// /// ///////////////////////////////////////////////////
@ -804,8 +646,8 @@ begin
if not gIsCanDesign then if not gIsCanDesign then
exit; exit;
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName)); ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,fFormName ,mGridName,fDllFileName,fformId,0,fProcedureName);
CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode)); CreateCxGridColumn( mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end; end;
/// //////////////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////////////
@ -813,8 +655,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,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName)); ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,fFormName ,mGridName,fDllFileName,fformId,0,fProcedureName);
CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode)); CreateCxGridColumn( mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end; end;
/// ////////////////////////////////////// /// //////////////////////////////////////
@ -844,84 +686,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,33 +16,31 @@ 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(application: TApplication; tv1: TcxGridDBTableView; procedure CreateCxGridColumn(tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; mdesignCode: string); ADOQueryTmp: TADOQuery; pdesignCode: PWideChar);
// 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: PWideChar; mGridName: PWideChar; mDllName: PWideChar; mFormName: string; mGridName: string; mDllName: string;mFormId: integer; mGridType: integer = 0;mProcedureName: string='');
mFormId: integer; mGridType: integer = 0;mProcedureName: PWideChar=nil); stdcall; //function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView;
external 'rtCommon.dll' Name 'ShowCxGridDesign_A'; // ADOCmd: TADOQuery; designCode: PWideChar): Boolean; stdcall;
function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView; // external 'rtCommon.dll' Name 'SaveGridSetInfoToBase_A';
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; stdcall; client1: TClientDataSet; mFlag: integer): Boolean;
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_DataLink; U_globalVar;
/// //////////////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////////////
// 显示表格设计窗口 // 显示表格设计窗口
@ -246,8 +244,8 @@ implementation
/// //////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////
// 函数功能动态创建CxGrid列 // 函数功能动态创建CxGrid列
/// //////////////////////////////////////////////////////// /// ////////////////////////////////////////////////////////
procedure CreateCxGridColumn(application: TApplication; tv1: TcxGridDBTableView; procedure CreateCxGridColumn( tv1: TcxGridDBTableView;
ADOQueryTmp: TADOQuery; mdesignCode: string); ADOQueryTmp: TADOQuery; pdesignCode: PWideChar);
var var
ADBColumn: TcxGridDBColumn; ADBColumn: TcxGridDBColumn;
strField, strCaption: string; strField, strCaption: string;
@ -257,20 +255,23 @@ 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 exit; if IsEmpty then
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;
@ -501,5 +502,264 @@ 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,6 +15,8 @@ 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 ;