Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I hope this isn't the wrong room..

Here i go:

 

I figured out how to use streams but i still have a small problem

Here is the code i use (it's behind a button)

It loads a bitmap puts it into a stream so i can change it.

       Dim i As Integer
       Dim mfs As FileStream
       Dim myarray(265650) As Byte
       Dim mms As New MemoryStream()

       mfs = New FileStream("WW" & 1 & ".bmp", FileMode.Open)
       mfs.Read(myarray, 1, 265650)
       mfs.Close()
 
'here i write 0 to certain the elements in the array

       For i = 13879 To 50000 Step 1
           myarray(i) = 0

       Next
       
'when i put the array in the mms it sets all the bytes starting from
13879 at 0 (until the end)
WHY? It should only do it from 13879 To 50000
       
       mms.Write(myarray, 1, 265650)

       pBox.Image = System.Drawing.Bitmap.FromStream(mms)
     

Am i missing somthing?

 

Ty for your help

Edited by Robby

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...