Click here to Skip to main content
15,894,405 members
Articles / Desktop Programming / MFC

Custom Control Graph and Process Bar

Rate me:
Please Sign up or sign in to vote.
4.35/5 (14 votes)
13 Dec 20064 min read 93K   6.8K   45  
An article on a Win32 custom graph control and process bar creation.
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>


#define VER_LINE_GAP			2
#define NO_OF_GRAPH				4
#define	GRAPH_GAP				6
#define NO_OF_BAR_PARTS			4
#define CENTER_VAL				2.5
#define LINE_GAP_LEN			3
#define BUF_LEN					20
#define VER_MAX_MOV				20
#define GRAPH_HEADER_LOC		20
#define NO_OF_POINTS			30
#define DARK_GREEN				125
#define LIGHT_GREEN				255
#define WM_USER_GRAPH           0x0401
#define WM_USER_PROCESS_BAR		0x0402
#define CUST_GRAPH_CLASS_NAME	"Custom_Control"

struct Health_Graph
{
	long	RxBytes;
	long	TxBytes;
};

struct lp
{
	unsigned long RxValue;
	unsigned long TxValue;
	unsigned int  GraphNo;
};

struct Health_Graph GraphInfo[NO_OF_GRAPH][NO_OF_POINTS];
struct lp *User_Data;

LONG64 TotalRxBytes, TotalTxBytes;
unsigned int MaxRx, MaxTx;

void DrawGraph(HDC hdc, RECT Rect);
void UpdateGraph(HDC hdc, RECT Rect, unsigned long RxValue, unsigned long TxValue, int GraphNo);
void DrawBar(HDC hdc, RECT Rect, int Process_Value);

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect Luxoft
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions