[英]C#.Net How to stop ListView selecting item adjacent to item?
Last night I followed this tutorial: https://qdevblog.blogspot.com/2011/11/c-listview-item-spacing.html 昨晚我遵循了本教程: https : //qdevblog.blogspot.com/2011/11/c-listview-item-spacing.html
So my Listview has no padding, and whenever I select an item it chooses either the Item above it or to the left.. 因此,我的Listview没有填充,每当我选择一个项目时,它都会选择其上方或左侧的项目。
I have tried searching for a solution, and came up dry. 我曾尝试寻找解决方案,但干了。 IF there is an article please link me to it, don't need to be rude!
如果有文章,请链接到我,无需粗鲁!
Edit1: EDIT1:
private void lvTiles_SelectedIndexChanged(object sender, EventArgs e) {
if (lvTiles.SelectedItems.Count == 1) {
ListViewItem item = lvTiles.SelectedItems[0];
selectedTileIndex = Convert.ToInt32(item.ImageKey);
}
}
Edit2: https://gyazo.com/244d9f5aff356341fb28cda509b1c586 编辑2: https ://gyazo.com/244d9f5aff356341fb28cda509b1c586
Edit3: EDIT3:
public void LoadTilemap(Tilemap tm) {
this.tm = tm;
ListViewItem_SetSpacing(this.lvTiles, 32, 40);
ImageList images = tm.ConvertToImageList();
images.ImageSize = new Size(32, 32)
lvTiles.LargeImageList = images;
for (int i = 0; i < 0xEF; i++)
AddTile(i);
}
Also: Exactly why does using View = Tile and a suitable TileSize not help (instead of the weird code from the link) ? 另外:究竟为什么使用View = Tile和合适的TileSize无效(而不是链接中的奇怪代码)?
Orignally posted by: Taw, https://stackoverflow.com/users/3152130/taw 最初发布者:Taw, https ://stackoverflow.com/users/3152130/taw
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.