By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,729 Members | 1,167 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,729 IT Pros & Developers. It's quick & easy.

Transparency of shaped forms?

P: n/a
Hi all,

I have an odd shaped graphic I would like to use as my interface (see it
here at http://www.mokee.com/vbot/ver3/face.jpg) The part I want to be
transparent on the image is red. I set the background image of my form to
be this image (actually a transparent png version), then I set the
transparency key to red as well. Instead of the shaped form I thought I
would have, I now have the graphic with a white border as my form.

Is there a way to get this transparent? I see the fact that VS.Net has some
transparency issues being discussed around the net. If I set some
components to red bg, they are transparent, but not the silly background
image! Has anyone found an easy fix for this? Sorry if this has been
answered, but I just could not find a solution that actually worked for
me...

Thanks in advance!
--
vbot [at] mokee.com
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Here:

http://www.codeguru.com/cs_misc/BitmapToRegion.html

"vBOT" <vb**@nospam.mokee.com> wrote in message
news:Xn***********************@199.45.49.11...
Hi all,

I have an odd shaped graphic I would like to use as my interface (see it
here at http://www.mokee.com/vbot/ver3/face.jpg) The part I want to be
transparent on the image is red. I set the background image of my form to
be this image (actually a transparent png version), then I set the
transparency key to red as well. Instead of the shaped form I thought I
would have, I now have the graphic with a white border as my form.

Is there a way to get this transparent? I see the fact that VS.Net has some transparency issues being discussed around the net. If I set some
components to red bg, they are transparent, but not the silly background
image! Has anyone found an easy fix for this? Sorry if this has been
answered, but I just could not find a solution that actually worked for
me...

Thanks in advance!
--
vbot [at] mokee.com

Nov 15 '05 #2

P: n/a
"vBOT" <vb**@nospam.mokee.com> wrote in message
news:Xn***********************@199.45.49.11...
I have an odd shaped graphic I would like to use as my interface (see
it here at http://www.mokee.com/vbot/ver3/face.jpg) The part I want
to be transparent on the image is red. I set the background image of
my form to be this image (actually a transparent png version), then I
set the transparency key to red as well. Instead of the shaped form I
thought I would have, I now have the graphic with a white border as
my form.

Is there a way to get this transparent? I see the fact that VS.Net
has

some
transparency issues being discussed around the net. If I set some
components to red bg, they are transparent, but not the silly
background image! Has anyone found an easy fix for this?

"Erik Frey" <er*******@hotmail.com> wrote in
news:OG**************@TK2MSFTNGP11.phx.gbl:

Here:

http://www.codeguru.com/cs_misc/BitmapToRegion.html


Erik,

Thanks for the link! I tried to add the .cs file into my own project,
but it's giving me a headache. It keeps telling me I can't call the
convert routine as a static. I've been using Delphi for years and
switching to C# is a bit confusing. Think I need to do some more
learning about the correct structure of classes within the namespace
before I tackle this. Hate being a newbie again...

--
vbot [at] mokee.com
Nov 15 '05 #3

P: n/a
Your project is probably in a different namespace, so to access the
BitmapToRegion class (as it is defined in its .cs file) you have to refer to
it within its BitmapToRegion namespace (a little confusing):

this.Region = BitmapToRegion.BitmapToRegion.Convert( bm, col,
TransparencyMode.ColorKeyTransparent );

or, just move the class (and the enum it uses) into one of your own
namespaces. However your project is structured.

Also, because the code is unsafe, you will probably want to put the
BitmapToRegion class in its own project (create a new class library and call
it Graphics, perhaps), then you must edit the project settings ->
configuration properties -> Allow Unsafe Code Blocks -> True.

Hope that helps,

Erik

"vBOT" <vb**@nospam.mokee.com> wrote in message
news:Xn***********************@199.45.49.11...
"vBOT" <vb**@nospam.mokee.com> wrote in message
news:Xn***********************@199.45.49.11...
I have an odd shaped graphic I would like to use as my interface (see
it here at http://www.mokee.com/vbot/ver3/face.jpg) The part I want
to be transparent on the image is red. I set the background image of
my form to be this image (actually a transparent png version), then I
set the transparency key to red as well. Instead of the shaped form I
thought I would have, I now have the graphic with a white border as
my form.

Is there a way to get this transparent? I see the fact that VS.Net
has

some
transparency issues being discussed around the net. If I set some
components to red bg, they are transparent, but not the silly
background image! Has anyone found an easy fix for this?

"Erik Frey" <er*******@hotmail.com> wrote in
news:OG**************@TK2MSFTNGP11.phx.gbl:

Here:

http://www.codeguru.com/cs_misc/BitmapToRegion.html


Erik,

Thanks for the link! I tried to add the .cs file into my own project,
but it's giving me a headache. It keeps telling me I can't call the
convert routine as a static. I've been using Delphi for years and
switching to C# is a bit confusing. Think I need to do some more
learning about the correct structure of classes within the namespace
before I tackle this. Hate being a newbie again...

--
vbot [at] mokee.com

Nov 15 '05 #4

P: n/a
"Erik Frey" <er*******@hotmail.com> wrote in
news:eO**************@TK2MSFTNGP10.phx.gbl:
Your project is probably in a different namespace, so to access
the
BitmapToRegion class (as it is defined in its .cs file) you have to
refer to it within its BitmapToRegion namespace (a little confusing):

this.Region = BitmapToRegion.BitmapToRegion.Convert( bm, col,
TransparencyMode.ColorKeyTransparent );

or, just move the class (and the enum it uses) into one of your
own
namespaces. However your project is structured.

Also, because the code is unsafe, you will probably want to put
the
BitmapToRegion class in its own project (create a new class library
and call it Graphics, perhaps), then you must edit the project
settings -> configuration properties -> Allow Unsafe Code Blocks ->
True.

Hope that helps,

Erik

"vBOT" <vb**@nospam.mokee.com> wrote in message
news:Xn***********************@199.45.49.11...
>> "vBOT" <vb**@nospam.mokee.com> wrote in message
>> news:Xn***********************@199.45.49.11...
>> I have an odd shaped graphic I would like to use as my interface
>> (see it here at http://www.mokee.com/vbot/ver3/face.jpg) The part
>> I want to be transparent on the image is red. I set the background
>> image of my form to be this image (actually a transparent png
>> version), then I set the transparency key to red as well. Instead
>> of the shaped form I thought I would have, I now have the graphic
>> with a white border as my form.
>>
>> Is there a way to get this transparent? I see the fact that VS.Net
>> has
> some
>> transparency issues being discussed around the net. If I set some
>> components to red bg, they are transparent, but not the silly
>> background image! Has anyone found an easy fix for this?
>
>
> "Erik Frey" <er*******@hotmail.com> wrote in
> news:OG**************@TK2MSFTNGP11.phx.gbl:
>
> Here:
>
> http://www.codeguru.com/cs_misc/BitmapToRegion.html
>


Erik,

Thanks for the link! I tried to add the .cs file into my own project,
but it's giving me a headache. It keeps telling me I can't call the
convert routine as a static. I've been using Delphi for years and
switching to C# is a bit confusing. Think I need to do some more
learning about the correct structure of classes within the namespace
before I tackle this. Hate being a newbie again...

--
vbot [at] mokee.com



It does help greatly - thanks! In the end, however, I found a great
reference on Bob Powell's site:

http://www.bobpowell.net/region_from_bitmap.htm

I took his idea and changed it a bit to apply to my project and it works
brilliantly. I can now programmatically create new forms and change
their shape as needed through a hidden main form. And without the use of
"unsafe code", which makes me feel a bit better.

The more I program and discover things in csharp, the more I like it!

--
vbot [at] mokee.com
Nov 15 '05 #5

P: n/a
Cool! You're right - this is a more comfortable implementation. Thanks
for the link.

"vBOT" <vb**@nospam.mokee.com> wrote in message
news:Xn***********************@199.45.49.11...
"Erik Frey" <er*******@hotmail.com> wrote in
news:eO**************@TK2MSFTNGP10.phx.gbl:
Your project is probably in a different namespace, so to access
the
BitmapToRegion class (as it is defined in its .cs file) you have to
refer to it within its BitmapToRegion namespace (a little confusing):

this.Region = BitmapToRegion.BitmapToRegion.Convert( bm, col,
TransparencyMode.ColorKeyTransparent );

or, just move the class (and the enum it uses) into one of your
own
namespaces. However your project is structured.

Also, because the code is unsafe, you will probably want to put
the
BitmapToRegion class in its own project (create a new class library
and call it Graphics, perhaps), then you must edit the project
settings -> configuration properties -> Allow Unsafe Code Blocks ->
True.

Hope that helps,

Erik

"vBOT" <vb**@nospam.mokee.com> wrote in message
news:Xn***********************@199.45.49.11...

>> "vBOT" <vb**@nospam.mokee.com> wrote in message
>> news:Xn***********************@199.45.49.11...
>> I have an odd shaped graphic I would like to use as my interface
>> (see it here at http://www.mokee.com/vbot/ver3/face.jpg) The part
>> I want to be transparent on the image is red. I set the background
>> image of my form to be this image (actually a transparent png
>> version), then I set the transparency key to red as well. Instead
>> of the shaped form I thought I would have, I now have the graphic
>> with a white border as my form.
>>
>> Is there a way to get this transparent? I see the fact that VS.Net
>> has
> some
>> transparency issues being discussed around the net. If I set some
>> components to red bg, they are transparent, but not the silly
>> background image! Has anyone found an easy fix for this?
>
>
> "Erik Frey" <er*******@hotmail.com> wrote in
> news:OG**************@TK2MSFTNGP11.phx.gbl:
>
> Here:
>
> http://www.codeguru.com/cs_misc/BitmapToRegion.html
>

Erik,

Thanks for the link! I tried to add the .cs file into my own project,
but it's giving me a headache. It keeps telling me I can't call the
convert routine as a static. I've been using Delphi for years and
switching to C# is a bit confusing. Think I need to do some more
learning about the correct structure of classes within the namespace
before I tackle this. Hate being a newbie again...

--
vbot [at] mokee.com



It does help greatly - thanks! In the end, however, I found a great
reference on Bob Powell's site:

http://www.bobpowell.net/region_from_bitmap.htm

I took his idea and changed it a bit to apply to my project and it works
brilliantly. I can now programmatically create new forms and change
their shape as needed through a hidden main form. And without the use of
"unsafe code", which makes me feel a bit better.

The more I program and discover things in csharp, the more I like it!

--
vbot [at] mokee.com

Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.