bitmap collection RRS feed

  • Question

  • User2044071170 posted
    ok.atempting to wrap bitmaps in a collection so that i can execute this code with ease For y = 0 To opictures.Count - 1 g.DrawImage(opictures.Item(y), cardwidth, 10) cardwidth = cardwidth + (0.75 * cardwidth) Next single instance class Public Class Picture #Region "Private Members" Private mPicture As Bitmap #End Region #Region "Constructors" Public Sub New(ByVal strPath As String) mPicture = New Bitmap("C:\Inetpub\wwwroot\webpontoons\images\Cards\" & strPath & ".bmp") End Sub #End Region #Region "Properties" Public Property Picture() As Bitmap Get Return mPicture End Get Set(ByVal Value As Bitmap) mPicture = Value End Set End Property #End Region End Class collection to return item Default Public ReadOnly Property Item(ByVal index As Integer) As Bitmap Get Return CType(List.Item(index), Bitmap) End Get End Property say that the item cant be ctyped into a bitmap so i tried the above code returning the single class ie of type picture and the code below to ctype it no chanccccccccce For y = 0 To opictures.Count - 1 g.DrawImage(CType(opictures.Item(y), Bitmap), cardwidth, 10) cardwidth = cardwidth + (0.75 * cardwidth) NextNext Value of type 'ClassDefs.Picture' cannot be converted to 'System.Drawing.Bitmap'. why noooooo ?
    Friday, September 10, 2004 5:22 PM

All replies

  • User2044071170 posted
    sorted it bitmap is already a single item class in its own right so don't need to wrap the single item.....just build the collection class using type bitmap :-)
    Saturday, September 11, 2004 8:35 AM