?? singlefilldlg.cpp
字號:
// SingleFillDlg.cpp : implementation file
//
#include "stdafx.h"
#include "SimpleMap.h"
#include "SingleFillDlg.h"
#include "MainFrm.h"
#include "SimpleMapDoc.h"
#include "SimpleMapView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSingleFillDlg dialog
CSingleFillDlg::CSingleFillDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSingleFillDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSingleFillDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_RCFill.left = 120;
m_RCFill.right = m_RCFill.left + 105;
m_RCFill.top = 30;
m_RCFill.bottom = m_RCFill.top + 20;
m_RCOutLine = m_RCFill;
m_RCOutLine.top = 60;
m_RCOutLine.bottom = m_RCOutLine.top + 20;
m_FillColor = RGB(255,239,156);
m_OutlineColor = RGB(0,0,0);
m_Hot = 0;
m_csLayerName = _T("");
m_pLayer = NULL;
}
void CSingleFillDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSingleFillDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSingleFillDlg, CDialog)
//{{AFX_MSG_MAP(CSingleFillDlg)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSingleFillDlg message handlers
BOOL CSingleFillDlg::OnInitDialog()
{
CDialog::OnInitDialog();
int i ;
CString csFieldName;
CMapLayer *pLayer;
CMainFrame *pFrame = (CMainFrame *)::AfxGetMainWnd();
ASSERT(pFrame != NULL );
CSimpleMapView *pView = (CSimpleMapView*)pFrame->GetActiveView();
ASSERT(pView != NULL );
CSimpleMapDoc* pDoc = pView->GetDocument();
ASSERT_VALID(pDoc);
for ( i = 0 ; i < pDoc->m_MapLayers.GetCount() ; i++ )
{
pLayer = (CMapLayer *)pDoc->m_MapLayers.GetAt(i);
if ( pLayer->GetLayerName() == m_csLayerName )
break;
}
if ( i >= pDoc->m_MapLayers.GetCount() )
{
m_pLayer = NULL;
return TRUE;
}
m_pLayer = pLayer;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSingleFillDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CBrush brFill(m_FillColor);
CBrush brOutLine(m_OutlineColor);
dc.FillRect(m_RCFill,&brFill);
dc.FillRect(m_RCOutLine,&brOutLine);
dc.Draw3dRect(&m_RCFill,::GetSysColor(20),::GetSysColor(COLOR_BTNSHADOW) );
dc.Draw3dRect(&m_RCOutLine,::GetSysColor(20),::GetSysColor(COLOR_BTNSHADOW) );
// Do not call CDialog::OnPaint() for painting messages
}
void CSingleFillDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if ( m_RCFill.PtInRect(point) )
{
CColorDlg dlgColor;
dlgColor.m_Color=m_FillColor;
if ( dlgColor.DoModal() == IDOK )
{
m_FillColor = dlgColor.GetColor();
InvalidateRect(&m_RCFill,TRUE);
}
}
else if ( m_RCOutLine.PtInRect(point) )
{
CColorDlg dlgColor;
dlgColor.m_Color=m_OutlineColor;
if ( dlgColor.DoModal() == IDOK )
{
m_OutlineColor = dlgColor.GetColor();
InvalidateRect(&m_RCOutLine,TRUE);
}
}
CDialog::OnLButtonDown(nFlags, point);
}
void CSingleFillDlg::OnOK()
{
CMapRender *pRender;
SIMPLERENDER simple;
pRender = new CMapRender;
ASSERT( pRender != NULL );
pRender->SetRenderType(SIMPLE_RENDER);
simple.FillColor = m_FillColor;
simple.OutlineColor = m_OutlineColor;
simple.iIndex = 0;//m_cmbStyle.GetItemData( m_cmbStyle.GetCurSel());
pRender->SetSimpleRender(simple);
m_pLayer->SetRender(pRender);
CMainFrame *pFrame = (CMainFrame *)::AfxGetMainWnd();
ASSERT(pFrame != NULL );
CSimpleMapView *pView = (CSimpleMapView*)pFrame->GetActiveView();
ASSERT(pView != NULL );
//pView->Invalidate(TRUE);
CDialog::OnOK();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -