Click here to Skip to main content
15,880,796 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problems in Static LED control - CDigiStatic Pin
Hamid_RT11-Jul-06 22:03
Hamid_RT11-Jul-06 22:03 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N11-Jul-06 22:35
Semion_N11-Jul-06 22:35 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Hamid_RT11-Jul-06 22:50
Hamid_RT11-Jul-06 22:50 
AnswerRe: Problems in Static LED control - CDigiStatic Pin
Abhi Lahare11-Jul-06 22:21
Abhi Lahare11-Jul-06 22:21 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N11-Jul-06 22:32
Semion_N11-Jul-06 22:32 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Naveen11-Jul-06 22:51
Naveen11-Jul-06 22:51 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Hamid_RT11-Jul-06 22:54
Hamid_RT11-Jul-06 22:54 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N11-Jul-06 23:13
Semion_N11-Jul-06 23:13 
Take:
its a little bit big but ok:

<br />
#if !defined(AFX_DIGISTATIC_H__F77484C2_745F_11D3_A718_87712333104C__INCLUDED_)<br />
#define AFX_DIGISTATIC_H__F77484C2_745F_11D3_A718_87712333104C__INCLUDED_<br />
<br />
#if _MSC_VER >= 1000<br />
#pragma once<br />
#endif // _MSC_VER >= 1000<br />
// Digistatic.h : header file<br />
//<br />
// Copyright (C) 2000 by Michel Wassink<br />
// All rights reserved<br />
//<br />
// This is free software.<br />
// This code may be used in compiled form in any way you desire. This  <br />
// file may be redistributed unmodified by any means PROVIDING it is   <br />
// not sold for profit without the authors written consent, and   <br />
// providing that this notice and the authors name and all copyright   <br />
// notices remains intact. If the source code in this file is used in   <br />
// any  commercial application then a statement along the lines of   <br />
// "Portions Copyright © 2000 Michel Wassink" must be included in   <br />
// the startup banner, "About" box or printed documentation. An email   <br />
// letting me know that you are using it would be nice as well. That's   <br />
// not much to ask considering the amount of work that went into this.  <br />
//<br />
// No warrantee of any kind, expressed or implied, is included with this<br />
// software; use at your own risk, responsibility for damages (if any) to<br />
// anyone resulting from the use of this software rests entirely with the<br />
// user.<br />
//<br />
// Version: 1.0<br />
// Release: 1 (februari 2000 to www.codeguru.com and www.codeproject.com)<br />
// Release: 2 (not released yet)<br />
// -----------------------------------------------------------------------<br />
// Notes to changes for release 1 (V1.0):<br />
//  -	First release.<br />
// Notes to changes for version 1.1:<br />
//  -	Use Windowtext as defaut text.<br />
//  -   changed SetBackColor to SetBkColor<br />
//  -   changed from stl to Afx templates<br />
// Notes to changes for version 1.2<br />
//  -   added option to draw immediately<br />
//  -   Changed CDigiString to CDigiStatic<br />
//  -   released at codeproject and codeguru<br />
// Notes to changes for version 1.3<br />
//  -   Added option to draw transparent, thank to Daniel DeGeest for his help<br />
//  -   5 New characters added:   ()/\'<br />
//  -   bleeding edge can be turned off<br />
//  -   released at codeproject and codeguru(release 3)<br />
// Notes to changes for future release 4: (V2.0)<br />
//  -   nicer symmetrical rounding vertically.<br />
//  -   second release with enhanced speed<br />
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and<br />
// I'll try to keep a version up to date.  I can be reached as follows:<br />
//    micways@hotmail.com				  (private site)<br />
// An email letting me know that you are using it would be nice.<br />
/////////////////////////////////////////////////////////////////////////////<br />
#include <afxtempl.h><br />
<br />
#include "RGBCOLOR.H"<br />
<br />
// CRect class with double precision for accurate drawing.<br />
class CDoubleRect<br />
{<br />
public:<br />
	void SetRect(double x1, double y1, double x2, double y2)<br />
	{ left = x1; top = y1; right = x2; bottom = y2;}<br />
	double Width() const{return right - left;}<br />
	double Height() const{return bottom - top;}<br />
	void SetRectEmpty(){left = top = right = bottom = 0.0;}<br />
public:<br />
	double left, top, right, bottom; <br />
};<br />
<br />
class CDSegment<br />
{<br />
public:<br />
	CDSegment();<br />
	CDSegment(const CDSegment& Segment);<br />
	~CDSegment();<br />
	void DefPoints(const POINT* lpPoints, const BYTE* lpTypes, int nCount);<br />
	void Draw(CDC *pDC,const CDoubleRect &DrawPlace, int iWidth) const;<br />
	void FreeSegment();<br />
	CDSegment operator=(const CDSegment &Segment);<br />
<br />
// Implementation<br />
public:<br />
	CPoint	  *	m_paPoints;			// array with point<br />
	BYTE	  *	m_paTypes;			// array with connecting info for point<br />
	int			m_nCount;			// number of points<br />
};<br />
<br />
typedef CArray< CDSegment, CDSegment> DSegmentArray;<br />
<br />
class CDigiChar<br />
{<br />
// Construction<br />
public:<br />
	CDigiChar();<br />
	CDigiChar(const CDigiChar& DigiChar);<br />
<br />
//Attributes:<br />
public:<br />
	virtual void SetElementData(WORD wSegmData, int iDispStyle);<br />
	void	Draw(CDC *pDC, const CDoubleRect &DrawPlace, CPen *pOffPen, CPen *pOnPen,<br />
				CBrush *pOffBrush, CBrush *pOnBrush, CRgn* region = NULL);<br />
	void SetColor(COLORREF OffColor, COLORREF OnColor);<br />
	int GetNormWidth() const;<br />
	CDigiChar operator=(const CDigiChar &DigiChar);<br />
	COLORREF GetColor(void) const { return m_OnColor; }<br />
<br />
protected:<br />
	int				m_Width;		// Width of character<br />
	WORD			m_wSegmData;	// segments to highlight (binairy encoded)<br />
	DSegmentArray	m_SegmentArray;	// Character is array of segments<br />
	int				m_NSegments;	// Number of segments<br />
	COLORREF		m_OffColor;		// Color of segment when off<br />
	COLORREF		m_OnColor;		// Color of segment when on<br />
	BOOL			m_bNoOff;		// Do not draw segments that are off<br />
<br />
};<br />
<br />
typedef CArray<CDigiChar, CDigiChar> DigiCharArray;<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CDigiStatic class<br />
<br />
class CDigiStatic : public CStatic<br />
{<br />
// Construction<br />
public:<br />
	CDigiStatic();<br />
<br />
// Attributes<br />
public:<br />
	enum {<br />
		DS_SMOOTH	=  1,	// Pioneer kind of characters<br />
		DS_STYLE14	=  2,	// use allways 14 segment display.<br />
		DS_SZ_PROP	=  4,	// size proportional(default)<br />
		DS_NO_OFF	=  8,	// Don't draw the off segments<br />
		DS_SOFT		= 16	// ambient bleeding to background<br />
	};<br />
<br />
// Operations<br />
public:<br />
<br />
// Overrides<br />
	// ClassWizard generated virtual function overrides<br />
	//{{AFX_VIRTUAL(CDigiStatic)<br />
	//}}AFX_VIRTUAL<br />
<br />
// Implementation<br />
public:<br />
	virtual		~CDigiStatic();<br />
	void		SetText(LPCTSTR lpszText);<br />
	void		Format(LPCTSTR lpszFormat, ...);<br />
	void		Format(UINT nFormatID, ...);<br />
	void		SetColor(COLORREF OffColor, COLORREF OnColor);<br />
	COLORREF	GetOnColor() const {return m_OnColor;}<br />
	COLORREF	GetOffColor() const {return m_OffColor;}<br />
	void		SetDrawImmediately(BOOL Enable = TRUE);<br />
	COLORREF	SetBkColor(COLORREF BackColor = BLACK);<br />
	void		SetTransparent(BOOL bSet = TRUE);<br />
	BOOL		ModifyDigiStyle(DWORD dwRemove, DWORD dwAdd);<br />
<br />
	// Generated message map functions<br />
protected:<br />
	CDigiChar * DefineChar(TCHAR cChar);<br />
	void		BuildString();<br />
<br />
	CString			m_strText;			// Current text<br />
	BOOL			m_Modified;			// text is dirty<br />
	DigiCharArray	m_CharArray;		// digistatic is an array of characters<br />
	COLORREF		m_OffColor;			// Color of segment when off<br />
	COLORREF		m_OnColor;			// Color of segment when on<br />
	COLORREF		m_BackColor;		// Background color<br />
	DWORD			m_DispStyle;		// DS_... may be bitwise OR-red<br />
	BOOL			m_bImmediateUpdate;	// Enable/Disable immediate repaint<br />
	BOOL			m_bTransparent;		// Enable/Disable transparent background<br />
<br />
	//{{AFX_MSG(CDigiStatic)<br />
	afx_msg void OnPaint();<br />
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);<br />
	//}}AFX_MSG<br />
<br />
	DECLARE_MESSAGE_MAP()<br />
<br />
	void DoInvalidate();<br />
};<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
<br />
//{{AFX_INSERT_LOCATION}}<br />
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.<br />
<br />
#endif // !defined(AFX_DIGISTATIC_H__F77484C2_745F_11D3_A718_87712333104C__INCLUDED_)<br />
#pragma once<br />
<br />
<br />
// DigitStatic dialog<br />
<br />
class DigitStatic : public CDialog<br />
{<br />
	DECLARE_DYNAMIC(DigitStatic)<br />
<br />
public:<br />
	DigitStatic(CWnd* pParent = NULL);   // standard constructor<br />
	virtual ~DigitStatic();<br />
<br />
// Dialog Data<br />
//	enum { IDD = IDC_CUSTOM2 };<br />
<br />
protected:<br />
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support<br />
<br />
	DECLARE_MESSAGE_MAP()<br />
};<br />


SnaidiS(Semion)
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Naveen11-Jul-06 23:24
Naveen11-Jul-06 23:24 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N11-Jul-06 23:44
Semion_N11-Jul-06 23:44 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Naveen11-Jul-06 23:52
Naveen11-Jul-06 23:52 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N12-Jul-06 0:20
Semion_N12-Jul-06 0:20 
GeneralRe: Problems in Static LED control - CDigiStatic [modified] Pin
Naveen12-Jul-06 0:27
Naveen12-Jul-06 0:27 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N12-Jul-06 0:49
Semion_N12-Jul-06 0:49 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Naveen12-Jul-06 1:01
Naveen12-Jul-06 1:01 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N12-Jul-06 1:15
Semion_N12-Jul-06 1:15 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Naveen12-Jul-06 1:21
Naveen12-Jul-06 1:21 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N12-Jul-06 1:41
Semion_N12-Jul-06 1:41 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Naveen12-Jul-06 1:45
Naveen12-Jul-06 1:45 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N12-Jul-06 1:48
Semion_N12-Jul-06 1:48 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Naveen12-Jul-06 2:03
Naveen12-Jul-06 2:03 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N12-Jul-06 2:28
Semion_N12-Jul-06 2:28 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Hamid_RT12-Jul-06 2:04
Hamid_RT12-Jul-06 2:04 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Semion_N12-Jul-06 2:16
Semion_N12-Jul-06 2:16 
GeneralRe: Problems in Static LED control - CDigiStatic Pin
Hamid_RT12-Jul-06 3:40
Hamid_RT12-Jul-06 3:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.