1、C#中winform页面增加切换页面
2、单独定义struct的时候要用变量赋值
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;namespace ZAndromeda.TCP.CMR.L2_L1
{
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
[DataContract]
public struct SetPointType
{
[DataMember(Order = 0)]
public float _hPos;[DataMember(Order = 1)]
public float _bvminPos;[DataMember(Order = 2)]
public float _bvmaxPos;[DataMember(Order = 3)]
public float _tPos;public SetPointType(float v)
{
_hPos = v;
_bvminPos = v;
_bvmaxPos = v;
_tPos = v;
}
}
}
定义struct数组,并给数组内的每一项赋值
public struct SCoolPressPos
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.Struct)]
public SetPointType[] _arrSp = new SetPointType[4];public SCoolPressPos(float _v)
{
for (int num = 0; num < 4; num++)
{
_arrSp[num] = new SetPointType(0);
}
}
}
3、定义struct的list