Results 1 to 7 of 7

Thread: System.Drawing.Bitmap

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    System.Drawing.Bitmap

    Hello, how would I display a System.Drawing.Bitmap on my form.. Or on something... Theres no BitBlt in .NET...

    say I had like: Dim P as System.Drawing.Bitmap

    I tried making a picturebox but I couldn't figure out how to make it show whatever P was... I'm confused heh


    Thanks,
    Jake

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Code:
    box.Image = New Bitmap("filename")

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: System.Drawing.Bitmap

    But then how would I use the functions in system.drawing.bitmap? Like getpixel or maketransparent..

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Something like this :
    Code:
    'Class variable 
    Private myBitmap As Bitmap
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As 
    System.EventArgs) Handles Button1.Click
    
            Me.myBitmap = Bitmap.FromFile("c:\test.jpg")        
            Me.PictureBox1.Image = Me.myBitmap
            MessageBox.Show(Me.myBitmap.GetPixel(10, 10).ToString)
    
    End Sub

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: System.Drawing.Bitmap

    Ok thats what I figured.. So then I'd have to do this..

    VB Code:
    1. Dim B as Bitmap
    2.  
    3. B=B.FromFile("C:\a.bmp")
    4. B.MakeTransparent(RGB(0,0,0))
    5. Picturebox1.Image=B

    And everytime I changed something in B, I'd have to use Picturebox1.Image=B.. No biggie.. Is there anyway to bind the picturebox1.image to B, so if B changes, picturebox1.image changes too? Maybe Set PictureBox1.Image = B?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: System.Drawing.Bitmap

    Actually, I'd only have to use P.Refresh every time. That means that P.Image IS "set" to B. Whatever changes on B changes on P, but P needs to be refreshed. Is there some kind of autoredraw on pictureboxes? Or images or something?

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    AutoDraw's gone . It's was useful in VB6 . The only convenient solution I can think of now is using events .You simply raise an event whenever you change/call any method of Bitmap obj . Then you put your code that respond to that event in the event handler .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width