|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Controls.Feeding
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 直管
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ToolboxBitmap( typeof( StraightTube ) , "ICONS.StraightTube.bmp" )]//新添加的代码
|
|
|
|
|
public partial class StraightTube : FeedingControl
|
|
|
|
|
{
|
|
|
|
|
bool bNewPic = false;
|
|
|
|
|
|
|
|
|
|
public enum Types
|
|
|
|
|
{
|
|
|
|
|
ptLeftToRight = 0, ptRightToLeft = 1, ptUpToDown = 2, ptDownToUp = 3
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Types _type;
|
|
|
|
|
string[] sImages;
|
|
|
|
|
public StraightTube():base()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
|
|
|
|
|
ReloadStream();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Init()
|
|
|
|
|
{
|
|
|
|
|
base.Init();
|
|
|
|
|
_imageStream = null;
|
|
|
|
|
|
|
|
|
|
sImages = new string[4];
|
|
|
|
|
sImages[0] = "Mesnac.Controls.Feeding.Resources.zg.ZGHBlack1.gif";//dkNull
|
|
|
|
|
sImages[1] = "Mesnac.Controls.Feeding.Resources.zg.ZGHBlack2.gif";//dkNull
|
|
|
|
|
sImages[2] = "Mesnac.Controls.Feeding.Resources.zg.ZGVBlack1.gif";//dkNull
|
|
|
|
|
sImages[3] = "Mesnac.Controls.Feeding.Resources.zg.ZGVBlack2.gif";//dkNull
|
|
|
|
|
|
|
|
|
|
_type = Types.ptLeftToRight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ReloadStream()
|
|
|
|
|
{
|
|
|
|
|
//CloseStream();
|
|
|
|
|
int nIndex = (int)_type;
|
|
|
|
|
_imageStream = _assembly.GetManifestResourceStream(sImages[nIndex]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Types Type
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _type;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (bFirstCreated == true)
|
|
|
|
|
{
|
|
|
|
|
bFirstCreated = false;
|
|
|
|
|
}
|
|
|
|
|
bool flag = false;
|
|
|
|
|
if (_type != value)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
if (this.DesignMode == true)
|
|
|
|
|
{
|
|
|
|
|
bNewPic = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_type = value;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
ReloadStream();
|
|
|
|
|
this.Refresh();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (_imageStream != null)
|
|
|
|
|
{
|
|
|
|
|
Graphics g = e.Graphics;
|
|
|
|
|
Image img = Image.FromStream(_imageStream);
|
|
|
|
|
|
|
|
|
|
if (bNewPic == true)
|
|
|
|
|
{
|
|
|
|
|
this.Size = img.Size;
|
|
|
|
|
bNewPic = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g.DrawImage(img, 0, 0, this.Width, this.Height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void StraightTube_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (bFirstCreated == true && this.DesignMode == true)
|
|
|
|
|
{
|
|
|
|
|
bNewPic = true;
|
|
|
|
|
bFirstCreated = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|