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:
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.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() }
Thanks for your help!




Reply With Quote