ningshuxia
2025-03-27 afbafeecc1325bff849a17fb63b9b2b65b48ddf1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using DevExpress.XtraEditors.Controls;
using HStation.Vmo;
using System.Data;
 
namespace HStation.WinFrmUI
{
    public partial class PhartDiagramRelationListCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public PhartDiagramRelationListCtrl()
        {
            InitializeComponent();
        }
 
        /// <summary>
        /// 边框可见性
        /// </summary>
        public bool BorderVisible
        {
            get
            {
                return this.imageListBoxControl1.BorderStyle != BorderStyles.NoBorder;
            }
            set
            {
                this.imageListBoxControl1.BorderStyle = value ? BorderStyles.Default : BorderStyles.NoBorder;
            }
        }
 
        /// <summary>
        /// 选择改变事件
        /// </summary>
        public event Action<PhartDiagramRelationVmo> SelectedChangedEvent;
 
        private List<PhartDiagramRelationListItemViewModel> _allBindingList = null;
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(List<PhartDiagramRelationVmo> allList)
        {
            _allBindingList = new List<PhartDiagramRelationListItemViewModel>();
            allList?.OrderBy(x => x.SortCode).ToList()
                .ForEach(x => _allBindingList.Add(new PhartDiagramRelationListItemViewModel(x)));
            this.phartDiagramRelationListItemViewModelBindingSource.DataSource = _allBindingList;
            this.phartDiagramRelationListItemViewModelBindingSource.ResetBindings(false);
        }
 
        //选择改变
        private void imageListBoxControl1_SelectedValueChanged(object sender, EventArgs e)
        {
            if (_allBindingList == null)
            {
                return;
            }
            var item = this.imageListBoxControl1.SelectedItem;
            var vm = item as PhartDiagramRelationListItemViewModel;
            if (vm == null)
            {
                return;
            }
            this.SelectedChangedEvent?.Invoke(vm.Vmo);
        }
 
        private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
        {
            if (e.SelectedControl == this.imageListBoxControl1)
            {
                //e.Info = new ToolTipControlInfo(item, tooltipText);
            }
        }
 
    }
}