scroll.cpp

来自「Delphi Component - Chart Fx」· C++ 代码 · 共 59 行

CPP
59
字号
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "scroll.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "ChartfxLib_TLB"
#pragma link "OleCtrls"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
	ICfxAxisDisp pAxis;

    // Turn OFF scroll bars for the chart on top but KEEP scrolling functionallity
    ChartFX1->Style &= ~CS_SCROLLBARS;

    // Faster but restricted scrolling
    ChartFX1->SendMsg(0,0,CT_EVENSPACING);
    ChartFX2->SendMsg(0,0,CT_EVENSPACING);

    // Align
    ChartFX1->LeftGap = ChartFX2->LeftGap;
    ChartFX1->Axis->get_Item(AXIS_X,&pAxis);
    pAxis.Style |= AS_HIDETEXT;
    ChartFX1->BottomGap = 15;
    ChartFX2->TopGap = 15;
    ChartFX1->Grid = CHART_BOTHGRID;
    ChartFX2->Grid = CHART_BOTHGRID;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormResize(TObject *Sender)
{
    // Resize charts with form
    ChartFX1->Width = Form1->Width - 12;
    ChartFX2->Width = Form1->Width - 12;
    ChartFX1->Height = (Form1->Height / 2) - 15;
    ChartFX2->Top = ChartFX1->Height;
    ChartFX2->Height = ChartFX1->Height;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ChartFX2UserScroll(TObject *Sender,
      long wScrollMsg, long wScrollParam, short *nRes)
{
     // Scroll upper chart
    ChartFX1->Scroll(wScrollMsg, wScrollParam);
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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