📄 auto_truck_load.cpp
字号:
#include "stdafx.h"
#include "PLC_DEMO.h"
#include "PLC_DEMODoc.h"
#include "PLC_DEMOView.h"
#include "Draw_function.h"
bool autotruckenable=false;
int thestartpoint=120;//漏斗料起点
extern CPLC_DEMOView *fordraw;
void clearpart(int,int,int,int,CBrush*,CDC*);
void drawround(int,int,int,int,CDC*);
void autotruckdraw()
{
CDC* thisDC=fordraw->GetDC();
CPen blackpen(PS_SOLID,1,RGB(0,0,0));
CPen *oldpen=thisDC->SelectObject(&blackpen);
CBrush blackbrush(RGB(0,0,0));
thisDC->SetBkMode(TRANSPARENT);
thisDC->MoveTo(401,30);
thisDC->LineTo(401,60);
thisDC->MoveTo(420,30);
thisDC->LineTo(420,60);//出口一
clearpart(411,48,9,3,&blackbrush,thisDC);//开关一
thisDC->MoveTo(360,70);
thisDC->LineTo(360,140);
thisDC->LineTo(396,140);
thisDC->LineTo(396,160);
thisDC->MoveTo(460,70);
thisDC->LineTo(460,140);
thisDC->LineTo(425,140);
thisDC->LineTo(425,160);//漏斗
clearpart(411,143,14,3,&blackbrush,thisDC);//开关二
CBrush nobrush;
nobrush.CreateSysColorBrush(COLOR_3DFACE);
CBrush *oldbrush=thisDC->SelectObject(&nobrush);
drawround(350,230,8,8,thisDC);
drawround(350,230,4,4,thisDC);//轮一
thisDC->MoveTo(350,230);//轴线一
thisDC->LineTo(320,250);
CString forelect="电机M1";
thisDC->TextOut(333,255,forelect);
drawround(450,230,8,8,thisDC);//轮二
drawround(450,230,4,4,thisDC);
thisDC->MoveTo(350,222);//皮带一
thisDC->LineTo(450,222);
thisDC->MoveTo(350,238);
thisDC->LineTo(450,238);
thisDC->LineTo(492,215);
thisDC->MoveTo(350,222);
thisDC->LineTo(390,200);
thisDC->LineTo(490,200);
thisDC->MoveTo(350,238);
thisDC->LineTo(380,222);
CPoint round3(490,208);
CRect rect5(round3,round3);
rect5.InflateRect(8,8);
CPoint round4(490,200);
CPoint round5(491,214);
thisDC->Arc(rect5,round5,round4);//圆弧一 //滑轮1
drawround(400,285,8,8,thisDC);//轮三
drawround(400,285,4,4,thisDC);
thisDC->MoveTo(400,285);//轴线二
thisDC->LineTo(370,305);
forelect="电机M2";
thisDC->TextOut(382,310,forelect);
drawround(500,285,8,8,thisDC);//轮四
drawround(500,285,4,4,thisDC);
thisDC->MoveTo(400,277);//皮带二
thisDC->LineTo(500,277);
thisDC->MoveTo(400,293);
thisDC->LineTo(500,293);
thisDC->LineTo(542,270);
thisDC->MoveTo(400,277);
thisDC->LineTo(440,255);
thisDC->LineTo(540,255);
thisDC->MoveTo(400,293);
thisDC->LineTo(430,277);
CPoint round8(540,263);//圆弧二
CRect rect10(round8,round8);
rect10.InflateRect(8,8);
CPoint round9(540,255);
CPoint round10(541,271);
thisDC->Arc(rect10,round10,round9);//滑轮2
drawround(450,340,8,8,thisDC);//轮五
drawround(450,340,4,4,thisDC);
thisDC->MoveTo(450,340);//轴线三
thisDC->LineTo(420,360);
forelect="电机M3";
thisDC->TextOut(432,364,forelect);
drawround(550,340,8,8,thisDC);
drawround(550,340,4,4,thisDC);
thisDC->MoveTo(450,332);//皮带三
thisDC->LineTo(550,332);
thisDC->MoveTo(450,348);
thisDC->LineTo(550,348);
thisDC->LineTo(592,325);
thisDC->MoveTo(450,332);
thisDC->LineTo(490,309);
thisDC->LineTo(590,309);
thisDC->MoveTo(450,348);
thisDC->LineTo(480,332);
CPoint round13(590,318);//圆弧三
CRect rect15(round13,round13);
rect15.InflateRect(8,8);
CPoint round14(590,309);
CPoint round15(591,325);
thisDC->Arc(rect15,round15,round14); //滑轮3
thisDC->MoveTo(300,488);
thisDC->LineTo(800,488);//马路
forelect="传感器S2";
thisDC->TextOut(550,495,forelect);
thisDC->MoveTo(452,80);
thisDC->LineTo(470,80);//示意线
forelect="传感器S1";
thisDC->TextOut(505,72,forelect);
thisDC->MoveTo(420,43);//示意线
thisDC->LineTo(470,43);
forelect="开关K1";
thisDC->TextOut(505,33,forelect);
thisDC->MoveTo(425,150);
thisDC->LineTo(470,150);//示意线
forelect="开关K2";
thisDC->TextOut(505,140,forelect);
thisDC->SelectObject(&blackbrush);
drawround(485,42,8,8,thisDC);//信号灯
drawround(485,80,8,8,thisDC);
drawround(485,150,8,8,thisDC);
drawround(315,257,8,8,thisDC);
drawround(365,312,8,8,thisDC);
drawround(415,367,8,8,thisDC);
drawround(630,505,8,8,thisDC);
drawround(400,450,8,8,thisDC);
forelect="指示灯L1";
thisDC->TextOut(325,440,forelect);
CPen redpen(PS_SOLID,1,RGB(255,0,0));
thisDC->SelectObject(&redpen);
CBrush redbrush(RGB(255,0,0));
thisDC->SelectObject(&redbrush);
drawround(400,470,8,8,thisDC);
forelect="指示灯L2";
thisDC->TextOut(325,460,forelect);
CPen fleetredpen(PS_DOT,1,RGB(200,100,0));
thisDC->SelectObject(&fleetredpen);
for(int i=33;i<45;i++)//料
{
if(i%2==0)
{
thisDC->MoveTo(401,i);
thisDC->LineTo(418,i);
}
else
{
thisDC->MoveTo(403,i);
thisDC->LineTo(420,i);
}
}
thisDC->SelectObject(oldbrush);
thisDC->SelectObject(oldpen);
fordraw->ReleaseDC(thisDC);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -