📄 crotate.cs
字号:
using System;
using System.Collections;
using System.Drawing;
namespace VCSharp
{
/// <summary>
/// CRotate 的摘要说明。
/// </summary>
///
public class CRotate:ICommand
{
private int m_Step;
private PointF m_basePos;
private PointF m_desPos;
Module m=new Module();
public CRotate()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void LButtonDown(Graphics g,PointF aPos,ArrayList ges,ArrayList geSels)
{
m_Step+=1;
switch (m_Step)
{
case 1:
m_basePos=aPos;
m_desPos=aPos;
break;
case 2:
//清除最后一条橡皮线
CLine tempLine=new CLine(m_basePos,m_desPos);
tempLine.Draw(g,DrawMode.Drag);
tempLine=null;
//将所有被选中的图元移动到目标位置并进行绘制
if (geSels.Count>0)
{
float aAngle=m.GetAngle(m_basePos,m_desPos);
for (int i=0;i< geSels.Count;i++)
{
//清除图元在当前位置上的图形
((CGElement)(geSels[i])).Draw(g,DrawMode.Delete);
((CGElement)(geSels[i])).Rotate(g,m_basePos,aAngle);
((CGElement)(geSels[i])).Draw(g,DrawMode.Selec);
}
}
m_Step=0;
break;
}
}
public void MouseMove(Graphics g,PointF aPos)
{
switch (m_Step)
{
case 1:
PointF prePos=new PointF();
PointF curPos=new PointF();
prePos =m_desPos;
curPos =aPos;
//清除上一条橡皮线
CLine tempLine1=new CLine(m_basePos,prePos);
tempLine1.Draw(g,DrawMode.Drag);
tempLine1=null;
//绘当前位置的橡皮线
CLine tempLine2=new CLine(m_basePos,curPos);
tempLine2.Draw(g,DrawMode.Drag);
tempLine2=null;
m_desPos=aPos;
break;
}
}
//单击鼠标右键时的绘图行为
public void RButtonDown(Graphics g,PointF aPos)
{
if (m_Step==1)
{
//清除上一条橡皮线
CLine tempLine=new CLine(m_basePos,m_desPos);
tempLine.Draw(g,DrawMode.Drag);
tempLine=null;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -