473,383 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Error on Graphics CompositingMode.SourceCopy

Hi all
I need to write some strings on a Graphic surface of a simple control with a
color that is not blend with background color.
To get this, I simply need set CompositingMode to SourceCopy.
This is the code:

Dim aGraphicSurface As Graphics = CType(mObject,
Control).Parent.CreateGraphics
aGraphicSurface.CompositingMode = CompositingMode.SourceCopy
aGraphicSurface.DrawString(mCaptionText, mCaptionFont, _
New SolidBrush(mCaptionColor), _
mTextRectangle, _
mStringFormat)

The above code reises me an ArgumentException (invalid parameter) error.

I cannot understand why the error is raised.
Some additional notes:
DrawImage works correctly.
Removing aGraphicSurface.CompositingMode = CompositingMode.SourceCopy
everything works correctly.
I also tried to set different Alpha levels of mCaptionColor.
I also tried to change other Graphics setings (such as CompositionQuality,
InterpolationMode, SmoothingMode, TextRenderingHint, ecc.), without results.

Could you please help me?

Thank yuu,

Carlo

-------------------------------------------
Carlo, MCP (Windows Based Applications)
ca************@gmail.com

Mar 8 '06 #1
3 2477
"Carlo (MCP only)" <ca************@gmail.com> schrieb
Hi all
I need to write some strings on a Graphic surface of a simple
control with a color that is not blend with background color.
To get this, I simply need set CompositingMode to SourceCopy.
This is the code:

Dim aGraphicSurface As Graphics = CType(mObject,
Control).Parent.CreateGraphics
aGraphicSurface.CompositingMode = CompositingMode.SourceCopy
aGraphicSurface.DrawString(mCaptionText, mCaptionFont, _
New SolidBrush(mCaptionColor), _
mTextRectangle, _
mStringFormat)

The above code reises me an ArgumentException (invalid parameter)
error.

I cannot understand why the error is raised.
Some additional notes:
DrawImage works correctly.
Removing aGraphicSurface.CompositingMode =
CompositingMode.SourceCopy everything works correctly.
I also tried to set different Alpha levels of mCaptionColor.
I also tried to change other Graphics setings (such as
CompositionQuality, InterpolationMode, SmoothingMode,
TextRenderingHint, ecc.), without results.

Could you please help me?

I got the same exception. After setting

aGraphicSurface.TextRenderingHint =
System.Drawing.Text.TextRenderingHint.SingleBitPer Pixel

there was no exception anymore.
Armin

Mar 8 '06 #2
"Armin Zingler" <az*******@freenet.de> ha scritto nel messaggio
news:Ob**************@TK2MSFTNGP09.phx.gbl...
"Carlo (MCP only)" <ca************@gmail.com> schrieb
Hi all
I need to write some strings on a Graphic surface of a simple
control with a color that is not blend with background color.
To get this, I simply need set CompositingMode to SourceCopy.
This is the code:

Dim aGraphicSurface As Graphics = CType(mObject,
Control).Parent.CreateGraphics
aGraphicSurface.CompositingMode = CompositingMode.SourceCopy
aGraphicSurface.DrawString(mCaptionText, mCaptionFont, _
New SolidBrush(mCaptionColor), _
mTextRectangle, _
mStringFormat)

The above code reises me an ArgumentException (invalid parameter)
error.

I cannot understand why the error is raised.
Some additional notes:
DrawImage works correctly.
Removing aGraphicSurface.CompositingMode =
CompositingMode.SourceCopy everything works correctly.
I also tried to set different Alpha levels of mCaptionColor.
I also tried to change other Graphics setings (such as
CompositionQuality, InterpolationMode, SmoothingMode,
TextRenderingHint, ecc.), without results.

Could you please help me?

I got the same exception. After setting

aGraphicSurface.TextRenderingHint =
System.Drawing.Text.TextRenderingHint.SingleBitPer Pixel

there was no exception anymore.
Armin

Hello Armin

thank you very much for the suggestion. I noted, however, that setting
TextRenderingHint = TextRenderingHint.SingleBitPerPixel causes a dramatic
text quality loss. Did you solved this problem in some way?

Thnk you

Carlo
Mar 9 '06 #3
"Carlo (MCP only)" <ca************@gmail.com> schrieb
I got the same exception. After setting

aGraphicSurface.TextRenderingHint =
System.Drawing.Text.TextRenderingHint.SingleBitPer Pixel

there was no exception anymore.
Armin

Hello Armin

thank you very much for the suggestion. I noted, however, that
setting TextRenderingHint = TextRenderingHint.SingleBitPerPixel
causes a dramatic text quality loss. Did you solved this problem in
some way?

Yes, by adding "GridFit"
Armin
Mar 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: berkay | last post by:
hi all,am trying to learn how to use the graphics library,i downloaded the header file and the program from this site: http://rabbit.eng.miami.edu/class/library/oldindex.html and am using VC++...
18
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12,...
1
by: active | last post by:
ANYONE HAVE ANY IDEA WHAT IS CAUSING THESE ERRORS. HAPPENS ONLY IF I "START' NOT IF I "START WITHOUT DEBUG" I HAVE NO IDEA WHERE TO LOOK FOR THE BUG An unhandled exception of type...
2
by: Piedro | last post by:
Can someone reproduce the following error? I'm using the module at the bottom of my post to owner draw a menu items, I call the module from a form like this: Private Sub mnuOpen_DrawItem(ByVal...
7
by: ddd | last post by:
Hi, I am having problems with using the DrawToDC of the MSHTML.iHTMLElementRender in a VB.net application. For some reason I am getting a "catastrophic error". I am basing the code on c#...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
1
by: kCura | last post by:
First off, I'm sorry if this isn't the write thread to post this message but I couldn't find one dedicated to System.Drawing. I'm developing an intranet application in VB.NET that uses a Hosted...
2
by: raylopez99 | last post by:
I can't get the below code to work, no matter how many times I change it. I do have the Image file, Image1, created (in another method), and using "hard coding" I can save it (it's a filled...
7
by: j4richard | last post by:
Help please, I am getting this "Unhandled Exception has occurred in your application" " A Generic error occurred in GDI+" See the end of this message for details on...
0
isladogs
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.