[英]How can i draw an image in the listbox along with the listboxItem [c# winforms]
(我正在使用c#在Winforms中工作)我有一個列表框,其中添加了一些項目。我的問題是我想在列表框中每個項目的左側繪制圖像。有人可以提出任何想法嗎? 提前致謝。
我可以使用ImageList做到這一點。
imageList.Draw(ea.Graphics, bounds.Left, bounds.Top,item.ImageIndex);
但我想這樣使用
ea.Graphics.DrawImage("someImage",new point);
為此,您應該使用列表視圖控件而不是列表框。 listview本機支持imagelist綁定,並且listviewitem具有imageindex屬性,因此您可以指定要從imagelist呈現的圖像的索引。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.