⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ufunsys.~pas

📁 一个会议签到系统
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
//〈〈〈------------------------------------------------------------------------
//〈〈〈------------------------------------------------------------------------

{******************************************************************************
*       填充第一行标题以及设置各列的对齐格式。
******************************************************************************}
procedure MyFillGridCaptionA(const MyCaptions:Array of string;
                            const MyAlignment:array of integer;
                            MsFlexGridName:TMsFlexGrid);
var
   i:integer;
   StrTemp:string;
begin
   if  high(MyCaptions)=-1 then
   begin
     exit;
   end;
   Msflexgridname.Cols:=High(Mycaptions);

   StrTemp:='';
   with MsFlexGridName  do
   begin
      Redraw:=False;
      if  (Cols<high(MyCaptions)+1) or (Cols>high(MyCaptions)+1) then
          Cols := high(MyCaptions)+1;
      if  Rows<2 then
        Rows := 2;
      for i :=0 to high(MyCaptions) do
      begin
         Row:=1;
         ColAlignment[i]:=MyAlignment[i];
      end;
      for i :=0 to high(MyCaptions) do
      begin
         FixedAlignment[i]:=flexAlignCenterCenter;// = $00000004;
         TextMatrix[0,i]:=MyCaptions[i]
      end;
      ReDraw:=True;
   end;

end;
{*******************************************************************************
*           对齐方式  钱相关的iRight  单据单号相关的iLeft
*******************************************************************************}
procedure MyFillGridCaptionB(const MyCaptions:Array of string;
                             MsFlexGridName:TMsFlexGrid);
var
   i:integer;
   StrTemp:string;
begin
   if  high(MyCaptions)=-1 then
   begin
     exit;
   end;
   Msflexgridname.Cols:=High(Mycaptions);

   StrTemp:='';
   with MsFlexGridName  do
   begin
      Redraw:=False;
      if  (Cols<high(MyCaptions)+1) or (Cols>high(MyCaptions)+1) then
          Cols := high(MyCaptions)+1;
      if  Rows<2 then
        Rows := 3;

      for i :=0 to high(MyCaptions) do
      begin
         FixedAlignment[i]:=flexAlignCenterCenter;// = $00000004;
         TextMatrix[0,i]:=MyCaptions[i]
      end;
      for i :=0 to high(MyCaptions) do
      begin
         Row:=FixedRows;
         if     (Pos('成本',TextMatrix[0,i])>=1) or
                (Pos('金额',TextMatrix[0,i])>=1) or
                (Pos('利润',TextMatrix[0,i])>=1) or
                (Pos('毛利',TextMatrix[0,i])>=1) or
                (Pos('差额',TextMatrix[0,i])>=1) or
                (Pos('实洋',TextMatrix[0,i])>=1) or
                (Pos('码洋',TextMatrix[0,i])>=1) or
                (Pos('单价',TextMatrix[0,i])>=1) or
                (Pos('定价',TextMatrix[0,i])>=1) or
                (Pos('数量',TextMatrix[0,i])>=1) or
                (Pos('价格',TextMatrix[0,i])>=1) then
           begin
              ColAlignment[i]:=iRight;
           end
           else if (Pos('号',TextMatrix[0,i])>=1) or
                   (Pos('单据',TextMatrix[0,i])>=1) or
                   (Pos('码',TextMatrix[0,i])>=1) then
                   begin
                       ColAlignment[i]:=iLeft;
                   end
            else
            ColAlignment[i]:=iCenter;

      end;
      ReDraw:=True;
   end;

end;

{******************************************************************************
*                    设置表格个列的宽度
*              MySize 为对应列的宽度值(以字符为单位)
******************************************************************************}
procedure  MySetGridColSize(const MySize:array of integer;
                            MsFlexGridName:TMsFlexGrid);
var
   i:integer;
   ColCount:integer;
begin
   if  high(MySize)=-1 then
   begin
     Exit;
   end;
   ColCount:=high(MySize)+1;
   with MsFlexGridName  do
   begin
      Redraw:=False;
      if Cols<ColCount then
         Cols := ColCount;
      if  Rows<2 then
         Rows := 2;
      for i :=0 to ColCount-1 do
      begin
         ColWidth[i] := MySize[i]*120;
      end;
      Redraw:=True;
   end;

end;
{******************************************************************************
*               在网格中绑定控件
******************************************************************************}
procedure MySetGridEditCol( const sCanEdit:Array of boolean;
                            const ConArray:Array of TWincontrol;
                            var ColConArray :Array of  TGridColCon);
var
   i:integer;
begin
   for i := 0 to High(sCanEdit) do
   begin
      ColConArray[i].bEdit := sCanEdit[i];
      ColConArray[i].conName := conArray[i];
   end;
end;
procedure  FZSetGridEditCol(const sCanEdit: boolean;
                            const ConArray: TWincontrol;
                            var ColConArray : Array of  TGridColCon;
                            const i:integer);

begin
ColConArray[i].bEdit := sCanEdit;
ColConArray[i].conName := conArray;
end;

{*******************************************************************************
*                      初始化网格
*******************************************************************************}
procedure InitGridA(GridName : TMsFlexGrid);
Begin
    With GridName Do
         Begin   
            Rows:=3;
            HighLight:=0;
            AllowUserResizing:=1;
            backcolor:=clWhite;
            BackColorBKG:=clWhite;            
            BackColorFixed:=clMenu;
             
  //====================================
             FontName:='宋体';
             FontSize:=9;
             FixedCols:=0;
             FixedRows:=1;
             RowHeightMin:=300;
             ForeColorFixed:=clBlack;//==字体颜色
             Align:=alClient;
 //==================================
             Cols:=5;

       end;
end;
{*******************************************************************************
//     当滚动时 隐藏绑定的控件
*******************************************************************************}
procedure MyGridScroll(var ColConArray : Array of TGridColCon;
                       var CurrGrid:TMsFlexGrid);
var
   iLen , iTemp : integer;
begin
   with CurrGrid do
   begin
      SetFocus;
      if (Col<0) or (Col>Cols-2) then Exit;
      if (Row<0) or (Row>Rows-2) then Exit;
      iLen := High(ColConArray);
      for iTemp := 0 to iLen do
      begin
         if ColConArray[iTemp].conName <> nil then
            ColConArray[iTemp].conName.Hide;
      end;
      Invalidate;
   end;
end;
{*******************************************************************************
//                 所有绑定控件是否被隐藏  是为TRUE
*******************************************************************************}
function MyGridClick(var ColConArray : Array of TGridColCon):boolean;
var
   iLen , iTemp : integer;
    bAllHide : Boolean;
begin
   iLen := High(ColConArray);
   bAllHide := True;
   iTemp := 0;
   While bAllHide and (iTemp <= iLen) do
   begin
      if ColConArray[iTemp].conName <> nil then
      begin
         if ColConArray[iTemp].conName.Visible then
            bAllHide := False;
      end;
      iTemp := iTemp + 1;
   end;
   if bAllHide then
      MyGridClick := true
   else
      MyGridClick := False;
end;
procedure MyGridEnterCell(var ColConArray : Array of TGridColCon;
                          CurrGrid:TMsFlexGrid);
begin  
   CurrGrid.Redraw:=False;
   with CurrGrid do
   begin
      SetFocus;
      CellLeft;
      CellWidth;
      ClientWidth;
      if Row = Rows-1 then
         begin
             CurrGrid.Redraw:=true;
             exit;
         end;
      MyShowWinControl(CurrGrid,ColConArray[CurrGrid.Col].conName);
   end;
   CurrGrid.Redraw:=true;
end;
{*******************************************************************************
//        MsFlexGrid中使用的TEdit。。。。。。的事件处理
//        坐标的确定及单位的换算
*******************************************************************************}
procedure MyShowWinControl(MsFlexGridName:TMsFlexGrid;WinControlName:TWinControl);
var
	UnitCount:integer;
begin
	UnitCount:=15;
     with  MsFlexGridName do
     begin
      	if wincontrolName is TCustomEdit then
          begin
               if (wincontrolName as TCustomEdit).Parent<>MsFlexGridName then
          		(wincontrolName as TCustomEdit).Parent:=MsFlexGridName;
     		(wincontrolName as TCustomEdit).Visible:=False;
    			(wincontrolName as TCustomEdit).Height:=RowHeight[Row] div UnitCount;
     		(wincontrolName as TCustomEdit).Width:=ColWidth[Col] div UnitCount;
     		(wincontrolName as TCustomEdit).Left:=ColPos[Col] div UnitCount;
     		(wincontrolName as TCustomEdit).Top:=RowPos[Row] div UnitCount;
          	(wincontrolName as TCustomEdit).Text:=TextMatrix[Row,Col];
     		(wincontrolName as TCustomEdit).Visible:=True;
                (wincontrolName as TCustomEdit).SelectAll;
          	(wincontrolName as TCustomEdit).SetFocus;

          end;
        	if wincontrolName is TCombobox then
          begin
               if (wincontrolName as TCombobox).Parent<>MsFlexGridName then
          		(wincontrolName as TCombobox).Parent:=MsFlexGridName;
     		(wincontrolName as TCombobox).Visible:=False;
    			(wincontrolName as TCombobox).Height:=RowHeight[Row] div UnitCount;
     		(wincontrolName as TCombobox).Width:=ColWidth[Col] div UnitCount;
     		(wincontrolName as TCombobox).Left:=ColPos[Col] div UnitCount;
     		(wincontrolName as TCombobox).Top:=RowPos[Row] div UnitCount;
          	(wincontrolName as TCombobox).Text:=TextMatrix[Row,Col];
     		(wincontrolName as TCombobox).Visible:=True;
          	(wincontrolName as TCombobox).SetFocus;
          end;
          if wincontrolName is TDateTimePicker then
          begin
               if (wincontrolName as TDateTimePicker).Parent<>MsFlexGridName then
          		(wincontrolName as TDateTimePicker).Parent:=MsFlexGridName;
     		(wincontrolName as TDateTimePicker).Visible:=False;
    			(wincontrolName as TDateTimePicker).Height:=RowHeight[Row] div UnitCount;
     		(wincontrolName as TDateTimePicker).Width:=ColWidth[Col] div UnitCount;
     		(wincontrolName as TDateTimePicker).Left:=ColPos[Col] div UnitCount;
     		(wincontrolName as TDateTimePicker).Top:=RowPos[Row] div UnitCount;
               if  TextMatrix[Row,Col] <> '' then
          		(wincontrolName as TDateTimePicker).DateTime:=StrToDate(TextMatrix[Row,Col])
                        //(wincontrolName as TDateTimePicker).DateTime:=StrToDateTime(TextMatrix[Row,Col])
               else
               	(wincontrolName as TDateTimePicker).DateTime:=Now;
     		(wincontrolName as TDateTimePicker).Visible:=True;
          	(wincontrolName as TDateTimePicker).SetFocus;

          end;
     end;
end;
{*******************************************************************************
//
*******************************************************************************}
procedure MYConEnter(var CurrCon:TEdit;var CurrGrid:TMsFlexGrid);overload;
begin
   if Currcon.Visible = false then       exit;
   CurrCon.text:=Trim(CurrGrid.Text);
   CurrCon.SelectAll;
end;


procedure MyConEnter(var CurrCon:TComboBox;var CurrGrid:TMsFlexGrid);overload;
begin
  if Currcon.Visible = false then    exit;
  CurrCon.text:=Trim(CurrGrid.Text);
  CurrCon.SelectAll;
end;

procedure MyConEnter(var CurrCon:TDateTimePicker;var CurrGrid:TMsFlexGrid);overload;
begin
   if Currcon.Visible = false then   Exit;
   if Trim(CurrGrid.Text)<>'' then
   begin
      try
         CurrCon.DateTime:=StrToDateTime(Trim(CurrGrid.Text));
      except
         CurrCon.DateTime:=Now;
      end;
   end;
end;
//==============================================================================
//
//==============================================================================
procedure MyConExit(var CurrCon:TEdit;var CurrGrid:TMsFlexGrid);overload;
begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -