Esempio n. 1
0
 /// <summary>
 /// Set the STNode node that needs to be displayed
 /// </summary>
 /// <param name="node">target node</param>
 public void SetNode(STNode node)
 {
     if (node == this._STNode)
     {
         return;
     }
     m_nInfoOffsetY = m_nPropertyOffsetY = 0;
     m_nInfoVHeight = m_nPropertyVHeight = 0;
     m_rect_link    = m_rect_help = Rectangle.Empty;
     m_str_desc     = m_str_err = null;
     this._STNode   = node;
     if (node != null)
     {
         m_type           = node.GetType();
         m_lst_item       = this.GetProperties(node);
         m_node_attribute = this.GetNodeAttribute(node);
         this.SetItemRectangle();
         m_b_current_draw_info = m_lst_item.Count == 0 || this._InfoFirstOnDraw;
         if (this._AutoColor)
         {
             this._ItemSelectedColor = this._STNode.TitleColor;
         }
     }
     else
     {
         m_type = null;
         m_lst_item.Clear();
         m_node_attribute = null;
     }
     this.Invalidate();
 }
Esempio n. 2
0
        /// <summary>
        /// Execute the helper function for the corresponding node type
        /// </summary>
        /// <param name="stNodeType">Node Type</param>
        public static void ShowHelp(Type stNodeType)
        {
            var mi = STNodeAttribute.GetHelpMethod(stNodeType);

            if (mi == null)
            {
                return;
            }
            mi.Invoke(null, new object[] { stNodeType.Module.FullyQualifiedName });
        }
Esempio n. 3
0
 /// <summary>
 /// Occurs when the mouse is clicked in the info panel
 /// </summary>
 /// <param name="e">Mouse event parameters</param>
 protected virtual void OnProcessInfoMouseDown(MouseEventArgs e)
 {
     try {
         if (m_rect_link.Contains(e.Location))
         {
             System.Diagnostics.Process.Start(m_node_attribute.Link);
         }
         else if (m_rect_help.Contains(e.Location))
         {
             STNodeAttribute.ShowHelp(m_type);
         }
     } catch (Exception ex) {
         this.SetErrorMessage(ex.Message);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Occurs when drawing node information
        /// </summary>
        /// <param name="dt">Drawing tool</param>
        protected virtual void OnDrawInfo(DrawingTools dt)
        {
            if (m_node_attribute == null)
            {
                return;
            }
            var      attr  = m_node_attribute;
            Graphics g     = dt.Graphics;
            Color    clr_r = Color.FromArgb(this.ForeColor.A / 2, this.ForeColor);

            m_sf.Alignment = StringAlignment.Near;
            Rectangle rect   = new Rectangle(0, this._ShowTitle ? m_nTitleHeight : 0, this.Width, m_item_height);
            Rectangle rect_l = new Rectangle(2, rect.Top, m_nInfoLeft - 2, m_item_height);
            Rectangle rect_r = new Rectangle(m_nInfoLeft, rect.Top, this.Width - m_nInfoLeft, m_item_height);

            m_brush.Color = m_clr_item_2;
            g.FillRectangle(m_brush, rect);
            m_brush.Color    = this.ForeColor;
            m_sf.FormatFlags = StringFormatFlags.NoWrap;
            m_sf.Alignment   = StringAlignment.Near;
            g.DrawString(m_KeysString[0], this.Font, m_brush, rect_l, m_sf);          //author
            m_brush.Color = clr_r;
            g.DrawString(attr.Author, this.Font, m_brush, rect_r, m_sf);
            rect.Y += m_item_height; rect_l.Y += m_item_height; rect_r.Y += m_item_height;

            m_brush.Color = m_clr_item_1;
            g.FillRectangle(m_brush, rect);
            m_brush.Color = this.ForeColor;
            g.DrawString(m_KeysString[1], this.Font, m_brush, rect_l, m_sf);          //mail
            m_brush.Color = clr_r;
            g.DrawString(attr.Mail, this.Font, m_brush, rect_r, m_sf);
            rect.Y += m_item_height; rect_l.Y += m_item_height; rect_r.Y += m_item_height;

            m_brush.Color = m_clr_item_2;
            g.FillRectangle(m_brush, rect);
            m_brush.Color = this.ForeColor;
            g.DrawString(m_KeysString[2], this.Font, m_brush, rect_l, m_sf);          //link_key
            m_brush.Color = clr_r;
            g.DrawString(attr.Link, this.Font, Brushes.CornflowerBlue, rect_r, m_sf); //link
            if (!string.IsNullOrEmpty(attr.Link))
            {
                m_rect_link = rect_r;
            }
            //fill left
            m_brush.Color = Color.FromArgb(40, 125, 125, 125);
            g.FillRectangle(m_brush, 0, this._ShowTitle ? m_nTitleHeight : 0, m_nInfoLeft - 1, m_item_height * 3);

            rect.X     = 5; rect.Y += m_item_height;
            rect.Width = this.Width - 10;
            if (!string.IsNullOrEmpty(m_node_attribute.Description))
            {
                float h = g.MeasureString(m_node_attribute.Description, this.Font, rect.Width).Height;
                rect.Height      = (int)Math.Ceiling(h / m_item_height) * m_item_height;
                m_brush.Color    = clr_r;
                m_sf.FormatFlags = 0;
                g.DrawString(m_node_attribute.Description, this.Font, m_brush, rect, m_sf);
            }
            m_nInfoVHeight = rect.Bottom;
            bool bHasHelp = STNodeAttribute.GetHelpMethod(m_type) != null;

            rect.X         = 5; rect.Y += rect.Height;
            rect.Height    = m_item_height;
            m_sf.Alignment = StringAlignment.Center;
            m_brush.Color  = Color.FromArgb(125, 125, 125, 125);
            g.FillRectangle(m_brush, rect);
            if (bHasHelp)
            {
                m_brush.Color = Color.CornflowerBlue;
            }
            g.DrawString(m_KeysString[3], this.Font, m_brush, rect, m_sf);
            if (bHasHelp)
            {
                m_rect_help = rect;
            }
            else
            {
                int w = (int)g.MeasureString(m_KeysString[3], this.Font).Width + 1;
                int x = rect.X + (rect.Width - w) / 2, y = rect.Y + rect.Height / 2;
                m_pen.Color = m_brush.Color;
                g.DrawLine(m_pen, x, y, x + w, y);
            }
            m_nInfoVHeight = rect.Bottom;
        }