Similar Threads
1. Transparent and Semi Transparent panels?
2. Windows Form non rectangular (using semi transparent background image (PNG)) and C# 2005 (EXPRESS)
Hi,
I'm trying to create a non rectangular windows form using a PNG image
with transparent zones and I want that this zones appears as transparent
in the windows form.
Before, on VS.NET 2003, I do that simply putting this background image
and setting the form with no borders, but now it don't work.
There's any way to do that ?
Regards...
3. Drawing Opaque controls on top of a semi-transparent form
4. semi-transparent line
Hi,
What's the simplest way to draw a semi-transparent (alpha blended) line?
I can draw alpha-blended images using the ImageAttributes parameter of the
DrawImage method, but the drawline method doesn't have an overload with an
IA parameter.
Thanks,
Norvin
5. GDI+ Flat API Semi-Transparent Image Problems
6. Problems trying to paint semi-transparent metafile polygons.
I am creating an app that plays a metafile on top of a image (e.g, jpg).
Specific polygons within the metafile need to have their original colour
replaced with a semi-transparent colour of my choice. I have no problem with
the colour substitution but I cannot get the transparency effect. My approach
is as follows:
1) I am using EnumerateMetafile and a callback function to identify and
process the relevant metafile polygons.
2) Prior to enumeration, I am setting up a ColorMap to specify how the
metafile polygon colours will be replaced. The new colour is constructed
using Color.FromArgb() with an Alpha value to control transparency.
3) The ColorMap is then used with SetRemapTable in an ImageAttributes object.
4) The ImageAttributes is provided to EnumerateMetafile
PlayRecord is called for the relevant polygons within the callback method.
In theory, it should render the polygon and apply the colour substitutions as
specifed by the ImageAttributes information. The colour substitution is
working fine,
BUT the new colour is rendered 100% opaque (i.e., no transparency). It does
not matter what Alpha value I use. It is behaving like the Alpha value is
ignored. Code snippets follow.
Enumeration Method snippet:
private void UserControl1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
<snip>
if ( myMetaFile != null )
{
Graphics.EnumerateMetafileProc fnCallback = new
Graphics.EnumerateMetafileProc( MetafileCallback );
ColorMap[] myColorMap = new ColorMap[1];
myColorMap[0] = new ColorMap();
myColorMap[0].OldColor = Color.White;
myColorMap[0].NewColor = Color.FromArgb(35, 0, 255, 0); // Note the Alpha
value (35)
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetRemapTable(myColorMap);
g.EnumerateMetafile( myMetaFile,
new Rectangle( pictureLocation, pictureSize ),
fnCallback,
IntPtr.Zero,
imageAttr );
}
Callback Method snippet:
private bool MetafileCallback(
EmfPlusRecordType recordType,
int flags,
int dataSize,
IntPtr data,
PlayRecordCallback callbackData)
{
byte[] metafileRecordData = null;
if (data != IntPtr.Zero)
{
metafileRecordData = new byte[dataSize];
Marshal.Copy(data, metafileRecordData, 0, dataSize);
}
if (recordType == EmfPlusRecordType.EmfPolygon16)
{
mtfBoxB.PlayRecord( recordType, flags, dataSize, metafileRecordData );
<snip>
Any help would be appreciated.
Regards,
Dave Clarkson
7. Form Transparency, click through semi transparent form
8. Semi-transparent context menu using ContextMenuStrip
Hello,
I use ContextMenuStrip control for context menu, which will be evoked
by right mouse click in my application. Additional requirement is to
create the context menu more "visually appealing" - to be more precise,
the background of the menu should be transparent, while the individual
menu items should be semi-transparent using gradiends.
I am developing my own ToolStripRenderer class, which I then set to
Renderer property of the ContextMenuStrip instance. I was already able
to change the appearance of the menu items to some extent with this
approach. But I am still not able to create the whole context menu
transparent (it means, that if there is a picture behind the menu, it
should be visible). Do you have some hints about how to achieve this,
or whether there are some good articles about this topic? I did a lot
of search yesterday, but there seems to be no much info about Windows
Forms 2.0 yet.
Or is there any completely different approach (like use other classes)
to achieve this behaviour?
Thank you!