?? 磁盤管理view.cpp
字號:
// 磁盤管理View.cpp : implementation of the CMyView class
//
#include "stdafx.h"
#include "磁盤管理.h"
#include "磁盤管理Doc.h"
#include "磁盤管理View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyView
IMPLEMENT_DYNCREATE(CMyView, CView)
BEGIN_MESSAGE_MAP(CMyView, CView)
//{{AFX_MSG_MAP(CMyView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyView construction/destruction
CMyView::CMyView()
{
// TODO: add construction code here
}
CMyView::~CMyView()
{
}
BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMyView drawing
void CMyView::OnDraw(CDC* pDC)
{
CMyDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CString str;
int i;
int rx = 0;
//int ry = 0;
if(pDoc->showfree == 1)
{
pDC->TextOut(0,0,"頁號 起始塊號 空閑塊號 使用狀態");
for(i=0;i< 10 ;i++)
{
if(pDoc->Red == i)
{
pDC->SetTextColor(RGB(255,0,0));
str.Format("%d",pDoc->DT[i].OrderNum);
pDC->TextOut(0,25*(i+1),str);
str.Format("%d",pDoc->DT[i].StarBlock);
pDC->TextOut(80,25*(i+1),str);
str.Format("%d",pDoc->DT[i].FreeBlocks);
pDC->TextOut(160,25*(i+1),str);
str.Format("%d",pDoc->DT[i].status);
pDC->TextOut(240,25*(i+1),str);
pDC->SetTextColor(RGB(0,0,0));
}
else{
str.Format("%d",pDoc->DT[i].OrderNum);
pDC->TextOut(0,25*(i+1),str);
str.Format("%d",pDoc->DT[i].StarBlock);
pDC->TextOut(80,25*(i+1),str);
str.Format("%d",pDoc->DT[i].FreeBlocks);
pDC->TextOut(160,25*(i+1),str);
str.Format("%d",pDoc->DT[i].status);
pDC->TextOut(240,25*(i+1),str);
}
}
pDC->TextOut(0,25*(i+1),"柱面號: 磁道號: 物理記錄號: 物理記錄數:");
pDC->SetTextColor(RGB(255,0,0));
str.Format("%d",pDoc->disk.m_CylNum);
pDC->TextOut(60,25*(i+1),str);
str.Format("%d",pDoc->disk.m_DiskNum);
pDC->TextOut(140,25*(i+1),str);
str.Format("%d",pDoc->disk.m_PhyNum);
pDC->TextOut(270,25*(i+1),str);
str.Format("%d",pDoc->NeedBlock);
pDC->TextOut(390,25*(i+1),str);
pDC->SetTextColor(RGB(0,0,0));
/*pDC->TextOut(400,0,"已經的存入文件:");
pDC->SetTextColor(RGB(255,0,0));
str.Format("柱面號:%d",pDoc->head->m_CylNum);
pDC->TextOut(400,25,str);*/
}
if(pDoc->showbit == 1)
{
pDC->TextOut(0,0," 位示圖");
for(i=0;i<200;i++)
{
if(pDoc->bitred == i)
{
pDC->SetTextColor(RGB(255,1,74));
str.Format("%d",pDoc->BitAry[i]);
if(i%50 == 0)
{
rx = rx + 25 ;
}
pDC->TextOut(10*(i%50),rx,str);
pDC->SetTextColor(RGB(0,0,0));
}
else
{
str.Format("%d",pDoc->BitAry[i]);
if(i%50 == 0)
{
rx = rx + 25 ;
}
pDC->TextOut(10*(i%50),rx,str);
}
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CMyView printing
BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMyView diagnostics
#ifdef _DEBUG
void CMyView::AssertValid() const
{
CView::AssertValid();
}
void CMyView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMyDoc* CMyView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
return (CMyDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyView message handlers
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -