?? modeview.cpp
字號:
}
CModeView::~CModeView()
{
}
BOOL CModeView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CModeView drawing
void CModeView::OnDraw(CDC* pDC)
{
CModeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect cr(0,0,500,500);
pDC->FillSolidRect(cr,RGB(220,220,220));
pDC->TextOut(10,500,"1.視窗分為左視圖和右視圖,請按如下步驟執行。");
pDC->TextOut(10,520,"2.鼠標單擊左視圖,可以激活按鈕:[標準數字聚類]、[手畫圖形聚類]、[位圖文件分析聚類]。");
pDC->TextOut(10,540,"3.按下[標準數字聚類]按鈕后,選擇工具條上提供的各種標準數字。");
pDC->TextOut(10,560,"4.按下[手畫圖形聚類]按鈕后,拖動鼠標左鍵畫各種數字或圖形,注意每一個物體要連通。");
pDC->TextOut(10,580,"5.按下[位圖文件分析聚類]按鈕后,打開需要聚類分析的位圖文件。");
pDC->TextOut(10,600,"6.單擊右視圖,選擇菜單[獲得模式特征]進行特征提取后,選擇各種算法進行聚類分析。");
if (stateDoc)
{
if (statePen)
::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSORPEN));
else
::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSORERASER));
BYTE* pBitmapData = pCluster->GetData();
LPBITMAPINFO pBitmapInfo = pCluster->GetInfo();
int bitmapHeight = height;//pCDib->GetHeight();
int bitmapWidth = wide;//pCDib->GetWidth();
if (pCluster->GetRGB()) // Has a color table
{
CPalette * hPalette1=CreateBitmapPalette(pCluster);
CPalette * hOldPalette =
pDC->SelectPalette(hPalette1, true);
pDC->RealizePalette();
::StretchDIBits(pDC->GetSafeHdc(),0,0, bitmapWidth, bitmapHeight,
0, 0, bitmapWidth , bitmapHeight ,
pBitmapData, pBitmapInfo,
DIB_RGB_COLORS, SRCCOPY);
pDC->SelectPalette(hOldPalette, true);
hPalette.DeleteObject();
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CModeView printing
BOOL CModeView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CModeView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CModeView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CModeView diagnostics
#ifdef _DEBUG
void CModeView::AssertValid() const
{
CView::AssertValid();
}
void CModeView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CModeDoc* CModeView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CModeDoc)));
return (CModeDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CModeView message handlers
CPalette * CModeView::CreateBitmapPalette(CCluster *pBitmap)
{
struct
{
WORD Version;
WORD NumberOfEntries;
PALETTEENTRY aEntries[256];
} palette = { 0x300, 256 };
LPRGBQUAD pRGBTable = pBitmap->GetRGB();
UINT numberOfColors = pBitmap->GetNumberOfColors();
for(UINT x=0; x<numberOfColors; ++x)
{
palette.aEntries[x].peRed =
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -