• 로그인 함 해보끄나?

  • Sarangnamu.net June 17, 2003
    Home Login Profile Study Open Project Q&A Google Code
    DetailMiniView - 리스트 선택시 내용을 보여주는 작은 창.
    Last Modify : 27 December, 2010(01:54)
    // DetailListView.cpp : implementation file
    //
    
    // DATE		: June 27, 2006
    // CODER	: Kurome (aucd29@gmail.com)
    //
    //
    // ---------------------------------------------------------------------
    // NOTE : July 11, 2006
    // ---------------------------------------------------------------------
    // * 툴팁을 대신할 녀석을 하나 만들어야 했기에 툴팁이랑 비스꼬롬하지만.
    //   멀티 라인에다가 다소 멋지게 스크롤 바도 생기는 묘한 녀석을 하나
    //   만들었다.. 나름대로 만족한다.
    //
    // ---------------------------------------------------------------------
    // NOTE : August 8, 2006
    // ---------------------------------------------------------------------
    // * 디자인 요청해서 받고 -_- 버그 생긴 버튼을 어떻게 처리해도보록 하자.
    // * 디자인에 맞게 변경 완료
    
    #include "stdafx.h"
    #include "SMS_WIZARD.h"
    #include "DetailListView.h"
    #include "memdc.h"
    
    
    
    // CDetailListView dialog
    
    IMPLEMENT_DYNAMIC(CDetailListView, CDialog)
    
    CDetailListView::CDetailListView(CWnd* pParent /*=NULL*/)
    	: CDialog(CDetailListView::IDD, pParent)
    	, m_szDetailList(_T(""))
    	, m_ptCurrent(0)
    	, m_szDate(_T(""))
    	, m_szPhoneNumber(_T(""))
    {
    	m_hBrush = CreateSolidBrush(RGB(208, 235, 245));
    }
    
    CDetailListView::~CDetailListView()
    {
    }
    
    void CDetailListView::DoDataExchange(CDataExchange* pDX)
    {
    	CDialog::DoDataExchange(pDX);
    	DDX_Control(pDX, IDC_BTN_DETAIL_CLOSE, m_btnDetailClose);
    }
    
    
    BEGIN_MESSAGE_MAP(CDetailListView, CDialog)
    	ON_WM_LBUTTONDOWN()
    	ON_WM_CTLCOLOR()
    	ON_BN_CLICKED(IDC_BTN_DETAIL_CLOSE, &CDetailListView::OnBnClickedBtnDetailClose)
    	ON_WM_PAINT()
    	ON_WM_ERASEBKGND()
    END_MESSAGE_MAP()
    
    
    // CDetailListView message handlers
    
    BOOL CDetailListView::OnInitDialog()
    {
    	CDialog::OnInitDialog();
    
    	int cxFullScreen = GetSystemMetrics(SM_CXFULLSCREEN);
    	int cyFullScreen = GetSystemMetrics(SM_CYFULLSCREEN); 
    
    	if (cxFullScreen < (m_ptCurrent.x + 245))
    	{
    		m_ptCurrent.x -= (265 - (cxFullScreen - m_ptCurrent.x));
    	}
    
    	if (cyFullScreen <  (m_ptCurrent.y + 203))
    	{
    		m_ptCurrent.y -= (223 - (cxFullScreen - m_ptCurrent.y));
    	}
    	MoveWindow(m_ptCurrent.x, m_ptCurrent.y + 20, 245, 203);	
    
    	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDT_DETAIL_LIST);
    	pEdit->SetWindowText(m_szDetailList);
    	if (pEdit->GetLineCount() > 12)
    	{
    		pEdit->ShowScrollBar(1);
    	}
    
    	CStatic* pStatic;
    	pStatic = (CStatic*)GetDlgItem(IDSTC_DETAIL_DATE2);
    	pStatic->SetWindowText(m_szDate);
    	pStatic = (CStatic*)GetDlgItem(IDSTC_DETAIL_PHONENUM2);
    	pStatic->SetWindowText(m_szPhoneNumber);
    
    	//pEdit->set
    
    	m_btnDetailClose.SetSkin(IDB_BTN_DETAIL_EXIT, IDB_BTN_DETAIL_EXIT, IDB_BTN_DETAIL_EXIT, 0, 0, IDB_BTN_DETAIL_EXIT_MASK, 0, 0, 0);	
    
    	// 스크롤 바
    	//SkinWndScroll(&m_listMemberList,m_hBmpScrollBar);
    
    	// 윈도우 절단 -_-; 
    	CRect rect;
    	GetClientRect(&rect);
    	CRgn rgn;
    	rgn.CreateRoundRectRgn(0, 0, rect.right+1, rect.bottom+1, 8, 8);
    	SetWindowRgn(rgn, true);
    
    	return TRUE;  // return TRUE unless you set the focus to a control
    	// EXCEPTION: OCX Property Pages should return FALSE
    }
    
    void CDetailListView::SetString(CString szDate, CString szPhoneNumber, CString szMessage, CPoint* pPoint)
    {
    	m_szDetailList	= szMessage;
    	m_ptCurrent		= *pPoint;
    	m_szDate		= szDate;
    	m_szPhoneNumber = szPhoneNumber;
    }
    
    void CDetailListView::OnLButtonDown(UINT nFlags, CPoint point)
    {
    	CDialog::OnLButtonDown(nFlags, point);
    }
    
    LRESULT CDetailListView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
    {
    	LRESULT nHit;
    
    	switch(message)
    	{
    	case WM_NCHITTEST:
    		nHit = DefWindowProc(message,wParam,lParam);
    		switch(nHit)
    		{
    		case HTCLIENT:
    			nHit = HTCAPTION;
    			break;
    		}
    		return nHit;
    	}
    
    	return CDialog::WindowProc(message, wParam, lParam);
    }
    
    HBRUSH CDetailListView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    
    	if (pWnd->GetDlgCtrlID() == IDSTC_DETAIL_DATE || 
    		pWnd->GetDlgCtrlID() == IDSTC_DETAIL_PHONENUM)
    	{
    		CFont font;
    		font.CreateFont(12, 0, 0, 0, FW_BOLD, FALSE, FALSE, 0, 0, 0, 0, 0, 0, L"Tahoma");
    		CFont *Oldfont = (CFont*) pDC->SelectObject(&font);
    		pDC->SetBkMode(TRANSPARENT);
    		
    		return (HBRUSH)GetStockObject(NULL_BRUSH);
    	}
    	else if(pWnd->GetDlgCtrlID() == IDSTC_DETAIL_DATE2 ||
    			pWnd->GetDlgCtrlID() == IDSTC_DETAIL_PHONENUM2)
    	{
    		pDC->SetBkMode(TRANSPARENT);
    		return (HBRUSH)GetStockObject(NULL_BRUSH);
    	}
    	else if (pWnd->GetDlgCtrlID() == IDC_EDT_DETAIL_LIST)
    	{
    		pDC->SetBkMode(TRANSPARENT);
    		return m_hBrush;
    	}
    	
    	return hbr;
    }
    
    void CDetailListView::OnBnClickedBtnDetailClose()
    {
    	OnOK();
    }
    
    void CDetailListView::OnPaint()
    {
    	CPaintDC dc(this); // device context for painting
    
    	// 별로 부하 안걸리겠지? -_-?
    	CRect rect;
    	CPen myPen;
    	CBrush myBrush;
    	GetClientRect(&rect);
    	CMemDC mDC(&dc, &rect);
    
    	myPen.CreatePen(PS_SOLID, 1, RGB(122, 176, 199));
    	mDC.SelectObject(&myPen);	
    	myBrush.CreateSolidBrush(RGB(208, 235, 245));
    	mDC.SelectObject(&myBrush);
    	mDC.FillSolidRect(&rect, RGB(208, 235, 245));
    	mDC.RoundRect(rect, CPoint(10, 10));	
    }
    
    BOOL CDetailListView::OnEraseBkgnd(CDC* pDC)
    {
    	return true;
    }
    

    Comment


    입력하3 1498429796



    Locations of visitors to this page