// *********************************************************************** // Assembly : HZH_Controls // Created : 2019-09-11 // // *********************************************************************** // // Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com // // // Blog: https://www.cnblogs.com/bfyx // GitHub:https://github.com/kwwwvagaa/NetWinformControl // gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git // // If you use this code, please keep this note. // *********************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace HZH_Controls.Controls { /// /// Class UCMindMappingPanel. /// Implements the /// /// [DefaultEvent("ItemClicked")] public partial class UCMindMappingPanel : UserControl { /// /// The item context menu strip /// private ContextMenuStrip itemContextMenuStrip; /// /// Gets or sets the item context menu strip. /// /// The item context menu strip. [Description("节点关联的右键菜单"), Category("自定义")] public ContextMenuStrip ItemContextMenuStrip { get { return itemContextMenuStrip; } set { itemContextMenuStrip = value; this.ucMindMapping1.ItemContextMenuStrip = value; } } /// /// The item backcolor /// private Color itemBackcolor = Color.FromArgb(255, 77, 59); /// /// Gets or sets the item backcolor. /// /// The item backcolor. [Description("节点背景色,优先级小于数据源中设置的背景色"), Category("自定义")] public Color ItemBackcolor { get { return itemBackcolor; } set { itemBackcolor = value; this.ucMindMapping1.ItemBackcolor = value; } } /// /// The data source /// private MindMappingItemEntity dataSource; /// /// Gets or sets the data source. /// /// The data source. [Description("数据源"), Category("自定义")] public MindMappingItemEntity DataSource { get { return dataSource; } set { dataSource = value; this.ucMindMapping1.DataSource = value; } } /// /// Gets or sets the data source. /// /// The data source. [Description("数据源"), Category("自定义")] public event EventHandler ItemClicked; /// /// The line color /// private Color lineColor = Color.Black; /// /// Gets or sets the color of the line. /// /// The color of the line. [Description("线条颜色"), Category("自定义")] public Color LineColor { get { return lineColor; } set { lineColor = value; this.ucMindMapping1.LineColor = value; } } /// /// Gets the select entity. /// /// The select entity. [Description("选中的数据源"), Category("自定义")] public MindMappingItemEntity SelectEntity { get { return ucMindMapping1.SelectEntity; } } /// /// Initializes a new instance of the class. /// public UCMindMappingPanel() { this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.Selectable, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.UserPaint, true); InitializeComponent(); ucMindMapping1.ItemClicked += ucMindMapping1_ItemClicked; } /// /// Handles the ItemClicked event of the ucMindMapping1 control. /// /// The source of the event. /// The instance containing the event data. void ucMindMapping1_ItemClicked(object sender, EventArgs e) { if (ItemClicked != null) { ItemClicked(sender, e); } } } }