wenxiangchao
2026-11-02 9d1660270272180cd71147d6ddd53d1382643d2e
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
using HMI.Base;
using HMI.UI.DpUtil;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
 
namespace Plugin.TsExecution
{
    public class ScreenGridConfig
    {
        public int rows { get; set; }
        public int columns { get; set; }
        public ObservableCollection<bool> values { get; set; }
    }
 
    /// <summary>
    /// ScreenTouch.xaml 的交互逻辑
    /// </summary>
    public partial class ScreenGrid : NotifyControl
    {
        public ScreenGrid(int rows, int columns)
        {
            InitializeComponent();
 
            for (int i = 0; i < rows; i++)
            {
                grid.RowDefinitions.Add(new RowDefinition());
            }
 
            for (int i = 0; i < columns; i++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto});
            }
        }
 
        public void AddScreen(ScreenTouch screen, int row, int col)
        {
            grid.Children.Add(screen);
            Grid.SetRow(screen, row);
            Grid.SetColumn(screen, col);
 
            GridHelper.RefreshGridSpace(grid);
        }
    }
}