|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Error on Graphics CompositingMode.SourceCopyI 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) carlodevREM***@gmail.com
Show quote
Hide quote
"Carlo (MCP only)" <carlodevREM***@gmail.com> schrieb I got the same exception. After setting> 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? aGraphicSurface.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel there was no exception anymore. Armin
Show quote
Hide quote
"Armin Zingler" <az.nospam@freenet.de> ha scritto nel messaggio Hello Arminnews:ObC5LEqQGHA.1556@TK2MSFTNGP09.phx.gbl... > "Carlo (MCP only)" <carlodevREM***@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.SingleBitPerPixel > > there was no exception anymore. > > > 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
Show quote
Hide quote
"Carlo (MCP only)" <carlodevREM***@gmail.com> schrieb Yes, by adding "GridFit"> > I got the same exception. After setting > > > > aGraphicSurface.TextRenderingHint = > > System.Drawing.Text.TextRenderingHint.SingleBitPerPixel > > > > 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? Armin
ADO With SQL Transactions
Progressbar and treeview stops refreshing VB doesn't allow temp tables in Stored Procedures? Numeric Variables converting from combobox.text to long() Preventing Explorer Window from Displaying when Pen Drive Inserted Copy files and progressbar sending email when running on diff machine Email validation in grid Can anyone convert this to VB? |
|||||||||||||||||||||||