Click here to Skip to main content
15,915,019 members
Home / Discussions / C#
   

C#

 
AnswerRe: Base Class or common static method? Pin
Maqsood Ahmed3-Apr-06 20:38
Maqsood Ahmed3-Apr-06 20:38 
GeneralRe: Base Class or common static method? Pin
moazzamahmed4-Apr-06 6:11
moazzamahmed4-Apr-06 6:11 
AnswerRe: Base Class or common static method? Pin
Nicholas Butler3-Apr-06 22:07
sitebuilderNicholas Butler3-Apr-06 22:07 
GeneralRe: Base Class or common static method? Pin
Maqsood Ahmed4-Apr-06 2:04
Maqsood Ahmed4-Apr-06 2:04 
Question----how can I recieve a custom message sent from COM server to C# client? Pin
dragooooon lee3-Apr-06 19:40
dragooooon lee3-Apr-06 19:40 
QuestionCommandBuilder.DeriveParameters Pin
ShivT3-Apr-06 19:11
ShivT3-Apr-06 19:11 
Questionblinking form Pin
Yulianto.3-Apr-06 14:23
Yulianto.3-Apr-06 14:23 
AnswerRe: blinking form Pin
Igor Sukhov3-Apr-06 14:39
Igor Sukhov3-Apr-06 14:39 
AnswerRe: blinking form Pin
Sean893-Apr-06 15:57
Sean893-Apr-06 15:57 
QuestionErrors compiling... Pin
KORCARI3-Apr-06 11:50
KORCARI3-Apr-06 11:50 
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 

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.