Drawing border to items of listview
-
hi all, I am using a listview to display thumbnail of images with some text. i have used largeicon view to display them. i have created the thumbnail images and its displayed. as in explorer, i need to have the thumbnail image displayed as a folder. (like a border to the thumbnail and text). How can i do it? i saw a article here in Codeproject but the code is in VC++.and i am not aware of this. Is there any way to accomplish the same?
Thanks in advance.:) Regards Anuradha
-
hi all, I am using a listview to display thumbnail of images with some text. i have used largeicon view to display them. i have created the thumbnail images and its displayed. as in explorer, i need to have the thumbnail image displayed as a folder. (like a border to the thumbnail and text). How can i do it? i saw a article here in Codeproject but the code is in VC++.and i am not aware of this. Is there any way to accomplish the same?
Thanks in advance.:) Regards Anuradha
Yes there is. First of all you need to set OwnerDraw property of ListView class to true. By doing this you are responsible for providing code for drawing the control. After that handle the ItemDraw event of the listview class to make necessary drawings.
#region signature my articles #endregion
-
Yes there is. First of all you need to set OwnerDraw property of ListView class to true. By doing this you are responsible for providing code for drawing the control. After that handle the ItemDraw event of the listview class to make necessary drawings.
#region signature my articles #endregion
hi, Thanks for your help. i have started to use the drawitem event of the listview control and i am making improvement in that. Thanks for your suggestions. But could you please provide me with a link where i might be able to draw a perfect rectangle for the items using drawitem event?
Thanks in advance.:) Regards Anuradha
-
hi, Thanks for your help. i have started to use the drawitem event of the listview control and i am making improvement in that. Thanks for your suggestions. But could you please provide me with a link where i might be able to draw a perfect rectangle for the items using drawitem event?
Thanks in advance.:) Regards Anuradha
Examine properties of the DrawListViewItemEventArgs parameter that the DrawItem event receives.
#region signature my articles #endregion
-
Examine properties of the DrawListViewItemEventArgs parameter that the DrawItem event receives.
#region signature my articles #endregion
hi, Thanks for your suggestions. i have drawn the image and the text using the properties of drawlistitemeventargs(thanks). but still i am not able to figure out how to draw the border for that item. Could you please help me by suggesting some links? Thanks once again. Regards Anuradha
-
hi, Thanks for your suggestions. i have drawn the image and the text using the properties of drawlistitemeventargs(thanks). but still i am not able to figure out how to draw the border for that item. Could you please help me by suggesting some links? Thanks once again. Regards Anuradha
The drawlistitemeventargs parameter called e has a graphics property which you use for drawing. So you need to call e.Graphics.DrawRectangle method to draw rectangle around the item. In order to pass the desired rectangle to this method explore e.Bounds property and e.Item.Bounds property. Hope this helps
#region signature my articles #endregion
-
The drawlistitemeventargs parameter called e has a graphics property which you use for drawing. So you need to call e.Graphics.DrawRectangle method to draw rectangle around the item. In order to pass the desired rectangle to this method explore e.Bounds property and e.Item.Bounds property. Hope this helps
#region signature my articles #endregion
-
hi, Thanks a lot for your help. I am able to draw the border now for each item. Thanks once again. Regards Anuradha
You are welcome :)
#region signature my articles #endregion