D:/Zythum/DinoKod/MapEditor/ColorButton.cpp

00001 // ColorButton.cpp : fichier d'implémentation
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "MapEditor.h"
00006 #include "ColorButton.h"
00007 
00008 
00009 // CColorButton
00010 
00011 IMPLEMENT_DYNAMIC(CColorButton, CButton)
00012 CColorButton::CColorButton()
00013 {
00014         m_Color = RGB( 255, 255, 255 );
00015 }
00016 
00017 CColorButton::~CColorButton()
00018 {
00019 }
00020 
00021 
00022 BEGIN_MESSAGE_MAP(CColorButton, CButton)
00023         ON_WM_PAINT()
00024         ON_CONTROL_REFLECT(BN_CLICKED, OnBnClicked)
00025 END_MESSAGE_MAP()
00026 
00027 
00028 
00029 // Gestionnaires de messages CColorButton
00030 
00031 void CColorButton::OnPaint()
00032 {
00033 //      CPaintDC dc(this); // device context for painting
00034         // TODO : ajoutez ici le code de votre gestionnaire de messages
00035         // N'appelez pas CButton::OnPaint() pour la peinture des messages
00036 
00037         CButton::OnPaint();
00038 
00039         CDC*    pDC = GetDC();
00040         CBrush  Brush( m_Color );
00041         RECT    Rect;
00042 
00043         GetClientRect( &Rect );
00044         Rect.left       += 3;
00045         Rect.top        += 3;
00046         Rect.right      -= 3;
00047         Rect.bottom     -= 3;
00048         pDC->FillRect( &Rect, &Brush );
00049 
00050         ReleaseDC( pDC );
00051 }
00052 
00053 void CColorButton::OnBnClicked()
00054 {
00055         CColorDialog    ColorDlg( m_Color, CC_FULLOPEN, this );
00056         ColorDlg.DoModal();
00057         m_Color = ColorDlg.GetColor();
00058 
00059         RedrawWindow();
00060 }
00061 
00062 BOOL CColorButton::PreCreateWindow(CREATESTRUCT& cs)
00063 {
00064         // TODO : ajoutez ici votre code spécialisé et/ou l'appel de la classe de base
00065 
00066         return CButton::PreCreateWindow(cs);
00067 }

Generated on Sun Mar 25 20:02:13 2007 for Zythum Project by  doxygen 1.5.1-p1