Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Customized Visual Studio .NET package: your fully integrated document window inside the IDE

, 20 Dec 2003
Create a fully integrated document window inside the Visual Studio IDE.
#pragma once


#include "graphicobject.h"
#include "dataobject.h"


class CHistogram :
	public CGraphicObject, public CDataObject
{
public:
	CHistogram(void);
	~CHistogram(void);
	void Init( int iX, int iY, int iCX, int iCY );
	void Draw(HDC hDC);
	BOOL UserAction(UINT uMsg, LPVOID pParams);

	void AddData(BYTE *ucValues, int iLength);

protected:
	virtual void	DrawBars(HDC hDC);
	virtual void	DrawBk(HDC hDC);
			void	UpdateDX();
			void	UpdateYRatio();	
	static const int m_ciMaxDataSize = 16;
	DWORD m_adwData[m_ciMaxDataSize];
	HBRUSH m_hbrBar;
	HBRUSH m_hbrBk;
	HBRUSH m_hbrSel;
	int		m_iSelIndx;
	int		m_iDX;
	double	m_lfYRatio;

	class CHistogramState
	{
	public:
		CHistogramState();
		void SaveState( CHistogram* pHist );
		void Swap( CHistogram* pHist );
	protected:
		DWORD m_adwData[CHistogram::m_ciMaxDataSize];	
		int m_iSelIndx;
		DWORD m_dwCmdState;
	};
	class CClipBoard
	{
	public:
		CClipBoard(): m_dwData(0) {};
		void Copy( CHistogram* pHist ) { m_dwData = pHist->m_adwData[pHist->m_iSelIndx]; }
		void Paste(CHistogram* pHist ) { pHist->m_adwData[pHist->m_iSelIndx] = m_dwData; }
	protected:
		DWORD m_dwData;
	};
	CHistogramState*	m_pLastState;
	CClipBoard*			m_pCB;
};

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

About the Author

Michael Sheinin
Web Developer
United States United States
For the last 7 years I have developed software in real-time/embedded and MS-Windows environments for military and civil markets. I hold B.Sc. degree in computer engineering. Living in Ontario, Canada, I like hiking and traveling in general. Currently, I'm looking for employment opportunity inside the GTA.

| Advertise | Privacy | Mobile
Web04 | 2.8.140718.1 | Last Updated 21 Dec 2003
Article Copyright 2003 by Michael Sheinin
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid