tperformancegraph_在哪儿能够找到TPerformanceGraph控件(100分)

本文档详细介绍了C++Builder中的TPerformanceGraph控件,包括其属性、方法和使用示例。控件提供了绘制条形图和折线图的功能,并允许设置颜色、网格大小、步长等参数。通过DataPoint方法更新数据,Update方法刷新显示。
摘要由CSDN通过智能技术生成

那是C++BULIDER 下带的例子

//---------------------------------------------------------------------------

// Borland C++Builder

// Copyright (c) 1987, 1999 Borland International Inc. All Rights Reserved.

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------

#ifndef PerfGraphH

#define PerfGraphH

//---------------------------------------------------------------------------

#include

#include

#include

#include

enum TGraphKind { pgBar, pgLine };

class PACKAGE TPerformanceGraph : public TGraphicControl

{

private:

TGraphKind FKind;

TColor FForeColor;

TColor FBackColor;

Longint FGridSize;

Longint FStepSize;

Longint FScale;

Longint FGradient;

Boolean FGridlines;

Longint FPenWidth;

TNotifyEvent FOnScaleChange;

void __fastcall SetGraphKind(TGraphKind Value);

void __fastcall SetForeColor(TColor Value);

void __fastcall SetBackColor(TColor Value);

void __fastcall SetGridSize(Longint Value);

void __fastcall SetStepSize(Longint Value);

void __fastcall SetScale(Longint Value);

void __fastcall SetGradient(Longint Value);

void __fastcall SetGridlines(Boolean Value);

void __fastcall SetPenWidth(Longint Value);

private:

TRect LayoutRect;

TRect SourceRect;

TRect DestRect;

TRect OpenBand;

Longint Hidden;

Graphics::TBitmap *SaveArea;

Boolean Occupied;

void __fastcall Initialize(Longint Index);

void __fastcall PaintBar(TColor color, Longint base, Longint amount);

void __fastcall PaintLine(TColor color, Longint lastAmount,

Longint amount);

#define MAXLINES 16

struct TDataPoints

{

Longintused;

TColorcolor[MAXLINES];

Longintvalue[MAXLINES];

};

TDataPoints*History;

LongintAllocated;

intbegin

Y, CurrentY;

#define LIST_END -1

int __fastcall CountY() {

return Allocated - 1;

}

int __fastcall FirstY() {

return begin

Y;

}

int __fastcall NextY(int Y) {

Y++;

if(Y == Allocated)

Y = 0;

if(Y == begin

Y)

return -1;

return Y;

}

int __fastcall LastY(int Y) {

if(Y == 0)

return Allocated - 1;

return Y - 1;

}

int __fastcall ShiftY() {

Longint nextY = CurrentY;

nextY++;

if(nextY == Allocated)

nextY = 0;

History[nextY].used = 0;

begin

Y = nextY + 1;

if(begin

Y == Allocated)

begin

Y = 0;

CurrentY = nextY;

return CurrentY;

}

protected:

virtual void __fastcall Paint(void);

void __fastcall ScrollGraph();

void __fastcall DisplayPoints(Longint Index);

void __fastcall ReallocHistory();

void __fastcall Replay(void);

Longint __fastcall GetBandCount() {

return Width / StepSize;

}

__property Longint Bands = {read=GetBandCount};

Longint __fastcall RoundUp(Longint Value, Longint Increment) {

if(Increment &&

Value % Increment)

return ((Value / Increment) + 1) * Increment;

return Value;

}

public:

__fastcall TPerformanceGraph(TComponent* Owner);

virtual __fastcall ~TPerformanceGraph();

void __fastcall DataPoint(TColor color, Longint value);

void __fastcall Update();

__published:

__property Align ;

__property Anchors ;

__property Constraints ;

__property Enabled ;

__property TGraphKind Kind = {read=FKind, write=SetGraphKind, default=1};

__property TColor ForeColor = {read=FForeColor, write=SetForeColor, default=c

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值