Hallo Leute,
eigentlich ist meine DLL noch nicht mal richtig angefangen aber schon hab ich eine unüberwindbare Aufgabe.
Ich möchte in einer DLL eine Funktion haben, die anhand einer bestimmten Schriftart, Größe, Flags, und der Größe eines Textfeldes, zurück gibt wo ein Zeilenumbruch gemacht werden muss.
Das Problem ist, das ich in einer Bibliothek kein Textfeld erstellen kann. Ich bekomme ein Handle Fehler (dieser kann nicht erstellt werden). Aber diese brauch ich weil ich ansonsten meine "my_Graphics" nicht initialisieren kann.
meine Funktion sieht so aus: Diese Wird aber noch massiv umgebaut, wenn es so überhaupt funktionieren kann.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47:
| public float breite(string Text, string Font_Family, float Font_Size, bool Font_Italic, bool Font_underline, bool Font_Bold) { Graphics my_Graphics;
TextBox my_TextBox = new TextBox(); my_Graphics = my_TextBox.CreateGraphics();
FontStyle my_FontStyle; Font my_Font;
if (Font_Italic) { my_FontStyle = FontStyle.Italic; if(Font_underline) { my_FontStyle = my_FontStyle | FontStyle.Underline; if(Font_Bold) { my_FontStyle = my_FontStyle | FontStyle.Bold;
} } } else if(Font_underline) { my_FontStyle = FontStyle.Underline; if(Font_Bold) { my_FontStyle = my_FontStyle | FontStyle.Bold; } } else if (Font_Bold) { my_FontStyle = FontStyle.Bold; } else { my_FontStyle = FontStyle.Regular; }
my_Font = new Font(Font_Family, Font_Size, my_FontStyle);
return my_Graphics.MeasureString(Text, my_Font).Width; } |
Moderiert von
Christian S.: Zweite Frage entfernt
Vielleicht hab ich ja Glück und jemand antwortet mir, ich bleib auf jeden Fall dran. Biss dann.