如何在Windows应用程序中的CheckedListbox中添加Multple列 [英] How to add Multple columns in CheckedListbox in windows application
本文介绍了如何在Windows应用程序中的CheckedListbox中添加Multple列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows应用程序中有一个CheckedListbox。我在CheckedListbox里面有15个项目
我的要求是将这些项目水平排列在多列中。列数几乎等于
5列。
在Web应用程序中,我可以使用属性实现此功能 RepeatColumns = 5
但在Windows中有一个属性Multicolumn = 真实。
但是我只有两列。
为此,我能做什么有什么办法请帮助我。
谢谢&问候。
I have one CheckedListbox in windows application. I have 15 Items inside CheckedListbox
My requirement is Arrange that items in Multiple columns horizontally.Columns nearly equal to
5 columns.
In web application i can achieve this using property RepeatColumns=5
But in windows there is one property Multicolumn="True".
But I get only two columns.
For this what I can I Do Is there any way please Help me.
Thanks & Regards.
推荐答案
您可以使用ListControl或Grid控件代替CheckedListbox,在ListControl和GridView控件中创建多个列很简单
You may use ListControl or Grid control instead of CheckedListbox, Its simple to create multiple columns in ListControl and in GridView control
hi
你应该使用dataGridView以下相同的代码:
yourDataGridView.DataSource = List< x>
yourDataGridView .Show()
和获取数据你应该触发事件SelectionChanged并使用下面的源代码
DataGridViewCell cell = null;
foreach(DataGridViewCell yourDataGridView.SelectedCells中的selectedCell)
{
cell = selectedCell;
break;
}
if(cell!= null)
{
DataGridViewRow row = cell.OwningRow;
textBox1.Text = row.Cells [0] .Value.ToString();
}
goo d lock;
hi you shoud use dataGridView same below sourse code :
yourDataGridView.DataSource = List<x>
yourDataGridView.Show()
and for get data u should fire event SelectionChanged and use below source code
DataGridViewCell cell = null;
foreach (DataGridViewCell selectedCell in yourDataGridView.SelectedCells)
{
cell = selectedCell;
break;
}
if (cell != null)
{
DataGridViewRow row = cell.OwningRow;
textBox1.Text = row.Cells[0].Value.ToString();
}
good lock;
这篇关于如何在Windows应用程序中的CheckedListbox中添加Multple列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文