Click here to Skip to main content
15,893,722 members
Home / Discussions / C#
   

C#

 
GeneralRe: Errors compiling... Pin
Guffa3-Apr-06 12:00
Guffa3-Apr-06 12:00 
GeneralRe: Errors compiling... Pin
Colin Angus Mackay3-Apr-06 12:27
Colin Angus Mackay3-Apr-06 12:27 
JokeRe: Errors compiling... Pin
Guffa3-Apr-06 12:53
Guffa3-Apr-06 12:53 
GeneralRe: Errors compiling... Pin
Colin Angus Mackay3-Apr-06 12:56
Colin Angus Mackay3-Apr-06 12:56 
AnswerRe: Errors compiling... Pin
Christian Graus3-Apr-06 15:10
protectorChristian Graus3-Apr-06 15:10 
AnswerRe: Errors compiling... Pin
HimaBindu Vejella3-Apr-06 20:25
HimaBindu Vejella3-Apr-06 20:25 
QuestionCOM and XslCompiledTransform.Load() Pin
ardikus3-Apr-06 11:16
ardikus3-Apr-06 11:16 
QuestionPrivateFontCollection not working on server Pin
elraton3-Apr-06 11:15
elraton3-Apr-06 11:15 
HI.

I'm creating a dinamic image that types something with a spetial font. Of course, I have the font not installed on the server fonts dir, so I have to use it with a PrivateFontCollection.
My problem is that the code works in my local server (where I also don't have the font installed on my fonts dir), but when I uplad it to my host, it renders the text in arial, not on my font.

any ideas?

here's the code:

<br />
            Bitmap oImage = new Bitmap(400,50,PixelFormat.Format32bppArgb);<br />
            Graphics oGraphics = Graphics.FromImage(oImage);<br />
<br />
            MemoryStream streamMemory = new MemoryStream();<br />
<br />
            oGraphics.Clear(Color.Transparent);<br />
<br />
            Color cInk = Color.FromArgb (127,0,0,0);<br />
<br />
            Brush oBrush = new SolidBrush(cInk);<br />
            //oGraphics.FillRectangle(oBrushBack, 0, 0, 400, 60);<br />
<br />
            // Create a private font collection<br />
            PrivateFontCollection pfc = new PrivateFontCollection();<br />
            // Load in the temporary barcode font<br />
            pfc.AddFontFile(Server.MapPath("Mael____.ttf"));<br />
            // Select the font family to use<br />
            FontFamily family = pfc.Families[0];<br />
            // Create the font object with size 28<br />
            Font oFont = new Font(family, 28);<br />
<br />
<br />
            oGraphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;<br />
            //oGraphics.FillRectangle(oBrush, 3, 3, 50, 100);          <br />
<br />
            //Get text from param.<br />
            string sText = "";<br />
            try {<br />
                sText = (Request.Params["Text"]);<br />
            }<br />
            catch{}<br />
<br />
            oGraphics.DrawString(sText, oFont, oBrush, 1, 1);<br />
<br />
            Response.ContentType = "image/png";<br />
            <br />
            oImage.Save(streamMemory, ImageFormat.Png);<br />
        <br />
            Byte[] buffer = streamMemory.ToArray();<br />
            Response.Clear();<br />
            Response.OutputStream.Write(buffer, 0, buffer.Length);<br />
          <br />
  //' Clean up.<br />
            Response.End();<br />
            streamMemory.Close();<br />
            oGraphics.Dispose();<br />
            oImage.Dispose();<br />

QuestionUnique hardware id Pin
Kasic Slobodan3-Apr-06 10:13
Kasic Slobodan3-Apr-06 10:13 
AnswerRe: Unique hardware id Pin
Ravi Bhavnani3-Apr-06 11:00
professionalRavi Bhavnani3-Apr-06 11:00 
AnswerRe: Unique hardware id Pin
Divyang Mithaiwala3-Apr-06 19:52
Divyang Mithaiwala3-Apr-06 19:52 
GeneralRe: Unique hardware id Pin
Kasic Slobodan4-Apr-06 10:13
Kasic Slobodan4-Apr-06 10:13 
Questionreporting via exxel or microsoft word ?! Pin
mrkeivan3-Apr-06 8:46
mrkeivan3-Apr-06 8:46 
AnswerRe: reporting via exxel or microsoft word ?! Pin
Ed.Poore3-Apr-06 9:04
Ed.Poore3-Apr-06 9:04 
GeneralRe: reporting via exxel or microsoft word ?! Pin
mrkeivan3-Apr-06 12:55
mrkeivan3-Apr-06 12:55 
GeneralRe: reporting via exxel or microsoft word ?! Pin
Ed.Poore3-Apr-06 20:34
Ed.Poore3-Apr-06 20:34 
GeneralRe: reporting via exxel or microsoft word ?! Pin
mrkeivan4-Apr-06 5:53
mrkeivan4-Apr-06 5:53 
QuestionProgrammatically adding TabPage Contents into DataGrid from XML File Pin
AnneThorne3-Apr-06 8:41
AnneThorne3-Apr-06 8:41 
QuestionDrag and Drop Label in a Panel Pin
cbeasle13-Apr-06 7:42
cbeasle13-Apr-06 7:42 
AnswerRe: Drag and Drop Label in a Panel Pin
Robert Rohde3-Apr-06 8:10
Robert Rohde3-Apr-06 8:10 
Questionwhy is the program running so slow Pin
Agyeman3-Apr-06 6:39
Agyeman3-Apr-06 6:39 
AnswerRe: why is the program running so slow Pin
Ed.Poore3-Apr-06 7:47
Ed.Poore3-Apr-06 7:47 
GeneralRe: why is the program running so slow Pin
Agyeman3-Apr-06 8:15
Agyeman3-Apr-06 8:15 
GeneralRe: why is the program running so slow Pin
Guffa3-Apr-06 7:55
Guffa3-Apr-06 7:55 
QuestionApplication.Exit() - How do I return an exit code. Pin
Mark42623-Apr-06 6:36
Mark42623-Apr-06 6:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.