|
-
Dec 29th, 2004, 02:53 PM
#1
Thread Starter
Addicted Member
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
-
Dec 29th, 2004, 08:19 PM
#2
Sleep mode
Code:
box.Image = New Bitmap("filename")
-
Dec 29th, 2004, 10:18 PM
#3
Thread Starter
Addicted Member
Re: System.Drawing.Bitmap
But then how would I use the functions in system.drawing.bitmap? Like getpixel or maketransparent..
-
Dec 30th, 2004, 12:02 AM
#4
Sleep mode
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
-
Dec 30th, 2004, 12:06 AM
#5
Thread Starter
Addicted Member
Re: System.Drawing.Bitmap
Ok thats what I figured.. So then I'd have to do this..
VB Code:
Dim B as Bitmap
B=B.FromFile("C:\a.bmp")
B.MakeTransparent(RGB(0,0,0))
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?
-
Dec 30th, 2004, 12:11 AM
#6
Thread Starter
Addicted Member
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?
-
Dec 30th, 2004, 09:36 AM
#7
Sleep mode
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|