经过大量搜索后,我仍然无法找到解决该问题的方法。我已经使用如下列表成功设置了DataSource
的{{1}}。
班级
DatagridView
设置网格的数据源
public class ChannelInfo
{
[Browsable(false)]
[DisplayName("ChannelId")]
public int channelId { get; set; }
[DisplayName("Channel")]
public string sysname { get; set; }
[DisplayName("Display Name")]
public string dispName { get; set; }
[DisplayName("Unit")]
public string unit { get; set; }
[DisplayName("Divide By")]
public int divideBy { get; set; }
[DisplayName("YAxis")]
public string yAxis { get; set; }
[DisplayName("Min Scale")]
public int scaleMin { get; set; }
[DisplayName("Max Scale")]
public int scaleMax { get; set; }
[DisplayName("Colour")]
public string colour { get; set; }
[DisplayName("Set Point")]
public double setPoint { get; set; }
[DisplayName("Limit(+/-)")]
public double? limit { get; set; }
[DisplayName("MKT")]
public bool? IncludeInmKT { get; set; }
/// <summary>
/// Default constructor
/// </summary>
public ChannelInfo()
{
}
/// <summary>
/// Copy constructor to create a copy of another object
/// </summary>
/// <param name="ci"> and object of the type ChannelInfo whos copy is to be created</param>
public ChannelInfo(ChannelInfo ci)
{
channelId = ci.channelId;
sysname = ci.sysname;
dispName = ci.dispName;
unit = ci.unit;
divideBy = ci.divideBy;
yAxis = ci.yAxis;
scaleMin = ci.scaleMin;
scaleMax = ci.scaleMax;
colour = ci.colour;
setPoint = ci.setPoint;
limit = ci.limit;
IncludeInmKT = ci.IncludeInmKT;
}
}
使用设计器将数据网格的最后一列的类型设置为DataGridViewCheckBoxColumn。 数据网格显示除最后一个布尔字段IncludeInmkt之外的所有数据。它显示了文本值(True / False),但是我希望它会在chInfoList中显示为带有相应值的复选框。我还在设计器中将TrueValue设置为True,将FalseValue设置为False。
我要去哪里了,请提示。