빌더입문 님이 쓰신 글 :
: chtMain : TChart;
: FValAnno : TAnnotationTool;
: ...
: TfrmMain.chtMainMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer)
: var
: HasData : Boolean;
: AnnoLst : TStrings;
: begin
: ...
: if HasData then
: Self.FValAnno.Text := AnnoLst.Text
: else
: Self.FValAnno.Text := 'No data';
: //
: if (X < Self.chtMain.Width - Self.FValAnno.Width - 5) then
: Self.FValAnno.Shape.Left := X + 10
: else
: Self.FValAnno.Shape.Left := X - Self.FValAnno.Width - 15;
: //
: if (Y < Self.chtMain.Height - Self.FValAnno.Height - 5) then
: Self.FValAnno.Shape.Top := Y + 10
: else
: Self.FValAnno.Shape.Top := Y - Self.FValAnno.Height - 15;
: //
: if (FX >= Self.chtMain.BottomAxis.IStartPos) and
: (FX <= Self.chtMain.BottomAxis.IEndPos) and
: (FY >= Self.chtMain.LeftAxis.IStartPos) and
: (FY <= Self.chtMain.LeftAxis.IEndPos) then
: Self.FValAnno.Active := True
: else
: Self.FValAnno.Active := False;
: ...
: end;
대강 아래와 같은 의미라고 보여집니다.
TChart chtMain;
TAnnotationTool FValAnno;
TfrmMain::chtMainMouseMove(TObject Sender, TShiftState Shift, int X, int Y)
{
bool HasData;
TStrings AnnoLst;
...
if (HasData )
FValAnno.Text = AnnoLst.Text
else
FValAnno.Text = "No data";
//
if (X < chtMain.Width - FValAnno.Width - 5)
FValAnno.Shape.Left = X + 10
else
FValAnno.Shape.Left = X - FValAnno.Width - 15;
//
if (Y < chtMain.Height - FValAnno.Height - 5)
FValAnno.Shape.Top = Y + 10
else
FValAnno.Shape.Top = Y - FValAnno.Height - 15;
//
if ( (FX >= chtMain.BottomAxis.IStartPos) &&
(FX <= chtMain.BottomAxis.IEndPos) &&
(FY >= chtMain.LeftAxis.IStartPos) &&
(FY <= chtMain.LeftAxis.IEndPos) )
FValAnno.Active = true;
else
FValAnno.Active = false;
...
}
|