• ·Î±×ÀÎ ÇÔ ÇØº¸²ô³ª?

  • Sarangnamu.net June 17, 2003
    Home Login Profile Study Open Project Q&A Google Code
    CButtonExFlatProperty
    Last Modify : 27 December, 2010(02:41)
    // ButtonExFlat.cpp : implementation file
    //
    
    // DATE		: March 9, 2007
    // CODER	: Kurome (aucd29@gmail.com)
    // VERSION	: 1.0
    //
    //
    // -----------------------------------------------------
    // FIX : March 29, 2007
    // -----------------------------------------------------
    // * buttonÀ» drag ÈÄ¿¡ mouseout »óÅ¿¡¼­ lbuttonup À» 
    //   ÇÒ°æ¿ì À̺¥Æ®°¡ ¹ß»ýÇÏÁö ¾Ê¾Æ¾ßµÇ´Âµ¥ ¹ß»ýÇÑ °ÍÀ»
    //   ¼öÁ¤
    //
    
    #include "StdAfx.h"
    #include "ButtonExFlatProperty.h"
    #include "PropertySheetExt.h"
    
    CButtonExFlatProperty::CButtonExFlatProperty(void)
    {
    }
    
    CButtonExFlatProperty::CButtonExFlatProperty(int nID)
    : m_nID(nID)
    {
    }
    
    CButtonExFlatProperty::~CButtonExFlatProperty(void)
    {
    }
    BEGIN_MESSAGE_MAP(CButtonExFlatProperty, CButtonExFlat)
    	ON_WM_LBUTTONDOWN()
    	ON_WM_LBUTTONDBLCLK()
    	ON_WM_PAINT()
    END_MESSAGE_MAP()
    
    void CButtonExFlatProperty::OnLButtonDown(UINT nFlags, CPoint point)
    {
    	CButtonExFlat::OnLButtonDown(nFlags, point);
    }
    
    void CButtonExFlatProperty::OnLButtonDblClk(UINT nFlags, CPoint point)
    {
    	// ´õºíŬ¸¯ ¸·±â
    }
    
    void CButtonExFlatProperty::OnPaint()
    {
    	CPaintDC dc(this); // device context for painting
    	
    	// dc °´Ã¼¸¦ »ý¼ºÇϰí
    	InitObject(&dc);
    
    	// AUTORADIO ¹æ½ÄÀ̹ǷΠüũ°¡ µÇ¾î ÀÖÀ¸¸é Ŭ¸¯µÈ
    	// ¸ð½ÀÀ» º¸ÀÌ¸ç ¾Æ´Ï¶ó¸é ¸¶¿ì½º »óÅ¿¡ µû¶ó¼­
    	// ¹öư¿¡ ¸ð¾çÀ» º¯µ¿ÇØÁØ´Ù.
    	if (GetCheck())
    	{
    		mDC.FillSolidRect(m_rect, m_crActiveBackground);
    		mDC.FrameRect(m_rect, &CBrush(m_crActiveBorder));
    	}
    	else
    	{
    		switch(m_nMouseStatus)
    		{
    		case _MOUSEOUT:
    			mDC.FillSolidRect(m_rect, RGB(255, 255, 255));		
    			break;
    		case _MOUSEDOWN:
    			mDC.FillSolidRect(m_rect, m_crActiveBackground);
    			mDC.FrameRect(m_rect, &CBrush(m_crActiveBorder));
    			break;
    		case _MOUSEOVER:
    			mDC.FillSolidRect(m_rect, m_crOverBackground);
    			mDC.FrameRect(m_rect, &CBrush(m_crOverBorder));
    			break;
    		default:
    			break;
    		}
    	}
    
    	mDC.Ellipse(m_rectCircle);
    	mDC.DrawText(m_szWindowText,m_rectText,m_nAlign);
    	dc.BitBlt(0, 0, m_rect.Width(), m_rect.Height(), &mDC, 0, 0, SRCCOPY);
    }
    
    void CButtonExFlatProperty::OnLButtonUp(UINT nFlags, CPoint point)
    {
    	CButtonExFlat::OnLButtonUp(nFlags, point);
    
    	if (m_rect.PtInRect(point))
    	{
    		CTabCtrl* pTab;
    		CPropertySheetExt* pWnd = static_cast<CPropertySheetExt*>(GetParent()->GetParent());
    
    		// ¼±ÅÃÇÑ ¾ÆÀÌÅÛÀ¸·Î ÅÇÀ» º¯°æ ½ÃŰÀÚ.
    		pTab = pWnd->GetTabControl();
    		if (!IsWindow(pTab->GetSafeHwnd()))
    		{
    			ASSERT(false);
    			return;
    		}
    		pTab->SetCurFocus(m_nID);
    		pWnd->SetFrameWindowText(m_szWindowText);
    		SetCheck(true);
    	}
    }
    
    #pragma once
    #include "buttonexflat.h"
    
    class CButtonExFlatProperty :
    	public CButtonExFlat
    {
    public:
    	CButtonExFlatProperty(void);
    	CButtonExFlatProperty(int nID);
    	~CButtonExFlatProperty(void);
    
    protected:
    	int m_nID;
    public:
    	DECLARE_MESSAGE_MAP()
    	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
    	afx_msg void OnPaint();
    	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
    };
    
    

    Comment


    ÀÔ·ÂÇÏ3 1550279895



    Locations of visitors to this page