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

📄 u_web_vno.pas

📁 以前写的一个利用P2P 技术的一个通讯的例子。里面用到了 DBISAM 、INDY 控件。
💻 PAS
📖 第 1 页 / 共 3 页
字号:
         with sg_jl do
            begin
               if state then
                  begin
                     s := cells[acol + colcount, arow];
                     s := iif(s = '0', '', s);
                     cells[acol + 1, arow] := s;
                     cells[acol + 2, arow] := iif(cells[acol + colcount + 2, arow] = '1', cells[acol + colcount + 3, arow], '');
                     if round(strtodate(m_adate) - strtodate(m_ddate) + 1) <= 0 then
                        cells[acol + 3, arow] := datetostr(strtodate(m_adate) + strtoint(getstr(cells[acol + colcount + 4, arow])))
                     else
                        cells[acol + 3, arow] := m_adate;
                     if round(strtodate(cells[acol + 3, arow]) - strtodate(gstr_pubdate)) < 0 then
                        cells[acol + 3, arow] := Gstr_pubdate;

                     cells[acol + 4, arow] := m_ddate;
                     //cells[acol + 3, arow] := analy_str('adate', m_str);
                     //cells[acol + 4, arow] := analy_str('ddate', m_str);
                  end
               else
                  begin
                     cells[acol + 1, arow] := '';
                     cells[acol + 2, arow] := '';
                     cells[acol + 3, arow] := '';
                     cells[acol + 4, arow] := '';
                  end
            end;
      15:
         with sg_jl do
            begin
               s := cells[acol + colcount, arow];
               s := iif(s = '0', '', s);
               cells[acol + 1, arow] := iif(state, s, '');
               s := cells[acol + colcount * 2 + 1, arow];
               s := iif(s = '0', '', s);
               cells[acol + 2, arow] := iif(state, s, '');
            end;
      16:
         with sg_jl do
            begin
               s := cells[acol + colcount, arow];
               s := iif(s = '0', '', s);
               cells[acol + 1, arow] := iif(state, s, '');
               {s := cells[acol + colcount * 2 + 1, arow];
               s := iif(s = '0', '', s);
               cells[acol + 2, arow] := iif(state, s, '');}
            end;
      21, 22:
         with sg_jl do
            setcheckboxstate(0, arow, not state);
      23:
         with sg_jl do
            begin
               if state then
                  begin
                     cells[acol + 1, arow] := iif(cells[acol + colcount + 1, arow] = '1', cells[acol + colcount, arow], '');
                  end
               else
                  begin
                     cells[acol + 1, arow] := '';
                  end
            end;
      28:
         begin
            s := analy_str('master', m_str);
            with sg_jl do
               if cells[acol, arow] = s then
                  begin
                     MessageDlg(iif(m_lang = 1, '主付房必须入住!', 'MASTER ROOM MUST CHKIN!'), mtinformation, [mbok], 0);
                     setcheckboxstate(0, arow, true);
                  end;
         end;
   end;
end;

procedure TF_WEB_VNO.DealTag(Sender: Tobject; UpDown: integer; Tag: integer;
   Key: Word);
var
   i, j: integer;
begin
   case Tag of
      1:
         with sg_jl do
            begin
               if (Key = VK_RETURN) then
                  case m_diff of
                     15, 16, 20:
                        begin
                           i := (col + 1) mod 8;
                           if i = 0 then
                              begin
                                 col := 0;
                                 j := (row + 1) mod rowcount;
                                 if j = 0 then
                                    bn_ok.SetFocus
                                 else
                                    row := j;
                              end
                           else
                              col := i;
                        end;
                     21:
                        begin
                           i := (col + 1) mod 5;
                           if i = 0 then
                              begin
                                 col := 0;
                                 j := (row + 1) mod rowcount;
                                 if j = 0 then
                                    bn_ok.SetFocus
                                 else
                                    row := j;
                              end
                           else
                              col := i;
                        end;
                     22:
                        begin
                           i := (col + 1) mod 4;
                           if i = 0 then
                              begin
                                 col := 0;
                                 j := (row + 1) mod rowcount;
                                 if j = 0 then
                                    bn_ok.SetFocus
                                 else
                                    row := j;
                              end
                           else
                              col := i;
                        end;
                     25, 30:
                        begin
                           i := (col + 1) mod 3;
                           if i = 0 then
                              begin
                                 col := 0;
                                 j := (row + 1) mod rowcount;
                                 if j = 0 then
                                    bn_ok.SetFocus
                                 else
                                    row := j;
                              end
                           else
                              col := i;
                        end;
                     else
                        begin
                           i := (col + 1) mod 10; //rowcount-2 = 12
                           if i = 0 then
                              begin
                                 col := 0;
                                 j := (row + 1) mod rowcount;
                                 if j = 0 then
                                    bn_ok.SetFocus
                                 else
                                    row := j;
                              end
                           else
                              col := i;
                        end;
                  end;
            end;
   end;
end;

procedure TF_WEB_VNO.SG_JLGetCellColor(Sender: TObject; ARow,
   ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);
begin
   if arow < 1 then
      exit;
   case m_diff of
      1:
         begin
            afont.Color := clGreen;
            afont.style := [fsbold];
         end;
      15:
         case acol of
            0, 3, 6, 9:
               afont.Color := clblack;
            else
               begin
                  afont.Color := clMaroon;
                  afont.style := [fsbold];
               end;
         end;
      16:
         case acol of
            0, 2, 4, 6:
               afont.Color := clblack;
            else
               begin
                  afont.Color := clMaroon;
                  afont.style := [fsbold];
               end;
         end;
      2, 5, 10, 12, 17..18:
         case acol of
            1, 2, 6, 7:
               begin
                  afont.Color := clMaroon;
                  afont.style := [fsbold];
               end;
            3, 4, 8, 9: afont.Color := clblue;
            else
               afont.Color := clblack;
         end;
      20:
         case acol of
            1, 5:
               begin
                  afont.Color := clMaroon;
                  afont.style := [fsbold];
               end;
            2, 3, 6, 7: afont.Color := clblue;
            else
               afont.Color := clblack;
         end;
      21, 22:
         case acol of
            1, 2:
               begin
                  afont.Color := clblue;
                  afont.style := [fsbold];
               end;
            0, 3:
               begin
                  afont.Color := clMaroon;
                  afont.style := [fsbold];
               end;
            else
               afont.Color := clblack;
         end;
      23:
         case acol of
            1, 3, 5, 7, 9:
               begin
                  afont.Color := clMaroon;
                  afont.style := [fsbold];
               end;
            else
               afont.Color := clblack;
         end;
   end;
end;

procedure TF_WEB_VNO.SG_JLDblClick(Sender: TObject);
var
   m_bstate: boolean;
   i, j: integer;
begin
   case m_diff of
      21, 22:
         with sg_jl do
            begin
               getcheckboxstate(0, row, m_bstate);
               setcheckboxstate(0, row, not m_bstate);
            end;
      29:
         with sg_jl do
            if pos('**', Cells[0, row]) > 0 then
               begin
                  SelectRows(row, 1); //  .SelectedCellsCount := 0;
                  for i := row + 1 to rowcount - 1 do
                     begin
                        if pos('**', Cells[0, i]) > 0 then
                           break;
                        for j := 0 to colcount - 1 do
                           begin
                              getcheckboxstate(j, i, m_bstate);
                              setcheckboxstate(j, i, not m_bstate);
                           end;
                     end;
               end;
   end;
end;

procedure TF_WEB_VNO.BN_1Click(Sender: TObject);
var
   s, s1: string;
   i, j: integer;
   b_state: boolean;
begin
   s := (sender as TFlatButton).Caption;
   s := copy(s, 2, 1);
   with sg_jl do
      for i := 1 to rowcount do
         for j := 0 to colcount - 1 do
            begin
               if cells[j, i] = '' then
                  continue;
               s1 := copy(cells[j, i], 1, 1);
               if s = '0' then
                  setcheckboxstate(j, i, false)
               else
                  if s1 = s then
                  begin
                     getcheckboxstate(j, i, b_state);
                     setcheckboxstate(j, i, not b_state);
                  end;
            end;
end;

procedure TF_WEB_VNO.SG_JLGetAlignment(Sender: TObject; ARow,
   ACol: Integer; var HAlign: TAlignment; var VAlign: TVAlignment);
begin
   case arow of
      0: HAlign := tacenter;
   end;
end;

end.

⌨️ 快捷键说明

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