Hi
Can anybody help me with the following? It is driving me crazy!!!
I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5.
(2) The Background color of the bitmap is set to white.
(3) Draw a design on the bitmap in a color other than white.
(4) Create a windows application.
(5) Set the forms background image to be the bitmap created earlier.
(6) Set the transparencyKey of the form to be white i.e. the same as the
background color of the bitmap.
(7) Set the FormBorderStyle to None
(8) Run the application.
I expected just the non-white images but instead I still see the white
background! D'OH!!!
Can anybody tell me what I'm doing wrong?
Here's a link to Microsoft describing the same thing.
Thanks in adavance
Geoff 40 1941
Whoops, sorry, here's the link to Microsoft: http://msdn.microsoft.com/library/de...ndowsforms.asp
Geoff
"Geoff Jones" <no********@email.com> wrote in message
news:41***********************@news.dial.pipex.com ... Hi
Can anybody help me with the following? It is driving me crazy!!!
I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
Can anybody tell me what I'm doing wrong?
Here's a link to Microsoft describing the same thing.
Thanks in adavance
Geoff
"Geoff Jones" <no********@email.com> schrieb: I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
You may want to use regions instead:
Region from Bitmap
<URL:http://www.bobpowell.net/region_from_bitmap.htm>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Hi, I also got this problem before, this following VB code may help:)
Public Sub SetBackgroundBitmap(ByVal image As Image, ByVal
transparencyColor As Color)
Me.backgroundImage = New Bitmap(image)
Width = Me.backgroundImage .Width
Height = Me.backgroundImage .Height
Region = BitmapToRegion(Me.backgroundImage, transparencyColor)
End Sub
"Herfried K. Wagner [MVP]" <hi***************@gmx.at>
??????:%2****************@tk2msftngp13.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
You may want to use regions instead:
Region from Bitmap <URL:http://www.bobpowell.net/region_from_bitmap.htm>
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Geoff,
I never understood this questions.
Is it something that you want to resize the picturebox to the size of the
image when that is smaller than the picturebox?
Or something I did in this as my sample in this message? http://groups-beta.google.com/group/...7cab2e04089f27
Cor
"Geoff Jones" <no********@email.com> > Whoops, sorry, here's the link to
Microsoft: http://msdn.microsoft.com/library/de...ndowsforms.asp
Geoff
"Geoff Jones" <no********@email.com> wrote in message news:41***********************@news.dial.pipex.com ... Hi
Can anybody help me with the following? It is driving me crazy!!!
I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
Can anybody tell me what I'm doing wrong?
Here's a link to Microsoft describing the same thing.
Thanks in adavance
Geoff
Hi Cor
If you follow the instructions in the link I gave earlier, I'd be interested
to see if you have the same problem.
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Geoff,
I never understood this questions.
Is it something that you want to resize the picturebox to the size of the image when that is smaller than the picturebox?
Or something I did in this as my sample in this message? http://groups-beta.google.com/group/...7cab2e04089f27
Cor
"Geoff Jones" <no********@email.com> > Whoops, sorry, here's the link to Microsoft: http://msdn.microsoft.com/library/de...ndowsforms.asp
Geoff
"Geoff Jones" <no********@email.com> wrote in message news:41***********************@news.dial.pipex.com ... Hi
Can anybody help me with the following? It is driving me crazy!!!
I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
Can anybody tell me what I'm doing wrong?
Here's a link to Microsoft describing the same thing.
Thanks in adavance
Geoff
Geoff,
I once had the same thing and the problem wasn't in my code but in the
colordepth of my screen (right click desktop/properties/settings) , if I
set it to truecolors(24 bits) the transparencyKey didn't work, if I set it
to heigh colors (16 bit) it does work, maybe this helps you
greetz Peter
"zhang" <kz*****@yahoo.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl... Hi, I also got this problem before, this following VB code may help:)
Public Sub SetBackgroundBitmap(ByVal image As Image, ByVal transparencyColor As Color)
Me.backgroundImage = New Bitmap(image) Width = Me.backgroundImage .Width Height = Me.backgroundImage .Height Region = BitmapToRegion(Me.backgroundImage, transparencyColor)
End Sub
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> ??????:%2****************@tk2msftngp13.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as
the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
You may want to use regions instead:
Region from Bitmap <URL:http://www.bobpowell.net/region_from_bitmap.htm>
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Geoff,
Did you see the message from Peter Proost
Otherwise it works for me.
(Therefore I find this useless this way)
I hope this helps anyway
Cor
"Geoff Jones" <no********@email.com> Hi Cor
If you follow the instructions in the link I gave earlier, I'd be interested to see if you have the same problem.
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Geoff,
I never understood this questions.
Is it something that you want to resize the picturebox to the size of the image when that is smaller than the picturebox?
Or something I did in this as my sample in this message? http://groups-beta.google.com/group/...7cab2e04089f27
Cor
"Geoff Jones" <no********@email.com> > Whoops, sorry, here's the link to Microsoft: http://msdn.microsoft.com/library/de...ndowsforms.asp
Geoff
"Geoff Jones" <no********@email.com> wrote in message news:41***********************@news.dial.pipex.com ... Hi
Can anybody help me with the following? It is driving me crazy!!!
I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
Can anybody tell me what I'm doing wrong?
Here's a link to Microsoft describing the same thing.
Thanks in adavance
Geoff
Hi Cor
With your, and others help (ta Peter), it now works :)
I had to change the display to 16 bit and also re-paint the background of
the image I was using with "White" i.e. I'm not sure it was "true white" in
the initial bitmap.
Great, it now works. HOWEVER, this restriction that it has to be less than
24 bit seems to be less than ideal. I don't know what depth the application
will be on the client machines! Surely there must be an easier way to do
this??? Am I right in assuming that even zhang's idea will not work on a 24
bit for the same reasons?
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl... Geoff,
Did you see the message from Peter Proost Otherwise it works for me. (Therefore I find this useless this way)
I hope this helps anyway
Cor
"Geoff Jones" <no********@email.com>
Hi Cor
If you follow the instructions in the link I gave earlier, I'd be interested to see if you have the same problem.
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Geoff,
I never understood this questions.
Is it something that you want to resize the picturebox to the size of the image when that is smaller than the picturebox?
Or something I did in this as my sample in this message? http://groups-beta.google.com/group/...7cab2e04089f27
Cor
"Geoff Jones" <no********@email.com> > Whoops, sorry, here's the link to Microsoft:
http://msdn.microsoft.com/library/de...ndowsforms.asp
Geoff
"Geoff Jones" <no********@email.com> wrote in message news:41***********************@news.dial.pipex.com ... > Hi > > Can anybody help me with the following? It is driving me crazy!!! > > I'm trying to produce a non-rectangular form as follows: > > (1) Produce a bitmap e.g. gif, using paint shop pro 5. > (2) The Background color of the bitmap is set to white. > (3) Draw a design on the bitmap in a color other than white. > (4) Create a windows application. > (5) Set the forms background image to be the bitmap created earlier. > (6) Set the transparencyKey of the form to be white i.e. the same as > the background color of the bitmap. > (7) Set the FormBorderStyle to None > (8) Run the application. > > I expected just the non-white images but instead I still see the white > background! D'OH!!! > > Can anybody tell me what I'm doing wrong? > > Here's a link to Microsoft describing the same thing. > > Thanks in adavance > > Geoff >
Geoff,
Did you try my sample?
Cor
"Geoff Jones" <no********@email.com> schrieb: I had to change the display to 16 bit and also re-paint the background of the image I was using with "White" i.e. I'm not sure it was "true white" in the initial bitmap.
Great, it now works. HOWEVER, this restriction that it has to be less than 24 bit seems to be less than ideal. I don't know what depth the application will be on the client machines! Surely there must be an easier way to do this??? Am I right in assuming that even zhang's idea will not work on a 24 bit for the same reasons?
If you are using regions, the problems will go away. Regions will work on
any color depth.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Geoff copy paste this to see how regions work.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim myGraphicsPath As Drawing2D.GraphicsPath = New _
Drawing2D.GraphicsPath()
myGraphicsPath.AddEllipse(New Rectangle(0, 0, 125, 125))
myGraphicsPath.AddEllipse(New Rectangle(75, 75, 20, 20))
myGraphicsPath.AddEllipse(New Rectangle(120, 0, 125, 125))
myGraphicsPath.AddEllipse(New Rectangle(145, 75, 20, 20))
Me.BackColor = Color.Chartreuse
Me.Size = New System.Drawing.Size(256, 256)
Me.Region = New Region(myGraphicsPath)
End Sub
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eN**************@TK2MSFTNGP12.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: I had to change the display to 16 bit and also re-paint the background
of the image I was using with "White" i.e. I'm not sure it was "true white" in the initial bitmap.
Great, it now works. HOWEVER, this restriction that it has to be less
than 24 bit seems to be less than ideal. I don't know what depth the application will be on the client machines! Surely there must be an
easier way to do this??? Am I right in assuming that even zhang's idea will not work on a 24 bit for the same reasons?
If you are using regions, the problems will go away. Regions will work on any color depth.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Hi Herfried
I'm trying to use your ideas for Regions. I have converted the GetRegion
code from C# to VB and have tried, but failed, to get it to do what I want
i.e. I am uncertain where to use the function etc. in the VB code.
I've tried the following:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
TheRegion = GetRegion(Me.BackgroundImage, Color.White)
Me.Region = TheRegion
End Sub
In the hope that it would just paint the image but not the white background.
Unfortunately, I get an overflow error. Can you help?
Geoff
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
You may want to use regions instead:
Region from Bitmap <URL:http://www.bobpowell.net/region_from_bitmap.htm>
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I'm guessing that GetRegion merely returns the regions to be painted? Is
this correct?
Geoff
"Geoff Jones" <no********@email.com> wrote in message
news:41*********************@news.dial.pipex.com.. . Hi Herfried
I'm trying to use your ideas for Regions. I have converted the GetRegion code from C# to VB and have tried, but failed, to get it to do what I want i.e. I am uncertain where to use the function etc. in the VB code.
I've tried the following: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
TheRegion = GetRegion(Me.BackgroundImage, Color.White)
Me.Region = TheRegion
End Sub
In the hope that it would just paint the image but not the white background. Unfortunately, I get an overflow error. Can you help?
Geoff
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message news:%2****************@tk2msftngp13.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: I'm trying to produce a non-rectangular form as follows:
(1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The Background color of the bitmap is set to white. (3) Draw a design on the bitmap in a color other than white. (4) Create a windows application. (5) Set the forms background image to be the bitmap created earlier. (6) Set the transparencyKey of the form to be white i.e. the same as the background color of the bitmap. (7) Set the FormBorderStyle to None (8) Run the application.
I expected just the non-white images but instead I still see the white background! D'OH!!!
You may want to use regions instead:
Region from Bitmap <URL:http://www.bobpowell.net/region_from_bitmap.htm>
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
"Geoff Jones" <no********@email.com> schrieb: I'm guessing that GetRegion merely returns the regions to be painted? Is this correct?
A region is used to represent an area of arbitrary shape. The form's
Region' property can be used to set the form's shape. I assume that there
is a bug in your 'GetRegion' function. Can you post your implementation?
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Thanks for looking at this for me Herfried. Here is my VB version:
Private Function GetRegion(ByRef _img As Bitmap, ByVal color As Color) As
Region
Dim _matchColor As Color = color.FromArgb(color.R, color.G, color.B)
Dim rgn As System.Drawing.Region = New Region
rgn.MakeEmpty()
Dim rc As Rectangle = New Rectangle(0, 0, 0, 0)
Dim inimage As Boolean = False
Dim x As Integer
Dim y As Integer
For y = 0 To _img.Height - 1
For x = 0 To _img.Width - 1
If Not (inimage) Then
If Not color.op_Equality(_img.GetPixel(x, y), _matchColor) Then
inimage = True
rc.X = x
rc.Y = y
rc.Height = 1
Else
inimage = False
rc.Width = x - rc.X
rgn.Union(rc)
End If
Else
inimage = False
rc.Width = _img.Width - rc.X
rgn.Union(rc)
End If
Next
Next
Return rgn
End Function
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:u$**************@TK2MSFTNGP10.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: I'm guessing that GetRegion merely returns the regions to be painted? Is this correct?
A region is used to represent an area of arbitrary shape. The form's Region' property can be used to set the form's shape. I assume that there is a bug in your 'GetRegion' function. Can you post your implementation?
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Hi again Herfried
After thinking about it, I'm not sure if the region that the code returns is
the "transparent area" i.e. white background in my case, or the region of
the bitmap I want displayed. Could you enlighten me?
In addition, am I calling this in the correct way i.e. does this next line
tell the application to only draw the region returned by the function?
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
TheRegion = GetRegion(Me.BackgroundImage, Color.White)
Me.Region = TheRegion
End Sub
Note that I'm placing it in the Load member. Is this the correct place to
put it???
Thanks in advance
Geoff
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:u$**************@TK2MSFTNGP10.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: I'm guessing that GetRegion merely returns the regions to be painted? Is this correct?
A region is used to represent an area of arbitrary shape. The form's Region' property can be used to set the form's shape. I assume that there is a bug in your 'GetRegion' function. Can you post your implementation?
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Geoff,
Why you dont use the sample I showed you the only thing you have to do with
that is in my opinion to paste it in and than make another region.
So you make me curious.
Cor
"Cor Ligthert" <no************@planet.nl> schrieb: Why you dont use the sample I showed you the only thing you have to do with that is in my opinion to paste it in and than make another region.
I assume the OP wants to create a region from a bitmap.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Yes, that's right.
Geoff
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uK**************@TK2MSFTNGP10.phx.gbl... "Cor Ligthert" <no************@planet.nl> schrieb: Why you dont use the sample I showed you the only thing you have to do with that is in my opinion to paste it in and than make another region.
I assume the OP wants to create a region from a bitmap.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Herfried, I assume the OP wants to create a region from a bitmap.
And did you give him a sample from that, because I have more the idea that
he wants to use a bitmap as a region.
Cor
Geoff Yes, that's right.
I don't know what I did that you ignore me in this way, however when you
don't want my help than be so polite to answer that in an answer to me.
I will try to remember this in future and not bother you anymore.
Cor
Cor,
"Cor Ligthert" <no************@planet.nl> schrieb: I assume the OP wants to create a region from a bitmap.
And did you give him a sample from that, because I have more the idea that he wants to use a bitmap as a region.
As always, there is no guarantee that I provide sample code.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Geoff,
"Geoff Jones" <no********@email.com> schrieb: Thanks for looking at this for me Herfried. Here is my VB version:
Very quick and dirty, but seems to work:
\\\
Private Function GetRegion( _
ByVal _img As Bitmap, _
ByVal color As Color _
) As Region
Dim _matchColor As Color = _
color.FromArgb(color.R, color.G, color.B)
Dim rgn As System.Drawing.Region = New Region
rgn.MakeEmpty()
Dim rc As Rectangle = New Rectangle(0, 0, 0, 0)
Dim inimage As Boolean = False
Dim x As Integer
Dim y As Integer
For y = 0 To _img.Height - 1
For x = 0 To _img.Width - 1
If Not (inimage) Then
If _
Not color.op_Equality(_img.GetPixel(x, y), _matchColor)
_
Then
inimage = True
rc.X = x
rc.Y = y
rc.Height = 1
End If
Else
inimage = False
rc.Width = _img.Width - rc.X
rgn.Union(rc)
End If
Next
If inimage Then
inimage = False
rc.Width = _img.Width - rc.X
rgn.Union(rc)
End If
Next
Return rgn
End Function
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Hi Cor
I'm afraid I don't know what I've done to upset you. I haven't been ignoring
you! I don't mean to be rude but sometimes I don't fully understand what you
are trying to explain to me. Is it possible that you are also
misunderstanding what I am asking.
I'm sorry again and if you re-read any of my posts you will see that I have
not written anything in a rude manner or indeed ignored you!
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OV**************@TK2MSFTNGP15.phx.gbl... Geoff
Yes, that's right.
I don't know what I did that you ignore me in this way, however when you don't want my help than be so polite to answer that in an answer to me.
I will try to remember this in future and not bother you anymore.
Cor
Many thanks Herfried, I will try your code (but first I'll try and
understand it - we live and learn eh?)
Many thanks
Geoff
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:u5**************@TK2MSFTNGP15.phx.gbl... Geoff,
"Geoff Jones" <no********@email.com> schrieb: Thanks for looking at this for me Herfried. Here is my VB version:
Very quick and dirty, but seems to work:
\\\ Private Function GetRegion( _ ByVal _img As Bitmap, _ ByVal color As Color _ ) As Region Dim _matchColor As Color = _ color.FromArgb(color.R, color.G, color.B) Dim rgn As System.Drawing.Region = New Region rgn.MakeEmpty() Dim rc As Rectangle = New Rectangle(0, 0, 0, 0) Dim inimage As Boolean = False Dim x As Integer Dim y As Integer For y = 0 To _img.Height - 1 For x = 0 To _img.Width - 1 If Not (inimage) Then If _ Not color.op_Equality(_img.GetPixel(x, y), _matchColor) _ Then inimage = True rc.X = x rc.Y = y rc.Height = 1 End If Else inimage = False rc.Width = _img.Width - rc.X rgn.Union(rc) End If Next If inimage Then inimage = False rc.Width = _img.Width - rc.X rgn.Union(rc) End If Next Return rgn End Function ///
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
"Geoff Jones" <no********@email.com> schrieb: Many thanks Herfried, I will try your code (but first I'll try and understand it - we live and learn eh?)
Feel free to ask if something is not clear.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Geoff,
You got from me very early a sample, that combined with the sample on MSDN
and that combined with the code Peter was providing you is in my opinion
more than you got now at least from Herfried.
See this thread at a certain moment you are only answering Herfried. Not
Peter, not Zhang, not me.
Therefore spending time for you is a little bit out of sense at least for
me.
Cor
"Geoff Jones" <no********@email.com> Hi Cor
I'm afraid I don't know what I've done to upset you. I haven't been ignoring you! I don't mean to be rude but sometimes I don't fully understand what you are trying to explain to me. Is it possible that you are also misunderstanding what I am asking.
I'm sorry again and if you re-read any of my posts you will see that I have not written anything in a rude manner or indeed ignored you!
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message news:OV**************@TK2MSFTNGP15.phx.gbl... Geoff
Yes, that's right.
I don't know what I did that you ignore me in this way, however when you don't want my help than be so polite to answer that in an answer to me.
I will try to remember this in future and not bother you anymore.
Cor
Cor
Well, again I apologise but to "ignore" you was not intentional. As you can
see, the thread is large with branches in many areas. It also takes me a
long time to read through the code and understand what is going on.
Sadly it appears that even my earlier apology for not thanking you for the
code you sent has not been accepted. I have, in an earlier post, stated
"With your, and others help (ta Peter), it now works :)" BUT I shall now
thank, including yourself, for all your help in this matter. I'm very
grateful for the help I get on the steep learning code of learning VB.NET,
so again many thanks to:
Cor
Peter
Zhang
Herfried
and anybody else that takes up valueable time to help.
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl... Geoff,
You got from me very early a sample, that combined with the sample on MSDN and that combined with the code Peter was providing you is in my opinion more than you got now at least from Herfried.
See this thread at a certain moment you are only answering Herfried. Not Peter, not Zhang, not me.
Therefore spending time for you is a little bit out of sense at least for me.
Cor
"Geoff Jones" <no********@email.com>
Hi Cor
I'm afraid I don't know what I've done to upset you. I haven't been ignoring you! I don't mean to be rude but sometimes I don't fully understand what you are trying to explain to me. Is it possible that you are also misunderstanding what I am asking.
I'm sorry again and if you re-read any of my posts you will see that I have not written anything in a rude manner or indeed ignored you!
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message news:OV**************@TK2MSFTNGP15.phx.gbl... Geoff
Yes, that's right.
I don't know what I did that you ignore me in this way, however when you don't want my help than be so polite to answer that in an answer to me.
I will try to remember this in future and not bother you anymore.
Cor
Hi Herfried
Many thanks for the code Herfried. I've managed to get the application
working as I expected. The code did the trick.
Many thanks for your help.
Geoff
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl... "Geoff Jones" <no********@email.com> schrieb: Many thanks Herfried, I will try your code (but first I'll try and understand it - we live and learn eh?)
Feel free to ask if something is not clear.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Geoff,
It has nothing to do with "thank you",
You did not tell why the approaches we offered you did not fit.
While Peter's last message was in my opinion directly a correct one, did you
directly go on with communicating with Herfried when he came in this thread
and left us alone and even not react on the sample from Peter. At the end
you got an answer from Herfried basicly the same as Peters.
When you had answered me directly on my question "if you had tried my
sample", than I had as well directly told to take the approach of MSDN
sample, combined with mine, and in that the part of Peter.
However next time I will leave you for Herfried to answer your questions,
than this will not happen again. Our answers seem not good enough for you.
In addition, that has nothing to do with thank you.
Cor
Cor
I've looked through the tree again and accept what you are saying. I didn't
reply to Peter or yourself and for that I can only apologise. No excuse!
But, as I have so obviously offended you I'll try not to write to this
newsgroup again.
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl... Geoff,
It has nothing to do with "thank you", You did not tell why the approaches we offered you did not fit. While Peter's last message was in my opinion directly a correct one, did you directly go on with communicating with Herfried when he came in this thread and left us alone and even not react on the sample from Peter. At the end you got an answer from Herfried basicly the same as Peters. When you had answered me directly on my question "if you had tried my sample", than I had as well directly told to take the approach of MSDN sample, combined with mine, and in that the part of Peter. However next time I will leave you for Herfried to answer your questions, than this will not happen again. Our answers seem not good enough for you. In addition, that has nothing to do with thank you. Cor
Geoff,
I am glad that you understand what I was writting, so I forget it and answer
your following questions again normally, I only wanted to show you that this
is not nice for people who wants to help.
Cor
"Ravichandran J.V." <jv************@yahoo.com> schrieb: For WindowsXP and Windows 2000 Go to the Control Panel and change the Settings(to less than 32). Only then it will work.I assume that you have set the FormTransparency Key property.
There are thousands of users who don't run their machine with the required
color depth, so using 'TransparencyKey' for arbitrary shaped forms is not a
good idea.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
"Cor Ligthert" <no************@planet.nl> schrieb: You got from me very early a sample, that combined with the sample on MSDN and that combined with the code Peter was providing you is in my opinion more than you got now at least from Herfried.
Your sample doesn't show how to create an arbitrary shaped form from a
bitmap/mask.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
"Geoff Jones" <no********@email.com> schrieb: But, as I have so obviously offended you I'll try not to write to this newsgroup again.
You are welcome.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/> You got from me very early a sample, that combined with the sample on MSDN and that combined with the code Peter was providing you is in my opinion more than you got now at least from Herfried.
Your sample doesn't show how to create an arbitrary shaped form from a bitmap/mask.
Did I say that?
Cor
"Cor Ligthert" <no************@planet.nl> schrieb: You got from me very early a sample, that combined with the sample on MSDN and that combined with the code Peter was providing you is in my opinion more than you got now at least from Herfried.
Your sample doesn't show how to create an arbitrary shaped form from a bitmap/mask.
Did I say that?
Well, that's what the OP was obviously looking for.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>>>> You got from me very early a sample, that combined with the sample on MSDN and that combined with the code Peter was providing you is in my opinion more than you got now at least from Herfried.
Your sample doesn't show how to create an arbitrary shaped form from a bitmap/mask.
Did I say that?
Well, that's what the OP was obviously looking for.
Because it is posible to make a region direct as any shape, there is no need
to use a bitmap as an intermidiate. However because there could be a slight
reason, it was needed to ask from the OP how and why he was using that
bitmap. But you did not. I would have done.
This is the same as when people ask you on Internet where is Salzburg and
than tell them (from your position) to go to the west, without asking what
is there starting point.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Graphics_master |
last post by:
Anyone know how to create a transparent splash screen similar to Photoshop,
After Effects, or premiere. They have a wonderful transparent look. I
realize that I can use the key color property of...
|
by: Alex Gray |
last post by:
Hi,
I'm trying to make my PictureBox transparent to the BackgroundImage of
the Form, not the BackColor of the form.
Here's what i have:
---------------------------------------------------...
|
by: Jaikumar |
last post by:
Hi,
1) I have created one windows application, In the main form ( form1) i have added one usercontrol (usercontrol1), In that user control i am drawing one image.
2) In the UserControl1 i am...
|
by: don |
last post by:
I want to create a transparent form and can write something on it by using Ink.
I try to set form.backcolor = color.transparent, but it dosen't accept.
And everything will be transprent when i use...
|
by: Chris Auer |
last post by:
I have been banging my head for a couple of hours now. No matter what I
do the color that I make transparent is black. Here is the code I am
using from MSDN. I have tried bitmaps, jpegs, gifs and...
|
by: Grahammer |
last post by:
Is it possible to set the background of a usercontrol as transparent?
I tried setting the background image of the usercontrol to a transparent
GIF, but that caused MAJOR problems.
I'm making...
|
by: Tony Clark |
last post by:
Hi,
I have a bmp that is set in a panel, i want to make the white color in the
bmp image transparent so i can see the color of the panel below. How is
this done?
thanks
tony
|
by: Lucile |
last post by:
Hi All,
I am trying to obtain some sort of a "Model" based on horizontal &
vertical lines (like a frame) drawn on a form or on a PictureBox. For
frames configuration purposes, I created a white...
|
by: MikeB |
last post by:
Hi, I created a picturebox with a map as an image. I want to make
certain areas on the map clickable hotspots and the way I'm trying to
do this is to create a transparent label with a different...
|
by: Dale |
last post by:
I am creating GIF images with transparent backgrounds on-the-fly for a web
app and rendering them by using
System.Drawing.Image.Save(Response.OutputStream, ImageType.GIF).
I am confident that...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |