Exemplo n.º 1
0
        private TextBox m_tbx = new TextBox();                          //Retrieve the textbox
        /// <summary>
        /// Construct a STNode tree control
        /// </summary>
        public STNodeTreeView()
        {
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            this.MinimumSize   = new System.Drawing.Size(100, 60);
            this.Size          = new System.Drawing.Size(200, 150);
            m_items_draw       = m_items_source;
            m_pen              = new Pen(Color.Black);
            m_brush            = new SolidBrush(Color.White);
            m_sf               = new StringFormat();
            m_sf.LineAlignment = StringAlignment.Center;
            m_dt.Pen           = m_pen;
            m_dt.SolidBrush    = m_brush;
            this.ForeColor     = Color.FromArgb(255, 220, 220, 220);
            this.BackColor     = Color.FromArgb(255, 35, 35, 35);
            m_tbx.Left         = 6;
            m_tbx.BackColor    = Color.FromArgb(255, 30, 30, 30);
            m_tbx.ForeColor    = this.ForeColor;
            m_tbx.BorderStyle  = BorderStyle.None;
            m_tbx.MaxLength    = 20;
            m_tbx.TextChanged += new EventHandler(m_tbx_TextChanged);
            this.Controls.Add(m_tbx);
            this.AllowDrop = true;

            this._Editor       = new STNodeEditor();
            this._PropertyGrid = new STNodePropertyGrid();
        }
Exemplo n.º 2
0
        public FrmNodePreviewPanel(Type stNodeType, Point ptHandle, int nHandleSize, bool bRight, STNodeEditor editor, STNodePropertyGrid propertyGrid)
        {
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            if (m_last_frm != null)
            {
                m_last_frm.Close();
            }
            m_last_frm = this;

            m_editor                   = editor;
            m_property                 = propertyGrid;
            m_editor.Size              = new Size(200, 200);
            m_property.Size            = new Size(200, 200);
            m_editor.Location          = new Point(1 + (bRight ? nHandleSize : 0), 1);
            m_property.Location        = new Point(m_editor.Right, 1);
            m_property.InfoFirstOnDraw = true;
            this.Controls.Add(m_editor);
            this.Controls.Add(m_property);
            this.ShowInTaskbar   = false;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Size            = new Size(402 + nHandleSize, 202);

            m_type        = stNodeType;
            m_ptHandle    = ptHandle;
            m_nHandleSize = nHandleSize;
            m_bRight      = bRight;

            this.AutoBorderColor = true;
            this.BorderColor     = Color.DodgerBlue;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Occurs when drawing the property's value area on the property editor
        /// </summary>
        /// <param name="dt">Drawing tool</param>
        protected internal virtual void OnDrawValueRectangle(DrawingTools dt)
        {
            Graphics           g     = dt.Graphics;
            SolidBrush         brush = dt.SolidBrush;
            STNodePropertyGrid ctrl  = this.Control;

            //STNodePropertyItem item = this._PropertyItem;
            brush.Color = ctrl.ItemValueBackColor;

            g.FillRectangle(brush, this.RectangleR);
            Rectangle rect = this.RectangleR;

            rect.Width--; rect.Height--;
            brush.Color = this.Control.ForeColor;
            g.DrawString(this.GetStringFromValue(), ctrl.Font, brush, this.RectangleR, m_sf);

            if (this.PropertyInfo.PropertyType.IsEnum || this.PropertyInfo.PropertyType == m_t_bool)
            {
                g.FillPolygon(Brushes.Gray, new Point[] {
                    new Point(rect.Right - 13, rect.Top + rect.Height / 2 - 2),
                    new Point(rect.Right - 4, rect.Top + rect.Height / 2 - 2),
                    new Point(rect.Right - 9, rect.Top + rect.Height / 2 + 3)
                });
            }
        }
Exemplo n.º 4
0
        public STNodeEditorPannel()
        {
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            m_editor    = new STNodeEditor();
            m_tree      = new STNodeTreeView();
            m_grid      = new STNodePropertyGrid();
            m_grid.Text = "NodeProperty";
            this.Controls.Add(m_editor);
            this.Controls.Add(m_tree);
            this.Controls.Add(m_grid);
            this.Size        = new Size(500, 500);
            this.MinimumSize = new Size(250, 250);
            this.BackColor   = Color.FromArgb(255, 34, 34, 34);

            m_pen = new Pen(this.BackColor, 3);

            Type t   = typeof(ConnectionStatus);
            var  vv  = Enum.GetValues(t);
            var  vvv = vv.GetValue(0);

            foreach (var f in t.GetFields())
            {
                if (!f.FieldType.IsEnum)
                {
                    continue;
                }
                foreach (var a in f.GetCustomAttributes(true))
                {
                    if (!(a is DescriptionAttribute))
                    {
                        continue;
                    }
                    m_dic_status_key.Add((ConnectionStatus)f.GetValue(f), ((DescriptionAttribute)a).Description);
                }
            }

            m_editor.ActiveChanged += (s, e) => m_grid.SetNode(m_editor.ActiveNode);
            m_editor.CanvasScaled  += (s, e) => {
                if (this._ShowScale)
                {
                    m_editor.ShowAlert(m_editor.CanvasScale.ToString("F2"), Color.White, Color.FromArgb(127, 255, 255, 0));
                }
            };
            m_editor.OptionConnected += (s, e) => {
                if (this._ShowConnectionStatus)
                {
                    m_editor.ShowAlert(m_dic_status_key[e.Status], Color.White, e.Status == ConnectionStatus.Connected ? Color.FromArgb(125, Color.Lime) : Color.FromArgb(125, Color.Red));
                }
            };
        }