|
|
|
|
vinod
posted
1 posts
since
Sep 25, 2003
from
|
Display transparent Images in picture box
|
|
|
|
Posted on:
26 Sep 2003
|
|
|
|
|
|
|
|
|
Has anybody tried displaying transparent (GIF) Images in picture box ? I tried to do but it didn't work. A default background is shown instead. There was an image control in vb6 which does this job perfectly but that too not found in vb.net.
|
|
|
|
|
|
Mahesh Chand
posted
4021 posts
since
Oct 29, 2004
from
Philadelphia
|
|
Re: Display transparent Images in picture box
|
|
|
|
|
|
|
|
|
|
|
Do you have a transparent image or you want to display an image and make it transparent? If an image is transparent, shouldn't you be looking at the background color of the control?
|
|
|
|
|
|
erushton
posted
1 posts
since
Mar 07, 2004
from
|
|
Re: Graphics Programming with GDI+
|
|
|
|
|
|
|
|
|
|
|
I have a question regarding your book entitled: Graphics Programming with GDI+.
In the book, it says that "Complete source code for the examples in this book (in both C# and Visual Basic.NET) is available for download at www.awprofessional.com/titles/0321160770."
I have downloaded the sourcecode file "chand_sourcecode.zip" and I found only two vbproj project files.
I was expecting a corresponding VB.NET project for each of the C# projects in the book.
How do I get the VB.NET files?
|
|
|
|
|
|
rmalli
posted
5 posts
since
Apr 21, 2004
from
|
|
Re: Display transparent Images in picture box
|
|
|
|
|
|
|
|
|
|
|
just simply drag a picture box control in form, and pick the URL of ur transparent image. this will be work. if u don't have picture box control then customize ur toolbox and add picture box contol. i have made, this is't showing any error.
RAJ
|
|
|
|
|
|
rmalli
posted
5 posts
since
Apr 21, 2004
from
|
|
Re: Display transparent Images in picture box
|
|
|
|
|
|
|
|
|
|
|
hey vinod try this code: in this code i have use a "jpg"(image.jpg) image. i have written code in GDI+.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
' Create an Image from a file
Dim curImage As Image = Image.FromFile("image.jpg")
' Draw image
g.DrawImage(curImage, 0, 0, curImage.Width, curImage.Height)
' Create pens with different opacity
Dim opqPen As New Pen(Color.FromArgb(255, 0, 255, 0), 10)
Dim transPen As New Pen(Color.FromArgb(128, 0, 255, 0), 10)
Dim totTransPen As New Pen(Color.FromArgb(40, 0, 255, 0), 10)
' Draw graphics object using transparent pens
g.DrawLine(opqPen, 10, 10, 200, 10)
g.DrawLine(transPen, 10, 30, 200, 30)
g.DrawLine(totTransPen, 10, 50, 200, 50)
Dim semiTransBrush As New SolidBrush(Color.FromArgb(60, 0, 255, 0))
g.FillRectangle(semiTransBrush, 20, 100, 200, 100)
End Sub
RAJ
|
|
|
|
|
|
rmalli
posted
5 posts
since
Apr 21, 2004
from
|
|
Re: Display transparent Images in picture box
|
|
|
|
|
|
|
|
|
|
|
hey vinod try this code: in this code i have use a "jpg"(image.jpg) image. i have written code in VB.NET, GDI+.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
' Create an Image from a file
Dim curImage As Image = Image.FromFile("image.jpg")
' Draw image
g.DrawImage(curImage, 0, 0, curImage.Width, curImage.Height)
' Create pens with different opacity
Dim opqPen As New Pen(Color.FromArgb(255, 0, 255, 0), 10)
Dim transPen As New Pen(Color.FromArgb(128, 0, 255, 0), 10)
Dim totTransPen As New Pen(Color.FromArgb(40, 0, 255, 0), 10)
' Draw graphics object using transparent pens
g.DrawLine(opqPen, 10, 10, 200, 10)
g.DrawLine(transPen, 10, 30, 200, 30)
g.DrawLine(totTransPen, 10, 50, 200, 50)
Dim semiTransBrush As New SolidBrush(Color.FromArgb(60, 0, 255, 0))
g.FillRectangle(semiTransBrush, 20, 100, 200, 100)
End Sub
RAJ
|
|
|
|
|
|
|
|
|