First rectangle in bitmap renders as transparent if white or nearly white (vb.net)

First rectangle in bitmap renders as transparent if white or nearly white (vb.net)

Post by Wayne Erfl » Thu, 28 Dec 2006 05:04:09


his is a multi-part message in MIME format.


We have a vb.net object that creates a bitmap and eventually renders it to an .EMF file; then it is viewed via Internet Explorer. The second rectangle renders as transparent if the color is from RGB 253,253,253 through Color.White. From 252,252,252 on "down" paints as coded.

We want this rectangle to pain as coded, including when it is set to white.

The first steps in creating the graphic are to write a border rectangle and then a fill rectangle just inside that border rectangle:

'Create brushes
Dim ObjBrush As New SolidBrush(clrBorderColor)
Dim objBrush2 As New SolidBrush(clrFillColor)

'Create a rectangle to set the boundaries to the bitmap boundaries
Dim objRect As Rectangle = New Rectangle(0, 0, intLength, intHeight)
Dim objRect2 As Rectangle = New Rectangle(intBorderThickness, intBorderThickness, intLength - 2 * intBorderThickness, intHeight - 2 *
intBorderThickness)
'Add a rectangle to the image
objGraphics.FillRectangle(ObjBrush, objRect)
objGraphics.FillRectangle(objBrush2, objRect2) ' this paints as transparent if the color is too close to white.

We also tried calling bitmap.MakeTransparent(Color.LimeGreen), but this had no effect.

Any help appreciated on painting WHITE to a bitmap.

---Wayne Erfling

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.5730.11" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#c0dcc0>
<DIV><FONT face=Arial size=2>We have a vb.net object that creates a bitmap and
eventually renders it to an .EMF file; then it is viewed via Internet
Explorer.  The second rectangle renders as transparent if the color is from
RGB 253,253,253 through Color.White.  From 252,252,252 on "down" paints as
coded.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>We want this rectangle to pain as coded, including
when it is set to white.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The first steps in creating the graphic are to
write a border rectangle and then a fill rectangle just inside that border
rectangle:</FONT></DIV>
<DIV><FONT color=#008000 size=2></FONT> </DIV>
<DIV><FONT color=#008000 size=2>'Create brushes<BR></FONT><FONT color=#0000ff
size=2>Dim</FONT><FONT size=2> ObjBrush </FONT><FONT color=#0000ff
size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>New</FONT><FONT
size=2> SolidBrush(clrBorderColor)<BR></FONT><FONT color=#0000ff
size=2>Dim</FONT><FONT size=2> objBrush2 </FONT><FONT color=#0000ff
size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>New</FONT><FONT
size=2> SolidBrush(clrFillColor)<BR></FONT><FONT color=#008000
size=2></FONT></DIV>
<DIV><FONT color=#008000 size=2>'Create a rectangle to set the boundaries to the
bitmap boundaries<BR></FONT><FONT color=#0000ff size=2>Dim</FONT><FONT size=2>
obj
 
 
 

First rectangle in bitmap renders as transparent if white or nearly white (vb.net)

Post by Thorsten A » Sun, 31 Dec 2006 03:00:32

Wayne Erfling < XXXX@XXXXX.COM > schrieb im Beitrag
< XXXX@XXXXX.COM >...

Sorry, but this newsgroup is related to Visual Basic <= 6.0 ('Classic') and
not to Visual Basic.NET which is a - more or less - completely different
programming language. Please ask your question in a group related to VB.NET
(look out for the "dotnet" groups).

--
----------------------------------------------------------------------
THORSTEN ALBERS Universit Freiburg
albers@
uni-freiburg.de
----------------------------------------------------------------------