123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Net;
- using System.Numerics;
- using System.Windows.Forms;
- namespace OTSMeasureApp
- {
-
- public class CDisplayGDIObject
- {
- public CDisplayGDIObject()
- {
-
- ID = System.Guid.NewGuid().ToString();
- OTSX = -1;
- OTSY = -1;
- }
- /// <summary>
- /// 创建图形
- /// </summary>
- /// <param name="startx">X位置</param>
- /// <param name="starty">Y位置</param>
- /// <param name="width">宽度</param>
- /// <param name="height">高度</param>
- /// <param name="cType">图形类型:createType=0 圆角矩形 createType=1 圆形 createType=2 文字</param>
- /// <param name="content">文字内容</param>
- public CDisplayGDIObject(float startx, float starty, float width, float height, GDIType cType, string content, string name)
- {
- var rec = new RectangleF(startx, starty, width, height);
- m_OrigineRegionF = rec;
- SetInitRegionF(m_OrigineRegionF);
- GDIType = cType;
- strContent = content;
- HoleNo = name;
- ID = System.Guid.NewGuid().ToString();
- OTSX = -1;
- OTSY = -1;
- }
- public CDisplayGDIObject(RectangleF rect, GDIType cType)
- {
-
- m_OrigineRegionF = rect;
- SetInitRegionF(m_OrigineRegionF);
- GDIType = cType;
- ID = System.Guid.NewGuid().ToString();
- selColor=Color.White;
- OTSX = -1;
- OTSY = -1;
- }
- public CDisplayGDIObject(RectangleF rect, GDIType cType, string name)
- {
-
- m_OrigineRegionF = rect;
- SetInitRegionF(m_OrigineRegionF);
- GDIType = cType;
- HoleNo = name;
- ID = System.Guid.NewGuid().ToString();
- OTSX = -1;
- OTSY = -1;
- }
-
- public CDisplayGDIObject(RectangleF rect, GDIType cType, string name, Color selColor)
- {
-
- m_OrigineRegionF = rect;
- SetInitRegionF(m_OrigineRegionF);
- GDIType = cType;
- HoleNo = name;
-
- SelColor = selColor;
- ID = System.Guid.NewGuid().ToString();
- OTSX = -1;
- OTSY = -1;
- }
-
- //绘制小矩形
- public CDisplayGDIObject(RectangleF rectSingle, GDIType cType, string name, string sampleName, Color selColor)
- {
-
- m_OrigineRegionF = rectSingle;
- SetInitRegionF(m_OrigineRegionF);
- GDIType = cType;
- HoleNo = name;
-
- SelColor = selColor;
- SampleName = sampleName;
- ID = System.Guid.NewGuid().ToString();
- OTSX = -1;
- OTSY = -1;
- }
-
- /// <summary>
- /// 获取样品孔中BSE图像
- /// </summary>
- /// <param name="rect">位置大小</param>
- /// <param name="sampleHoleName">所在样品孔名称</param>
- /// <param name="bseImage">图像信息</param>
- /// <param name="bseImageWitdh">图像宽度</param>
- /// <param name="bseImageHeight">图像高度</param>
- /// <param name="drawImageLocation">图像开始位置</param>
- /// <param name="cType">绘制类型</param>
- public CDisplayGDIObject(RectangleF rect, int OTSx, int OTSy, string sampleName, string sampleHoleName, float bseImageWitdh, float bseImageHeight, GDIType cType)
- {
-
- m_OrigineRegionF = rect;
- SetInitRegionF(m_OrigineRegionF);
- HoleNo = sampleHoleName;
- SampleName = sampleName;
- //生成编号
- ID = System.Guid.NewGuid().ToString();
-
- //图像宽度
- BSEImageWitdh = bseImageWitdh;
- //图像高度
- BSEImageHeight = bseImageHeight;
- //图像位置
- BSEImageLocation = rect.Location;
- OTSX = OTSx;
- OTSY = OTSy;
- //绘制类型
- GDIType = cType;
- }
- #region 变量重写
- public virtual void OnPaint(PaintEventArgs e)
- {
- if (createType == GDIType.StageBoundary_RoundedRectangle)
- {
- //获取颜色
- Color myColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.RoundRectangleColor);
-
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
- GraphicsPath grPath = CreateRoundedRectanglePath(m_RegionF, 20);
-
- e.Graphics.FillPath(sampleBrush, grPath);
- e.Graphics.DrawPath(Pens.Black, grPath);
- }
-
- //圆形
- else if (createType == GDIType.Circle)
- {
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(this.selColor);
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //图片柔顺模式选择
- e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
- e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
- e.Graphics.FillEllipse(sampleBrush, m_RegionF);
- e.Graphics.DrawEllipse(Pens.Black, m_RegionF);
- }
- //文字
- else if (createType == GDIType.Text)
- {
- //设置文字对齐方式
- StringFormat sf = new StringFormat();
- sf.Alignment = StringAlignment.Center;
- sf.LineAlignment = StringAlignment.Center;
- //文字颜色
- Color myColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.FontColor);
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
- SolidBrush solidBrush = new SolidBrush(Color.FromArgb(50, Color.Black));
- //字体大小 根据样品孔Rectangle大小
- float fontSize = m_RegionF.Width / 2;
- Font font = new Font("宋体", fontSize, FontStyle.Regular);
- if (fontSize == 0)
- {
- font = new Font("宋体", 5, FontStyle.Regular);
- }
- //消除锯齿
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //图片柔顺模式选择
- e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
- e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
- e.Graphics.DrawString(strContent, font, sampleBrush, m_RegionF, sf);
-
-
- }
- //矩形
- else if (createType == GDIType.Rectangle)
- {
- Color myColor = System.Drawing.Color.White;
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //图片柔顺模式选择
- e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
- e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
- e.Graphics.FillRectangle(sampleBrush, m_RegionF);
- var m_Region = new Rectangle();
- m_Region.X = (int)m_RegionF.X;
- m_Region.Y = (int)m_RegionF.Y;
- m_Region.Width = (int)m_RegionF.Width;
- m_Region.Height = (int)m_RegionF.Height;
- e.Graphics.DrawRectangle(Pens.Black, m_Region);
- }
-
- //绘制帧图 直线
- else if (createType == GDIType.SingleLine)
- {
- //设置颜色
- Color myColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.FieldColor);
-
- //设置画笔
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
- Pen pen = new Pen(sampleBrush, 0.0001f);
- //未抗锯齿
- e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
- e.Graphics.InterpolationMode = InterpolationMode.Default;
- e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
- //设置直线位置与尺寸
- PointF startPointF = new PointF(startPoint.X, startPoint.Y);
- PointF endPointF = new PointF(endPoint.X, endPoint.Y);
- //度量单位
- e.Graphics.PageUnit = GraphicsUnit.Display;
- e.Graphics.DrawLine(pen, startPointF, endPointF);
- }
- //绘制标样
- else if (createType == GDIType.SpecimenRectangle)
- {
- Color myColor = System.Drawing.Color.Black;
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
- Pen pen = new Pen(sampleBrush, 0.0001f);
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
- var m_Region = new Rectangle();
- m_Region.X = (int)m_RegionF.X;
- m_Region.Y = (int)m_RegionF.Y;
- m_Region.Width = (int)m_RegionF.Width;
- m_Region.Height = (int)m_RegionF.Height;
- e.Graphics.DrawRectangle(pen, m_Region);
- e.Graphics.FillRectangle(sampleBrush, m_RegionF);
- }
- //绘制标样
- else if (createType == GDIType.SpecimenCircle)
- {
- Color myColor = System.Drawing.Color.Black;
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
- Pen pen = new Pen(sampleBrush, 0.0001f);
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
- e.Graphics.DrawEllipse(pen, m_RegionF);
- e.Graphics.FillEllipse(sampleBrush, m_RegionF);
- }
-
-
- //绘制样品孔BSE图像
- else if (createType == GDIType.DrawFrameOfHoleBSEImage)
- {
-
-
- PointF startPointF = new PointF(m_RegionF.Left, m_RegionF.Top);
- PointF endPointF = new PointF(m_RegionF.Right + 2, m_RegionF.Bottom + 2);
- //绘制样品孔中图像信息
- //if (BSEImage != null)
- //{
- // Image thumbnail = BSEImage.GetThumbnailImage((int)m_RegionF.Width + 2,(int)m_RegionF.Height + 2, null, IntPtr.Zero);
- // e.Graphics.DrawImage(thumbnail, startPointF);/*, startPointF.X, startPointF.Y, endPointF.X - startPointF.X, endPointF.Y - startPointF.Y*/
- //}
- if (BSEImage != null)
- {
- e.Graphics.DrawImage(BSEImage, startPointF.X, startPointF.Y, endPointF.X - startPointF.X, endPointF.Y - startPointF.Y);
- }
- }
-
-
- else if (createType == GDIType.DrawPolygonFinish)
- {
- Color myColor = selColor;
- Pen pen = new Pen(myColor, 1);
- var m_Region = new Rectangle();
- m_Region.X = (int)m_RegionF.X;
- m_Region.Y = (int)m_RegionF.Y;
- m_Region.Width = (int)m_RegionF.Width;
- m_Region.Height = (int)m_RegionF.Height;
- e.Graphics.DrawRectangle(pen, m_Region);
- }
-
- }
-
- public Image BSEImage
- {
- get { return bseImage; }
- set { bseImage = value; }
- }
- public float BSEImageWitdh
- {
- get { return bseImageWidth; }
- set { bseImageWidth = value; }
- }
- public float BSEImageHeight
- {
- get { return bseImageHeight; }
- set { bseImageHeight = value; }
- }
- public PointF BSEImageLocation
- {
- get { return bseImageLocation; }
- set { bseImageLocation = value; }
- }
- public Color LineColor
- {
- get { return lineColor; }
- set { lineColor = value; }
- }
- public float LineLength
- {
- get { return lineLength; }
- set { lineLength = value; }
- }
- public PointF LineStartPoint
- {
- get { return lineStartPoint; }
- set { lineStartPoint = value; }
- }
-
- public int OTSX
- {
- get { return otsX; }
- set { otsX = value; }
- }
- public int OTSY
- {
- get { return otsY; }
- set { otsY = value; }
- }
- public GDIType GDIType
- {
- get { return createType; }
- set { createType = value; }
- }
-
- public Color SelColor
- {
- get { return selColor; }
- set { selColor = value; }
- }
- public string HoleNo//holename when they are not field rectangle gdi object.
- {
- get { return nameOrHoleName; }
- set { nameOrHoleName = value; }
- }
- public string ID
- {
- get { return id; }
- set { id = value; }
- }
- public string SampleName
- {
- get { return sampleName; }
- set { sampleName = value; }
- }
- public int SampleCount
- {
- get { return sampleCount; }
- set { sampleCount = value; }
- }
- public string StrContent
- {
- get { return strContent; }
- set { strContent = value; }
- }
- public RectangleF GetZoomedRegion
- {
-
- get {
- var m_Region = new RectangleF();
- m_Region.X = m_RegionF.X;
- m_Region.Y = m_RegionF.Y;
- m_Region.Width = m_RegionF.Width;
- m_Region.Height = m_RegionF.Height;
- return m_Region;
- }
-
- }
- public List<PointF> GetVertexPoints()
- {
- List<PointF> vertexPoint = new List<PointF>();
- var region = this.GetZoomedRegionF();
- vertexPoint.Add(region.Location);
- vertexPoint.Add(new PointF(region.X, region.Y + region.Height));
- vertexPoint.Add(new PointF(region.X + region.Width, region.Y));
- vertexPoint.Add(new PointF(region.X + region.Width, region.Y + region.Height));
- return vertexPoint;
- }
- public List<PointF> GetOriginalRegionVertexPoints()
- {
- List<PointF> vertexPoint = new List<PointF>();
- var region = this.GetOrigionalDrawRegionF();
- vertexPoint.Add(region.Location);
- vertexPoint.Add(new PointF(region.X, region.Y + region.Height));
- vertexPoint.Add(new PointF(region.X + region.Width, region.Y));
- vertexPoint.Add(new PointF(region.X + region.Width, region.Y + region.Height));
- return vertexPoint;
- }
- public RectangleF GetZoomedRegionF()
- {
- return m_RegionF;
- }
- public void SetInitRegionF(RectangleF OrigineRegionF)//not zoomed regine value
- {
-
- float x1, y1;
- x1 = OrigineRegionF.X * m_zoomNum + m_refPoint.X;
- y1 = OrigineRegionF.Y * m_zoomNum + m_refPoint.Y;
- float w1, h1;
- w1 = OrigineRegionF.Width * m_zoomNum;
- h1 = OrigineRegionF.Height * m_zoomNum;
- m_OrigineRegionF = OrigineRegionF;
- m_RegionF = new RectangleF(x1, y1, w1, h1);
- }
- internal void SetZoomedRegionF(RectangleF scaleRectangleF)
- {
- float x1, y1;
- x1 = (scaleRectangleF.X-m_refPoint.X) / m_zoomNum ;
- y1 = (scaleRectangleF.Y-m_refPoint.Y) / m_zoomNum ;
- float w1, h1;
- w1 = scaleRectangleF.Width / m_zoomNum;
- h1 = scaleRectangleF.Height / m_zoomNum;
- m_OrigineRegionF = new RectangleF(x1, y1, w1, h1);
- m_RegionF = scaleRectangleF;
- }
-
- public RectangleF GetOrigionalDrawRegionF()
- { return m_OrigineRegionF; }
-
- public virtual GraphicsPath GetGPath()
- {
- var measureItem = this;
- //重新绘制测量区域路径
- GraphicsPath GPath = new GraphicsPath();
-
- if (measureItem.GDIType == GDIType.Circle)
- {
- GPath.AddEllipse(GetZoomedRegionF());
- }
- else
- {
- GPath.AddRectangle(GetZoomedRegionF());
- }
-
-
- return GPath;
- }
-
-
- public Point GetZoomedCenterPoint()
- {
- Point pCenterPoint = new Point();
- //获取在工作窗口中X,Y位置
- pCenterPoint.X = (int)(this.GetZoomedRegion.X + this.GetZoomedRegion.Width / 2);
- pCenterPoint.Y = (int)(this.GetZoomedRegion.Y + this.GetZoomedRegion.Height / 2);
- return pCenterPoint;
- }
- public PointF GetCenterPoint()
- {
- PointF pCenterPoint = new PointF();
- //获取在工作窗口中X,Y位置
- pCenterPoint.X = (this.GetOrigionalDrawRegionF().X + this.GetOrigionalDrawRegionF().Width / 2);
- pCenterPoint.Y = (this.GetOrigionalDrawRegionF().Y + this.GetOrigionalDrawRegionF().Height / 2);
- return pCenterPoint;
- }
- #endregion
-
- public bool IsDragging
- {
- get { return m_IsDragging; }
- set { m_IsDragging = value; }
- }
- public bool IsAltering// changing the size by gui operating.
- {
- get { return m_IsAlter; }
- set { m_IsAlter = value; }
- }
- public bool IsWorkSample
- {
- get { return m_IsWorkSample; }
- set { m_IsWorkSample = value; }
- }
- virtual public PointF DraggingPoint
- {
- get { return m_DraggingPoint; }
- set {
-
- m_DraggingPoint = value;
-
- }
- }
-
- public bool IsMoving { get => m_IsMoving; set => m_IsMoving = value; }
- public PointF GetDisplayRefPoint()
- { return m_refPoint; }
- public void SetDisplayRefPoint(PointF value)
- {
- m_refPoint = value;
- SetInitRegionF(m_OrigineRegionF);
-
- }
- public float GetZoomNumber()
- { return m_zoomNum; }
- virtual public void SetZoomNumber(float value)
- {
- m_zoomNum = value;
- SetInitRegionF(m_OrigineRegionF);
-
- }
- #region 画圆角矩形
- internal static GraphicsPath CreateRoundedRectanglePath(RectangleF rect, int cornerRadius)
- {
- GraphicsPath roundedRect = new GraphicsPath();
- roundedRect.AddArc(rect.X, rect.Y, cornerRadius * 2, cornerRadius * 2, 180, 90);
- roundedRect.AddLine(rect.X + cornerRadius, rect.Y, rect.Right - cornerRadius * 2, rect.Y);
- roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y, cornerRadius * 2, cornerRadius * 2, 270, 90);
- roundedRect.AddLine(rect.Right, rect.Y + cornerRadius * 2, rect.Right, rect.Y + rect.Height - cornerRadius * 2);
- roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y + rect.Height - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 0, 90);
- roundedRect.AddLine(rect.Right - cornerRadius * 2, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom);
- roundedRect.AddArc(rect.X, rect.Bottom - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 90, 90);
- roundedRect.AddLine(rect.X, rect.Bottom - cornerRadius * 2, rect.X, rect.Y + cornerRadius * 2);
- roundedRect.CloseFigure();
- return roundedRect;
- }
- public bool IfZoomContains(Point mousePoint)
- {
- if (mousePoint.X > m_RegionF.Left && mousePoint.X < m_RegionF.Left + m_RegionF.Width)
- {
- if (mousePoint.Y > m_RegionF.Top && mousePoint.Y < m_RegionF.Top + m_RegionF.Height)
- {
- return true;
-
- }
-
-
- }
- return false;
- }
- public bool IfContains(PointF thePoint)
- {
- if (thePoint.X > m_OrigineRegionF.Left && thePoint.X < m_OrigineRegionF.Left + m_OrigineRegionF.Width)
- {
- if (thePoint.Y > m_OrigineRegionF.Top && thePoint.Y < m_OrigineRegionF.Top + m_OrigineRegionF.Height)
- {
- return true;
- }
- }
- return false;
- }
-
- virtual public void Zoom(PointF mousePoint, float zoomNum)
- {
- float X1;
- float curZoom = m_zoomNum;
- float deltaZoom = zoomNum - curZoom;
- float Y1;
- if (zoomNum == 1)
- {
- m_zoomNum = 1;
- m_RegionF = m_OrigineRegionF;
- m_refPoint = new PointF(0, 0);
-
- }
- else
- {
-
- X1 = (m_RegionF.X - mousePoint.X) / curZoom * deltaZoom + m_RegionF.X;
- Y1 = (m_RegionF.Y - mousePoint.Y) / curZoom * deltaZoom + m_RegionF.Y;
- m_refPoint.X = (m_refPoint.X - mousePoint.X) / curZoom * deltaZoom + m_refPoint.X;
- m_refPoint.Y = (m_refPoint.Y - mousePoint.Y) / curZoom * deltaZoom + m_refPoint.Y;
- float Width = GetOrigionalDrawRegionF().Width * zoomNum;
- float Height = GetOrigionalDrawRegionF().Height * zoomNum;
- m_RegionF = new RectangleF(X1, Y1, Width, Height);
- m_zoomNum = zoomNum;
- }
-
-
- BSEImageWitdh = m_RegionF.Width;
- BSEImageHeight = m_RegionF.Height;
- BSEImageLocation = m_RegionF.Location;
-
-
- }
-
- virtual public void Move(PointF location)
- {
-
- PointF offset = new PointF(location.X - DraggingPoint.X, location.Y - DraggingPoint.Y);
- float X1;
- float Y1;
- X1 = (m_RegionF.X + offset.X);
- Y1 = (m_RegionF.Y + offset.Y);
- m_RegionF = new RectangleF(X1, Y1, m_RegionF.Width, m_RegionF.Height);
-
- m_refPoint.X = m_refPoint.X + offset.X;
- m_refPoint.Y = m_refPoint.Y + offset.Y;
- BSEImageWitdh = m_RegionF.Width;
- BSEImageHeight = m_RegionF.Height;
- BSEImageLocation = m_RegionF.Location;
-
- LineStartPoint = m_RegionF.Location;
- m_DraggingPoint = new Point((int)location.X,(int)location.Y);
-
- }
- virtual public void PositionAltering(PointF location,bool ifZoomCoord)
- {
- PointF offset = new PointF(location.X - DraggingPoint.X, location.Y - DraggingPoint.Y);
- PointF realShift;
- if (ifZoomCoord)
- {
- realShift = new PointF(offset.X / m_zoomNum, offset.Y / m_zoomNum);
- }
- else
- {
- realShift = new PointF(offset.X , offset.Y );
- }
-
-
- m_OrigineRegionF = new RectangleF(m_OrigineRegionF.X+realShift.X, m_OrigineRegionF.Y+realShift.Y, m_OrigineRegionF.Width, m_OrigineRegionF.Height);
- SetInitRegionF(m_OrigineRegionF);
- BSEImageWitdh = m_RegionF.Width;
- BSEImageHeight = m_RegionF.Height;
- BSEImageLocation = m_RegionF.Location;
-
- LineStartPoint = m_RegionF.Location;
- m_DraggingPoint = new Point((int)location.X, (int)location.Y);
-
- }
- public CDisplayGDIObject Duplicate()
- {
- CDisplayGDIObject r = new CDisplayGDIObject();
- r.HoleNo = this.nameOrHoleName;
- r.SampleName = this.SampleName;
- r.m_OrigineRegionF = this.m_OrigineRegionF;
-
- r.IsWorkSample = this.IsWorkSample;
- r.m_RegionF = this.m_RegionF;
-
- r.m_refPoint = this.m_refPoint;
- r.m_zoomNum = this.m_zoomNum;
-
-
- r.createType = this.createType;
-
- return r;
- }
-
- #endregion
- //是否设置为选择样品
- private bool m_IsAlter;
- //是否存在帧图信息
-
- //是否设置为拖动
- private bool m_IsDragging;
- private bool m_IsMoving;
- //是否为工作样品
- private bool m_IsWorkSample;
- private GDIType createType;
-
- private string id;
- protected string nameOrHoleName="";
- public string sampleName="";
- //样品孔中样品的数量
- public int sampleCount = 0;
- public string strContent;
-
- protected PointF m_DraggingPoint;
- protected Color selColor;
- protected RectangleF m_RegionF;
- //绘制时与移动缩放时记录的位置与尺寸
- protected RectangleF m_OrigineRegionF;
-
-
-
- //绘制颗粒图
- private Color lineColor;
- private float lineLength;
- private PointF lineStartPoint;
- private int otsX;
- private int otsY;
- //绘制样品孔BSE图像
- private Image bseImage;
- //绘制样品孔BSE图像宽度
- private float bseImageWidth;
- //绘制样品孔BSE图像高度
- private float bseImageHeight;
- //绘制样品孔BSE图像位置
- private PointF bseImageLocation;
- private PointF startPoint;
- private PointF endPoint;
-
-
- protected float m_zoomNum=1;
- protected PointF m_refPoint=new PointF(0,0);
-
- }
-
- public enum XYIndex
- {
- X = 0,
- Y = 1
- }
-
- public enum GDIType
- {
-
- //圆形
- Circle = 0,
- //圆角矩形
- StageBoundary_RoundedRectangle = 1,
- //样品孔中的文字
- Text = 2,
- //矩形
- Rectangle = 3,
- //样品孔背景
- CorrelateSampleHoleBackGround = 4,//every sample area has a sample hole correlation.
-
- //帧图-直线绘制方式
- SingleLine = 6,
- //表样-矩形
- SpecimenRectangle = 7,
- //表样-圆形
- SpecimenCircle = 8,
-
- DrawFrameOfHoleBSEImage = 9,
-
-
- //多边形完成标识
- DrawPolygonFinish = 11,
-
- SampleHoleImageBuffer=12
- }
-
-
- public enum ColorType
- {
- FieldColor,//帧图fd8f8f
- RoundRectangleColor,//c8c8c8圆角矩形
- SampleBackGroundColor,//c0c0c0圆角矩形
- FontColor,//90ee90文字颜色
- SampleColor,//f4f4f4 样品未选择
- SampleSelColor//505050 样品选择后
- }
-
- public enum GrayLevel
- {
- Min=0,
- Max=255
- }
- }
|