Esempio n. 1
0
 public ParamSetView(IGrapTB grapTb, ISuperTextEdit iSuperTextEdit, CtlDevBaseModel dev)
 {
     InitializeComponent();
     this.IGrapTB    = grapTb;
     this.ISuperEdit = iSuperTextEdit;
     this.CurrDev    = dev;
 }
Esempio n. 2
0
        private bool AnalysisData()
        {
            if (string.IsNullOrEmpty(this.DataSource))
            {
                return(false);
            }
            if (xmlOperater.LoadXmlContent(this.DataSource) == false)
            {
                return(false);
            }
            XmlNodeList nodeList = xmlOperater.GetNodesByName("Item");

            if (nodeList == null)
            {
                return(false);
            }
            for (int i = 0; i < nodeList.Count; i++)
            {
                XmlNode node = nodeList[i];
                if (node == null)
                {
                    continue;
                }
                XmlAttribute nameAttr = xmlOperater.GetProperCollection(node, "name");
                if (nameAttr == null)
                {
                    continue;
                }
                XmlAttribute typeAttr = xmlOperater.GetProperCollection(node, "type");
                if (typeAttr == null)
                {
                    continue;
                }
                XmlAttribute descAttr = xmlOperater.GetProperCollection(node, "desc");
                if (descAttr == null)
                {
                    continue;
                }
                XmlAttribute styleAttr = xmlOperater.GetProperCollection(node, "style");
                if (styleAttr == null)
                {
                    continue;
                }

                string   name   = nameAttr.Value;
                DATATYPE type   = (DATATYPE)Enum.Parse(typeof(DATATYPE), typeAttr.Value);
                string   desc   = descAttr.Value;
                STYLE    style  = (STYLE)Enum.Parse(typeof(STYLE), styleAttr.Value);
                IGrapTB  grapTb = null;
                if (CreateTbox(name, type, node.InnerXml, style, desc, i, ref grapTb) == false)
                {
                    continue;
                }
                this.textboxList.Add(grapTb);
            }
            return(true);
        }
Esempio n. 3
0
        public void SetValue(string name, string value, Graphics graphics)
        {
            IGrapTB grapTb = null;

            if (GetGrapTB(name, ref grapTb) == false)
            {
                return;
            }
            grapTb.SetValue(value, graphics);
        }
Esempio n. 4
0
 private bool GetGrapTB(string name, ref IGrapTB iGrapTb)
 {
     if (this.textboxList == null)
     {
         return(false);
     }
     for (int i = 0; i < this.textboxList.Count; i++)
     {
         if (textboxList[i].Name == name)
         {
             iGrapTb = textboxList[i];
             break;
         }
     }
     return(true);
 }
Esempio n. 5
0
        private void SuperTextEdit_MouseClick(object sender, MouseEventArgs e)
        {
            this.Invalidate();//重绘一次
            Point   pt  = new Point(e.X - this.AutoScrollPosition.X, e.Y - this.AutoScrollPosition.Y);
            IGrapTB pos = GetBttonByPt(pt);

            if (pos != null)
            {
                if (this.PositionsClick != null)
                {
                    this.currSelectedTB = pos;
                    ClickPositionsEventArgs positionsArgs = new ClickPositionsEventArgs();
                    positionsArgs.GrapTbox = pos;
                    PositionsClick.Invoke(this, positionsArgs);
                }
            }
        }
Esempio n. 6
0
        private IGrapTB GetPostionByPt(Point pt)
        {
            IGrapTB pos = null;

            foreach (IGrapTB tb in this.superEditor.TextBoxList)
            {
                if (tb == null)
                {
                    continue;
                }

                if (tb.PosRect.Contains(pt) == true)
                {
                    pos = tb;
                    break;
                }
            }
            return(pos);
        }
Esempio n. 7
0
 private bool IsExistNameInEditor(string name)
 {
     if (this.textboxList == null)
     {
         return(false);
     }
     for (int i = 0; i < this.textboxList.Count; i++)
     {
         IGrapTB grapTb = this.textboxList[i];
         if (grapTb == null)
         {
             return(false);
         }
         if (grapTb.Name == name)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 8
0
        private IGrapTB GetBttonByPt(Point pt)
        {
            IGrapTB pos = null;

            foreach (IGrapTB tb in this.superEditor.TextBoxList)
            {
                if (tb == null)
                {
                    continue;
                }

                if (tb.Style == STYLE.EDITOR)
                {
                    GrapTBEditor tbEditor = tb as GrapTBEditor;
                    if (tbEditor.ButtonArea.Contains(pt) == true)
                    {
                        pos = tb;
                        break;
                    }
                }
            }
            return(pos);
        }
Esempio n. 9
0
        private bool CreateTbox(string name, DATATYPE type, string value, STYLE style, string desc, int index, ref IGrapTB grapTb)
        {
            if (IsExistNameInEditor(name) == true)
            {
                return(false);
            }
            if (style == STYLE.EDITOR)
            {
                grapTb = new GrapTBEditor();
            }
            else if (style == STYLE.DEFAULT)
            {
                grapTb = new GrapTB();
            }
            else
            {
                return(false);
            }

            grapTb.Name          = name;
            grapTb.ValueDataType = type;
            grapTb.Value         = value;
            grapTb.Style         = style;
            grapTb.Index         = index;
            grapTb.Desc          = desc;
            double rowthTemp = (1.0 + index) / this.columnNum;

            grapTb.Rowth = (int)Math.Ceiling(rowthTemp);
            int colthTemp = (index + 1) % this.columnNum;

            if (colthTemp == 0)
            {
                grapTb.Colth = this.columnNum;
            }
            else
            {
                grapTb.Colth = colthTemp;
            }
            int x = startPos.X + grapTb.Size.Width * (grapTb.Colth - 1) + (grapTb.Colth - 1) * this.columnInterval;
            int y = startPos.Y + grapTb.Size.Height * (grapTb.Rowth - 1) + (grapTb.Rowth - 1) * this.rowInterval;

            grapTb.Location = new Point(x, y);
            grapTb.PosRect  = new Rectangle(grapTb.Location, grapTb.Size);

            return(true);
        }