본문 바로가기
C++ 200제/코딩 IT 정보

MFC - GDI+ LCD CONTROL (그래픽 라이브러리)

by vicddory 2018. 3. 1.

MFC - GDI+ LCD CONTROL (그래픽 라이브러리)


MFC는 다들 아시다시피 고대 유물과도 같은 존재라 이걸로 코딩하기 정말 힘듭니다. 생산성이 많이 떨어져요.

그래서 제가 소개하는 GDI+ LCD CONTROL 같은 그래픽 라이브러리는 적극적으로 사용해야 합니다.


첨부 파일


출처 - Code Project : A MFC/GDI+ LCD Control [링크]


실행파일 다운 - IsiLcdLib.zip [링크]

전체 프로젝트 - IsiLcdDisplayProject.zip [링크]

주요 특징


- Draw Border

- 폰트 관리 (256)

- 전체 크기 제어

- 숫자나 텍스트 표시

- 조명 효과

- 더블 버퍼링

- 투명 효과

- 깜박이는 효과

- 세그먼트나 Dot 크기 조정


사용 방법


1. GDI 초기화


1
2
3
4
5
class MyApp : public CWinApp
{
private :
 DECLARE_GDI_PLUS;
//…//
cs


2A. 컨트롤러 구현


1. Insert all .h and .cpp files

2. Insert the Font5x7.bmp file as a bitmap resource

3. Add a static control into your dialog resource

4. Add a member variable for that static control

5. Modify the variable declaration


1
2
3
4
5
6
7
CStatic m_MyLcdCtrl
아래처럼 수정
 
CIsiLcdDisplay m_MyLcdCtrl
 
헤더파일 추가
#include "IsiLcdDisplay.h".
cs


MFC - GID LCD 컨트롤러 예제MFC - GID LCD 컨트롤러 예제


2B. MFC, GDI+ LCD Control 객체 동적 생성


OnInitDialog()에 아래 소스 추가


1
2
3
4
5
if ( !m_MyLcdCtrl.Create(_T(“”),WS_CHILD|WS_VISIBLE, lCRect, this-1 ) ) 
    ASSERT( 0 );
    // Something wrong 
}
cs


3. 컨트롤러 꾸미기


OnInitDialog()에 아래 소스 추가


1
2
3
4
5
m_CIsiLcdSample14.LoadMatrix( IDB_MATRIX5x7 ); // Load 5x7 matrix
m_CIsiLcdSample14.SetNbSegment( MatrixDot, FALSE ); // Select matrix mode(dot)
m_CIsiLcdSample14.SetValueNbDigit( 6,2 ); // 6 Digits, precision 2
m_CIsiLcdSample14.ShowSign( TRUE ); // Show sign
m_CIsiLcdSample14.SetColor( RGB(0,150,0) ); // Set green color (~50%)
cs


4. 보여질 값 설정


1
m_CIsiLcdSample14.SetValue ( 2 . 35 )
cs

 

또는,

 

1
2
// CIsiLcdSample14.SetTextmode (TRUE);
 m_CIsiLcdSample14.SetWindowText (_T ( "내 텍스트");
cs


더욱 자세한 설명은 링크를 따라 들어가세요.


제가 따로 요약할 필요가 없을 정도로 원제작자 분이 깔끔하고 간결하게 정리해 주셨습니다.


MFC - GDI+ LCD CONTROL (그래픽 라이브러리)

댓글