📄 object_check.cpp
字号:
#include "stdafx.h"
#include "PLC_DEMO.h"
#include "PLC_DEMODoc.h"
#include "PLC_DEMOView.h"
#include "Draw_function.h"
bool objectcheckenable;
extern CPLC_DEMOView *fordraw;
void drawround(int,int,int,int,CDC*);
void draw_object_check()
{
CDC* thisDC=fordraw->GetDC();
CPen blackpen(PS_SOLID,1,RGB(0,0,0));
CPen *oldpen=thisDC->SelectObject(&blackpen);
CPen redpen(PS_SOLID,1,RGB(255,0,0));
CBrush nobrush;
nobrush.CreateSysColorBrush(COLOR_3DFACE);
CBrush *oldbrush=thisDC->SelectObject(&nobrush);
CBrush blackbrush(RGB(0,0,0));
thisDC->SetBkMode(TRANSPARENT);
drawround(400,200,10,10,thisDC);//轮一
drawround(400,200,6,6,thisDC);
drawround(640,200,10,10,thisDC);//轮二
drawround(640,200,6,6,thisDC);
thisDC->MoveTo(415,155);//传感器
thisDC->LineTo(435,155);
thisDC->LineTo(435,135);
thisDC->LineTo(415,135);
thisDC->LineTo(415,155);
thisDC->MoveTo(415,135);
thisDC->LineTo(445,90);
thisDC->LineTo(465,90);
thisDC->LineTo(435,135);
thisDC->MoveTo(435,155);
thisDC->LineTo(465,110);
thisDC->LineTo(465,90);
thisDC->LineTo(475,75);
thisDC->LineTo(495,75);
thisDC->MoveTo(400,189);//滑轮
thisDC->LineTo(640,189);
thisDC->MoveTo(400,210);
thisDC->LineTo(640,210);
thisDC->MoveTo(400,200);
thisDC->LineTo(360,230);
CString ss;
thisDC->MoveTo(480,350);//次品箱
thisDC->LineTo(480,480);
thisDC->LineTo(580,480);
thisDC->LineTo(580,350);
thisDC->LineTo(480,350);
thisDC->LineTo(510,330);
thisDC->LineTo(610,330);
thisDC->LineTo(580,350);
thisDC->MoveTo(610,330);
thisDC->LineTo(610,460);
thisDC->LineTo(580,480);
ss.Format("次品箱");
thisDC->TextOut(500,410,ss);
thisDC->MoveTo(630,350);//正品箱
thisDC->LineTo(630,480);
thisDC->LineTo(730,480);
thisDC->LineTo(730,350);
thisDC->LineTo(630,350);
thisDC->LineTo(660,330);
thisDC->LineTo(760,330);
thisDC->LineTo(730,350);
thisDC->MoveTo(760,330);
thisDC->LineTo(760,460);
thisDC->LineTo(730,480);
ss.Format("正品箱");
thisDC->TextOut(650,410,ss);
thisDC->SelectObject(&blackbrush);
drawround(350,240,10,10,thisDC);
ss.Format("传感器BL2");
thisDC->TextOut(330,253,ss);
drawround(510,75,10,10,thisDC);
ss.Format("传感器BL1");
thisDC->TextOut(525,65,ss);
drawround(380,350,10,10,thisDC);
ss.Format("传感器BL3");
thisDC->TextOut(395,340,ss);
drawround(320,60,10,10,thisDC);
ss.Format("系统开关SB");
thisDC->TextOut(335,55,ss);
drawround(350,200,10,10,thisDC);
ss.Format("开关k1");
thisDC->TextOut(290,192,ss);
thisDC->MoveTo(385,200);
thisDC->LineTo(365,200);
drawround(350,160,10,10,thisDC);
ss.Format("电机M1");
thisDC->TextOut(330,130,ss);
thisDC->MoveTo(400,200);
thisDC->LineTo(365,170);
ss.Format("电磁阀YV");
thisDC->TextOut(575,220,ss);
CPen blackpen1(PS_SOLID,4,RGB(0,0,0));
thisDC->SelectObject(&blackpen1);
thisDC->MoveTo(525,214);
thisDC->LineTo(543,214);
thisDC->MoveTo(568,214);
thisDC->LineTo(550,214);
thisDC->SelectObject(oldbrush);
thisDC->SelectObject(oldpen);
fordraw->ReleaseDC(thisDC);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -