• 로그인 함 해보끄나?

  • 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 1508772056



    Locations of visitors to this page