当前位置:网站首页>Visual upper system design and development (Halcon WinForm) -2 Global variable design
Visual upper system design and development (Halcon WinForm) -2 Global variable design
2022-07-03 15:19:00 【11eleven】
There will be a lot of data to be transferred in the system , And trigger or store transmission , Here we introduce custom global variables to meet this requirement , First, design the global variable data object .
/// <summary>
/// Global variables
/// </summary>
public class GlobalVariableModel
{
public VariableTypeEnum VariableType { set; get; }
public string VariableName { set; get; }
public object VariableValue { set; get; }
public string Remark { set; get; }
}
public enum VariableTypeEnum
{
String = 0,
Int = 1,
Float = 2,
Decimal = 3,
Short = 4,
Bool = 5
}
Contains data types 、 Variable name 、 A variable's value 、 remarks . Global variables are directly mounted under the scheme . The variables of a scheme contain multiple , So it's a List aggregate .
Variables run through every node You can use , Trigger from node After execution to the node , And data result Association will be used .
The maintenance interface adopts code dynamic drawing panel The text box Drop down box button, etc , Custom variables and so on . The code is as follows
private VariableControlModel AddTriggerControl()
{
FlowLayoutPanel triggerPanel = new FlowLayoutPanel();
triggerPanel.BorderStyle = BorderStyle.FixedSingle;
triggerPanel.FlowDirection = FlowDirection.LeftToRight;
triggerPanel.Width = FlowPanelVariable.Width - 10;
triggerPanel.Height = 42;
Label variableLabel = new Label();
variableLabel.Text = " Variable ";
variableLabel.Height = triggerPanel.Height;
variableLabel.AutoSize = false;
variableLabel.Width = 50;
variableLabel.TextAlign = ContentAlignment.MiddleRight;
TextBox textBoxName = new TextBox();
textBoxName.Width = 80;
// type
Label variableTypeLabel = new Label();
variableTypeLabel.Text = " type ";
variableTypeLabel.Height = triggerPanel.Height;
variableTypeLabel.AutoSize = false;
variableTypeLabel.Width = 50;
variableTypeLabel.TextAlign = ContentAlignment.MiddleRight;
ComboBox comboBox = new ComboBox();
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox.ValueMember = "Value";
comboBox.DisplayMember = "Name";
comboBox.Items.AddRange(typeList.ToArray());// (typeList.MapToList<VariableTypeModel>().ToArray());
//comboBox.SelectedItem = item.Key;
Label variableValueLabel = new Label();
variableValueLabel.Text = " value ";
variableValueLabel.Height = triggerPanel.Height;
variableValueLabel.TextAlign = ContentAlignment.MiddleRight;
variableValueLabel.AutoSize = false;
variableValueLabel.Width = 30;
TextBox textBox = new TextBox();
textBox.Width = 100;
Label variableRemarkLabel = new Label();
variableRemarkLabel.Text = " remarks ";
variableRemarkLabel.Height = triggerPanel.Height;
variableRemarkLabel.TextAlign = ContentAlignment.MiddleRight;
variableRemarkLabel.AutoSize = false;
variableRemarkLabel.Width = 50;
TextBox textBoxRemark = new TextBox();
textBoxRemark.Width = 250;
Button button = new Button();
button.Text = " remove ";
button.Width = 50;
button.Height = 32;
button.Click += Button_Click; ;
//textBox.Text = item.Value;
var model = new VariableControlModel()
{
FlowLayoutPanel = triggerPanel,
VariableType = comboBox,
VariableValueBox = textBox,
VariableNameBox = textBoxName,
VariableRemarkBox = textBoxRemark,
};
VariableControlModels.Add(model);
triggerPanel.Controls.Add(variableLabel);
triggerPanel.Controls.Add(textBoxName);
triggerPanel.Controls.Add(variableTypeLabel);
triggerPanel.Controls.Add(comboBox);
triggerPanel.Controls.Add(variableValueLabel);
triggerPanel.Controls.Add(textBox);
triggerPanel.Controls.Add(variableRemarkLabel);
triggerPanel.Controls.Add(textBoxRemark);
triggerPanel.Controls.Add(button);
FlowPanelVariable.Controls.Add(triggerPanel);
return model;
}
The container uses FlowPanel , It can automatically flow layout Control to panel Will be automatically added later , It's more convenient .
Well, the above is the design idea of global variables .
边栏推荐
- [combinatorics] permutation and combination (set permutation, step-by-step processing example)
- [daily training] 395 Longest substring with at least k repeated characters
- Redis single thread problem forced sorting layman literacy
- Global and Chinese market of trimethylamine 2022-2028: Research Report on technology, participants, trends, market size and share
- 【云原生训练营】模块七 Kubernetes 控制平面组件:调度器与控制器
- Tensorflow realizes verification code recognition (I)
- Using Tengine to solve the session problem of load balancing
- Relationship between truncated random distribution and original distribution
- Besides lying flat, what else can a 27 year old do in life?
- Global and Chinese markets for indoor HDTV antennas 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
解决pushgateway数据多次推送会覆盖的问题
Leasing cases of the implementation of the new regulations on the rental of jointly owned houses in Beijing
[cloud native training camp] module 7 kubernetes control plane component: scheduler and controller
Popular understanding of gradient descent
Yolov5系列(一)——網絡可視化工具netron
Concurrency-01-create thread, sleep, yield, wait, join, interrupt, thread state, synchronized, park, reentrantlock
Final review points of human-computer interaction
Popular understanding of linear regression (I)
Visual upper system design and development (Halcon WinForm) -1 Process node design
Tensorflow realizes verification code recognition (I)
随机推荐
XWiki Installation Tips
mysql innodb 存储引擎的特性—行锁剖析
详解指针进阶2
Functional modules and application scenarios covered by the productization of user portraits
Global and Chinese market of transfer case 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of optical fiber connectors 2022-2028: Research Report on technology, participants, trends, market size and share
【可能是全中文网最全】pushgateway入门笔记
[daily training] 395 Longest substring with at least k repeated characters
整形和浮点型是如何在内存中的存储
[set theory] inclusion exclusion principle (complex example)
Global and Chinese markets of AC electromechanical relays 2022-2028: Research Report on technology, participants, trends, market size and share
需要知道的字符串函数
Besides lying flat, what else can a 27 year old do in life?
【pytorch学习笔记】Datasets and Dataloaders
视觉上位系统设计开发(halcon-winform)-6.节点与宫格
Yolov5 advanced nine target tracking example 1
基于SVN分支开发模式流程浅析
socket.io搭建分布式Web推送服务器
MySQL reports an error: [error] mysqld: file '/ mysql-bin. 010228‘ not found (Errcode: 2 “No such file or directory“)
运维体系的构建