|
|
Comments and Discussions
|
|
 |
|

|
Thanks, you saved my day.
|
|
|
|

|
"Response" keyword is giving error its saying that 'Response' does not exist in the current context..so plz suggest me solution for this.
|
|
|
|
|

|
Short and to the point. A useful tip.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|

|
This is really COOL, it works beautifully when I run it from within Visual Studio, but unfortunately I get a runtime error when I upload to the server.
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
Any thoughts, ideas or suggestions would be greatly appreciated.
|
|
|
|
|
|

|
The code works great but in my appliaction I'm also tring to fire off a javascript function using <body önload=...> after this code executes.
The problem appears that the HTML code is not passed back to the client whenever the line:
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg)
is included in the code. If I rem out the line, the HTML code is passed back and script is fired off. On a more simplistic note, even simple text within tags is blocked from being sent to the client.
Is this behavior by design?
Thanks,
Bob C.
|
|
|
|

|
It's such simple code, but for the life of me I could not figure out how to do this. Thanks Dolph!
|
|
|
|

|
I am new of aspx, i have downloaded the example and uploaded on my web, in public folder (windows 2003) but it do not work, and appear a screen that say me to change web.config file.
May someone help me!! s
thank'
|
|
|
|

|
Do you know if this example would work for non-English characters (simplified Chinese, to be specific). If not, would a different font work? Or, is there a different solution?
|
|
|
|

|
Help please.. how make highquality render ?
|
|
|
|

|
Hi how is look this code with net 2
|
|
|
|

|
Look same, with net 2.0, it does.
|
|
|
|

|
i have used your code, it worked nice. but i need to make the text vertical.
how can i do that. plz send me solution.
regards
seraj
|
|
|
|

|
Hello,
Very nice your code mas I'd like change the Font color. How do i do?
thx
Marcelo
|
|
|
|

|
use SolidBrush object in drawstring method of Graphıc object
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("memati.jpg"));
Graphics graphicImage = Graphics.FromImage( bitMapImage);
SolidBrush brush = new SolidBrush(Color.FromArgb(255, Color.Red));
graphicImage.DrawString( "MEMATI'DEN SEVGILERLE", new Font("Lucida Handwriting", 30,FontStyle.Italic ),brush , new Point( 100, 100 ) );
|
|
|
|

|
METATI adamlara türkçede ögretisiyosunya nediyim helal olsun sana
|
|
|
|

|
Just as a quick improvement, never put a Dispose() inside a try catch, this is really important when dealing with Graphics class as you are still able to leak memory with it. You should change the SetBMP() method to:
private void SetBMP()
{
try
{
/* Code Removed for Size. */
if (Path.GetExtension(fileName).ToLower() != ".bmp")
{
Bitmap theImage = new Bitmap(fileName);
fileName = Path.Combine(mySetting.m_settingsPath , "new.bmp");
theImage.Save (fileName, System.Drawing.Imaging.ImageFormat.Bmp);
// REMOVE THIS LINE - theImage .Dispose();
}
/* Code Removed for Size . */
}
catch (Exception ex)
{
Trace.WriteLine(ex.ToString());
}
finally
{
theImage.Dispose(); // PUT IN THIS LINE
}
}
Jason Shaver
jshaver"at"usbiometrics.com
|
|
|
|

|
Actually, being picky, it's better to write a "using" block, because, if in your code, the error occurs on the constructor (e.g., a file not found), the theImage variable may be null on the finally block. Not to mention that the variable should be declared outside the try block to be accessible on the finally block.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|

|
Yes! Thanks! You are absolutely correct.
|
|
|
|

|
I used your code which worked fine, but many users are having trouble printing from their browser which I don't get. They see the image, but print an x from i.e and this is about 20% of the users
|
|
|
|

|
:-DHere you have the same code in a aspx page, this is usefull for those who dont have visual studio, as me Its very easy, you only need to change the imports... ; <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %> <%@ Import Namespace="System.Drawing"%> <%@ Import Namespace="System.Drawing.Imaging"%> <%@ Import Namespace="System.Drawing.Drawing2D"%> <%@ Import Namespace="System.Drawing.Text"%> <% Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("dallen.jpg") ); Graphics graphicImage = Graphics.FromImage(bitMapImage); graphicImage.SmoothingMode = SmoothingMode.AntiAlias; graphicImage.DrawString( "VIVA EL FARY", new Font("Arial", 12,FontStyle.Bold ), SystemBrushes.WindowText, new Point( 100, 250 ) ); graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360); Response.ContentType="image/jpeg"; bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg); graphicImage.Dispose(); bitMapImage.Dispose(); %>
|
|
|
|

|
I'm amazed to see how many people are so masochistic not to use Visual Studio and keep programming .net as if it is PHP or other old-generation scripting languages and lose all of the advantages offered by the development environment. If it's about money I wonder how much you make to afford losing lots of time with notepad-like editors without intellisense and normal project management, turning everything into a bunch of scripts, not a normal project with shared classes etc.
|
|
|
|

|
That's a really useful bit of code - might well come in handy
Thanks a lot!
Steven
|
|
|
|

|
Hi
This is brilliant but I wondered if there was a way of doing the same in classic ASP?
Andy
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
If you have a pre-existing graphic and you want to write some text over it...
| Type | Article |
| Licence | |
| First Posted | 17 Jun 2004 |
| Views | 147,379 |
| Bookmarked | 60 times |
|
|