📄 mos_ui.cpp
字号:
// Mos_UI.cpp: implementation of the CMos_UI class.
// Wrote by biti_zx . Released April,2002.
// Copyright (C) 2002 by biti_zx .
// All rights reserved.
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "mos.h"
#include "Mos_UI.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern nMODE;
CMos_UI::CMos_UI()
{
}
CMos_UI::~CMos_UI()
{
}
void CMos_UI::DealWithUI(CString str, int ID)
{
AfxGetApp()->GetMainWnd()->GetDlgItem(ID)->SetWindowText(str);
if(nMODE != 1)
Sleep(10);
}
void CMos_UI::DealWithUIEx(pcbtype *p, int ID)
{
if(p!=NULL){
CString str,temp;
for(pcbtype* t=p;t!=NULL;t=t->next){
temp.Format("->P%d",t->pid);
str+=temp;
}
DealWithUI(str,ID);
}
else DealWithUI(_T(" "),ID);
if(nMODE == 2)
Sleep(200);
else if(nMODE == 0)
Sleep(100);
}
void CMos_UI::PrtMsg(char *buff)
{
CEdit* pE = (CEdit*)AfxGetApp()->GetMainWnd()->GetDlgItem(IDC_EDIT1);
CString str,str1;
pE->GetWindowText(str);
str1.Format("%s\r\n",buff);
str+=str1;
pE->SetWindowText(str);
pE->LineScroll(1000);
}
void CMos_UI::DrawRect(int m, int total, int ID)
{
CRect rect;
CString str;
CWnd* m_pPic=AfxGetApp()->GetMainWnd()->GetDlgItem(ID);
m_pPic->GetClientRect(rect);
CDC *pDC = m_pPic->GetDC();
CBrush *pNewBrush = new CBrush;
CBrush *pBrush = new CBrush;
COLORREF crBKColor = ::GetSysColor(COLOR_MENU);
pNewBrush->CreateSolidBrush(crBKColor);
CBrush *pOldBrush = pDC->SelectObject(pNewBrush);
pDC->Rectangle(rect);
pBrush->CreateSolidBrush(RGB(0,0,255));
pDC->SelectObject(pBrush);
int temp = rect.right;
rect.right=rect.right*m/total;
pDC->FillRect(rect,pBrush);
pDC->SelectObject(pOldBrush);
pDC->SetBkMode(TRANSPARENT);
str.Format("%d",m*100/total);
str+="%";
pDC->TextOut(temp/2-10,rect.top,str);
delete pNewBrush;
delete pBrush;
}
void CMos_UI::FillList(int n,char *p, int ID)
{
CListBox* pL=(CListBox*)AfxGetApp()->GetMainWnd()->GetDlgItem(ID);
CString str;
str.Format(STR,n);
str+=p;
pL->AddString(str);
}
void CMos_UI::UpdateList(int ID,char* oldch,int n,char *newch)
{
CListBox* pL=(CListBox*)AfxGetApp()->GetMainWnd()->GetDlgItem(ID);
if(oldch!=NULL&&newch!=NULL){
CString str;
int nIndex = 0;
str.Format(STR,n);
str+=oldch;
if ((nIndex=pL->FindString(nIndex, str)) != LB_ERR){
str.Format(STR,n);
str+=newch;
pL->InsertString(nIndex,str);
pL->DeleteString( nIndex+1 );
}
}
else pL->DeleteString(0);
}
void CMos_UI::UpdateListAll(int ID)
{
CListBox* pL=(CListBox*)AfxGetApp()->GetMainWnd()->GetDlgItem(ID);
pL->ResetContent();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -