📄 cgelement.cs
字号:
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace VCSharp
{
/// <summary>
/// CGElement 的摘要说明。
/// </summary>
public abstract class CGElement
{
private int m_Color;
private int m_Style;
private int m_Width;
public int Color
{
get{return m_Color;}
set{m_Color=value;}
}
public int Style
{
get{return m_Style;}
set{m_Style=value;}
}
public int Width
{
get{return m_Width;}
set{m_Width=value;}
}
public CGElement()
{
Init();
}
//初始化图元
protected void Init()
{
m_Style=0;
m_Width=1;
m_Color=0;
}
//绘制图元
abstract public void Draw(Graphics g,DrawMode aDrawMode);
//根据不同的绘图模式设置不同的绘图参数
public int[] DrawSettings(IntPtr hdc,DrawMode aDrawMode)
{
switch(aDrawMode)
{
case DrawMode.Normal:
Win32API.SetROP2(hdc, 13);
m_Style = 0;
m_Width = 1;
m_Color =0;
break;
case DrawMode.Selec:
Win32API.SetROP2(hdc, 13);
m_Style = 1;
m_Width = 1;
m_Color =255;
break;
case DrawMode.Drag:
Win32API.SetROP2(hdc, 10);
m_Style = 0;
m_Width = 1;
m_Color =16711680;
break;
case DrawMode.Delete:
Win32API.SetROP2(hdc, 13);
m_Style = 0;
m_Width = 1;
m_Color =16777215;
break;
}
int[] penPara={m_Style,m_Width,m_Color};
return penPara;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -