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

📄 kxianmain.~pas

📁 该系统将温度数据以类似股票K线显示方式进行分析
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
              DrawNowLine(EditCode);
        END;
      End;
   End;
end;

procedure TFormKXianMain.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
If (Key=VK_PRIOR) Then//Page Up key
Begin
        if batcount <1 then exit;
        batid:=batid-1;
        If (batid< 0) Then
                batid:=batcount-1;
        CurrentCode:=batchs[batid];
        editcode.Text :='';
        ReadData(EditCode);
        IF DAYCOUNT <=0 THEN
                DRAWEMPTY(EditCode)
        ELSE;
        BEGIN
                DrawLineInit(EditCode);
                DrawLine(EditCode);
                DrawNowLine(EditCode);
        END;
   End;
If (Key=VK_NEXT) Then//Page Down key
   Begin
        if batcount <1 then exit;
        batid:=batid+1;
        If (batid >(batcount-1)) Then
                batid:=0;
        CurrentCode:=batchs[batid];
        editcode.Text :='';
        ReadData(EditCode);
        IF DAYCOUNT <=0 THEN
                DRAWEMPTY(EditCode)
        ELSE;
        BEGIN
                DrawLineInit(EditCode);
                DrawLine(EditCode);
                DrawNowLine(EditCode);
        END;
   End;

If (Key=VK_DOWN) And (DefaultWidth>3) Then//Virtual key codes
   Begin
        DefaultWidth:=DefaultWidth-2;

        DrawLineInit(EditCode);
        DrawLine(EditCode);
        DrawNowLine(EditCode);

        DrawLineInitSec(EditCode);
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
   End;

If (Key=VK_UP) And (DefaultWidth<50) Then
   Begin
        DefaultWidth:=DefaultWidth+2;

        DrawLineInit(EditCode);
        DrawLine(EditCode);
        DrawNowLine(EditCode);

        DrawLineInitSec(EditCode);
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
   End;
If (Key=VK_F5) And (MSI<3) Then
   Begin
        MSI :=MSI +1;
        MINSTEP := MS[MSI];

        ReadData(EditCode);
        EnlageLineInit(EditCode, 1);
        DrawLine(EditCode);
        DrawNowLine(EditCode);

        ReadDataSec(EditCode);
        EnlageLineInitSec(EditCode, 1);
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
   End;
If (Key=VK_F6) And (MSI>0) Then
   Begin
   MSI :=MSI -1;
   MINSTEP := MS[MSI];

   ReadData(EditCode);
   DrawLineInit(EditCode);
   DrawLine(EditCode);
   DrawNowLine(EditCode);

   ReadDataSec(EditCode);
   DrawLineInitSec(EditCode);
   DrawLineSec(EditCode);
   DrawNowLineSec(EditCode);
   End;

If (Key=VK_HOME) Then
BEGIN
   MoveLineHome(EditCode);
   MoveLineHomeSec(EditCode);
END;
If (Key=VK_END) Then
BEGIN
   MoveLineEnd(EditCode);
   MoveLineEndSec(EditCode);
END;
If (Key=VK_LEFT) Then
   MoveLineLeft(EditCode);
If (Key=VK_RIGHT) Then
   MoveLineRight(EditCode);
if (key = VK_F10) then
   DoPrintWork();
if (key = VK_F11) then
   DoPrintAll();
end;

procedure TFormKXianMain.ImageWorkMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Var DayNumber,DAYNO :Integer;
begin

MOUSEX :=X;
MOUSEY :=Y;

If CurrentCode<>'' Then
Begin
     If (X>CurrentX) Then
        Begin
        DayNumber:=Trunc((X-CurrentX)/DefaultWidth+0.5);
        If DayNumber>(RightDate-CurrentDate) Then
           DayNumber:=RightDate-CurrentDate;
        CurrentDate:=CurrentDate+DayNumber;
        CurrentX:=CurrentX+DayNumber*DefaultWidth;
        DrawLine(EditCode);
        DrawNowLine(EditCode);
        End
     Else If (X<CurrentX) Then
        Begin
        DayNumber:=Trunc((CurrentX-X)/DefaultWidth+0.5);
        If DayNumber>(CurrentDate-LeftDate) Then
           DayNumber:=CurrentDate-LeftDate;
        CurrentDate:=CurrentDate-DayNumber;
        CurrentX:=CurrentX-DayNumber*DefaultWidth;
        DrawLine(EditCode);
        DrawNowLine(EditCode);
        End;

     If (X>SecCurrentX) Then
        Begin
        DAYNO := Trunc((X-SecCurrentX)/DefaultWidth+0.5);
        If DAYNO>(SecRightDate-SecDate) Then
           DAYNO:=SecRightDate-SecDate;
        SecDate:=SecDate+DAYNO;
        SecCurrentX:=SecCurrentX+DAYNO*DefaultWidth;
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
        End
     Else If (X<SecCurrentX) Then
        Begin
        DayNo := Trunc((SecCurrentX-X)/DefaultWidth+0.5);
        If DayNo>(SecDate-SecLeftDate) Then
           DayNo:=SecDate-SecLeftDate;
        SecDate:=SecDate-DayNo;
        SecCurrentX:=SecCurrentX-DayNo*DefaultWidth;
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
        End;
     End;
end;
procedure TFormKXianMain.ImageSecMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Var DayNumber,DAYNO :Integer;
begin

SecMOUSEX :=X;
SecMOUSEY :=Y;

If CurrentCode<>'' Then
Begin
     If (X>CurrentX) Then
        Begin
        DayNumber:=Trunc((X-CurrentX)/DefaultWidth+0.5);
        If DayNumber>(RightDate-CurrentDate) Then
           DayNumber:=RightDate-CurrentDate;
        CurrentDate:=CurrentDate+DayNumber;
        CurrentX:=CurrentX+DayNumber*DefaultWidth;
        DrawLine(EditCode);
        DrawNowLine(EditCode);
        End
     Else If (X<CurrentX) Then
        Begin
        DayNumber:=Trunc((CurrentX-X)/DefaultWidth+0.5);
        If DayNumber>(CurrentDate-LeftDate) Then
           DayNumber:=CurrentDate-LeftDate;
        CurrentDate:=CurrentDate-DayNumber;
        CurrentX:=CurrentX-DayNumber*DefaultWidth;
        DrawLine(EditCode);
        DrawNowLine(EditCode);
        End;

     If (X>SecCurrentX) Then
        Begin
        DAYNO := Trunc((X-SecCurrentX)/DefaultWidth+0.5);
        If DAYNO>(SecRightDate-SecDate) Then
           DAYNO:=SecRightDate-SecDate;
        SecDate:=SecDate+DAYNO;
        SecCurrentX:=SecCurrentX+DAYNO*DefaultWidth;
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
        End
     Else If (X<SecCurrentX) Then
        Begin
        DayNo := Trunc((SecCurrentX-X)/DefaultWidth+0.5);
        If DayNo>(SecDate-SecLeftDate) Then
           DayNo:=SecDate-SecLeftDate;
        SecDate:=SecDate-DayNo;
        SecCurrentX:=SecCurrentX-DayNo*DefaultWidth;
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
        End;
     End;
end;

procedure TFormKXianMain.FormCreate(Sender: TObject);
begin
    ADOQwdjl.Connection := adocwdkz;
    ADODtest.Connection := adocwdkz;
    ADOqbatch.Connection := adocwdkz;
    AdodBatch.Connection := adocwdkz;
end;

procedure TFormKXianMain.SecBatchKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
   If (key=VK_RETURN) And (SecBATCH.Text<>SecCurrentCode) Then
   Begin
      SecCurrentCode:='';
      If batFind(SecBatch.Text)<>-1 Then
         SecCurrentCode:=batchs[batID]
      Else
      begin
         MessageDlg('批号不存在!', mtInformation,[mbOk], 0);
         drawempty(editcode);
      end;
      SecBatch.Text:='';
      If SecCurrentCode<>'' Then
      Begin
        ReadDataSec(EditCode);
        IF SecDAYCOUNT <=0 THEN DRAWEMPTY(EditCode)
        ELSE;
        BEGIN
              DrawLineInitSec(EditCode);
              DrawLineSec(EditCode);
              DrawNowLineSec(EditCode);
        END;
      End;
      EDITCODE.SetFocus;
   End;
end;

procedure TFormKXianMain.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  MainForm.Visible :=TRUE;
end;

procedure TFormKXianMain.editcodeChange(Sender: TObject);
var tmpStr, sbatch :string;
var i :cardinal;
begin
    Tmpstr := EditCode.Text;
    if strlen(pchar(TmpStr))>0 then
    begin
        i:=0;
        while not (TmpStr[i]= ' ') and (i < strlen(pchar(TmpStr)))  do  i:=i+1  ;
        setlength(sBatch, i);
        strmove(pchar(sBatch), pchar(TmpStr), i);
    end
    else
        sBatch := TmpStr;

    If (sBatch<>CurrentCode) Then
    Begin
      CurrentCode:='';
      Editcode.Text :='';
      If batFind(sBatch)<>-1 Then
         CurrentCode:=batchs[batID]
      Else
      begin
         MessageDlg('批号不存在!', mtInformation,[mbOk], 0);
         drawempty(editcode);
      end;
      EditCode.Text:='';
      If CurrentCode<>'' Then
      Begin
        ReadData(EditCode);
        IF DAYCOUNT <=0 THEN DRAWEMPTY(EditCode)
        ELSE;
        BEGIN
              DrawLineInit(EditCode);
              DrawLine(EditCode);
              DrawNowLine(EditCode);
        END;
      End;
    end;
end;

procedure TFormKXianMain.EDITCODEDblClick(Sender: TObject);
var ls_str :string;
begin
if tfBatchQuery.Execute( 2, ls_str,'待分析选择...' ) then
  begin
   showmessage('重新载入新的批号列表, 批号总数:' +inttostr(length(batchs)));
   if batCount >0 then
   begin
     currentcode := Batchs[0];
     ReadData(EditCode);
     DrawLineInit(EditCode);
     DrawLine(EditCode);
     DrawNowLine(EditCode);
   end
   else
     DrawEmpty(editcode)
  end
end;

procedure TFormKXianMain.SecBatchDblClick(Sender: TObject);
var ls_str :string ;
begin
if tfBatchQuery.Execute(1,ls_str,'请选择参照批号' ) then
  begin
     SecCurrentcode :=ls_str;
     ReadDataSec(EditCode);
     if SecDayCount >0 then
     begin
        DrawLineInitSec(EditCode);
        DrawLineSec(EditCode);
        DrawNowLineSec(EditCode);
     end
     else
        DrawEmptySec(editcode)
  end;
end;

procedure TFormKXianMain.ImageWorkDblClick(Sender: TObject);
begin
  if MouseY > Topy then
  begin
   tRefTimeWork := lineData[currentdate].dtDateTime;
   DrawLine(editcode);
   DrawNowLine(editcode);
  end;
end;


procedure TFormKXianMain.ImageSecDblClick(Sender: TObject);
begin
  if SecMouseY > Topy then
  begin
   tRefTimeSec := SeclineData[Secdate].dtDateTime;
  

⌨️ 快捷键说明

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