当前位置:网站首页>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 .
边栏推荐
- 视觉上位系统设计开发(halcon-winform)-2.全局变量设计
- Using multipleoutputs to output multiple files in MapReduce
- PyTorch crop images differentiablly
- 视觉上位系统设计开发(halcon-winform)-3.图像控件
- MySQL reports an error: [error] mysqld: file '/ mysql-bin. 010228‘ not found (Errcode: 2 “No such file or directory“)
- Jvm-04-runtime data area heap, method area
- Série yolov5 (i) - - netron, un outil de visualisation de réseau
- 【pytorch学习笔记】Datasets and Dataloaders
- What is machine reading comprehension? What are the applications? Finally someone made it clear
- leetcode_ Power of Four
猜你喜欢

Influxdb2 sources add data sources

Popular understanding of gradient descent

Popular understanding of linear regression (I)

Redis lock Optimization Practice issued by gaobingfa
![[cloud native training camp] module 7 kubernetes control plane component: scheduler and controller](/img/a4/2156b61fbf50db65fdf59c8f5538f8.png)
[cloud native training camp] module 7 kubernetes control plane component: scheduler and controller

Tensorflow realizes verification code recognition (I)
![[transformer] Introduction - the original author of Harvard NLP presented the annotated transformer in the form of line by line implementation in early 2018](/img/2b/b23aeab584f89be6678c0fe059d4b6.png)
[transformer] Introduction - the original author of Harvard NLP presented the annotated transformer in the form of line by line implementation in early 2018

高并发下之redis锁优化实战

el-switch 赋值后状态不变化
![[set theory] inclusion exclusion principle (complex example)](/img/9a/db5a75e27516378c31531773a8a221.jpg)
[set theory] inclusion exclusion principle (complex example)
随机推荐
socket.io搭建分布式Web推送服务器
Global and Chinese market of Bus HVAC systems 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for indoor HDTV antennas 2022-2028: Research Report on technology, participants, trends, market size and share
Remote server background hangs nohup
运维体系的构建
【Transformer】入门篇-哈佛Harvard NLP的原作者在2018年初以逐行实现的形式呈现了论文The Annotated Transformer
Center and drag linked global and Chinese markets 2022-2028: Research Report on technology, participants, trends, market size and share
Halcon与Winform学习第二节
Jvm-09 byte code introduction
详解指针进阶2
XWiki安装使用技巧
Stress test WebService with JMeter
Kubernetes advanced training camp pod Foundation
百度智能云助力石嘴山市升级“互联网+养老服务”智慧康养新模式
Kubernetes will show you from beginning to end
The markdown file obtains the pictures of the network and stores them locally and modifies the URL
Global and Chinese market of iron free motors 2022-2028: Research Report on technology, participants, trends, market size and share
Didi off the shelf! Data security is national security
Finally, someone explained the financial risk management clearly
Matlab r2011b neural network toolbox precautions