Results 1 to 2 of 2

Thread: DrawString problem.

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    6

    DrawString problem.

    I'm writing a small game using GDI+ and I'm using the DrawString method of the Graphics object to write letters to a bitmap, one by one, in order to give the impression of a string being displayed letter at a time.

    The gist of it is:

    Code:
    // Sentence to be drawn.
    string strText = NPC.Name + ": " + NPC.GetDialogElement(DialogCounter);
    // Split the sentence into letters.
    char[] CharacterArray = strText.ToCharArray()
    string strBuildingString = "";
    
    foreach (char Character in CharacterArray)
    {					
            strBuildingString += Character.ToString();
            GFX.DrawString(BuildingString,fntFont,beigeBrush,130,413);
            Form.Invalidate()
    }
    The problem is that after about 20 to 30 characters being printed, the DrawString method appears to start drawing the string with a greater space between each letter. After about 50 characters, it goes back to normal spacing. I have no idea what's causing this. I assume it's to do with the framework, rather than my own code because I can't see anything wrong with my own.

    Thanks for your help!

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: DrawString problem.

    Try to draw the same letter over 20 or 30 and see if it produce the same result. also try using another font .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width