Hallo,
ich wollte mal die FastColoredTextbox (von CodeProject) ausprobieren und habe ein Problem mit dem Erstellen
eines eigenen Styles.
Ich habe im Tutorial folgenden Code übernommen:
und wollte den Style so deklarieren:
Aber dann kommt dieser Fehler:
Habe schon mit TextStyle anstatt Style probiert, aber es hat immer noch nicht funktioniert.
Hoffe, jemand kann mir helfen.
Freue mich auf Antworten.
MFG
Alex-Digital
EDIT: Habe es rausgefunden! Habe gedacht, man muss TextStyle übernehmen, aber die ist ja schon integriert Trotzdem danke!
ich wollte mal die FastColoredTextbox (von CodeProject) ausprobieren und habe ein Problem mit dem Erstellen
eines eigenen Styles.
Ich habe im Tutorial folgenden Code übernommen:
C#-Quellcode
- public class TextStyle : Style
- {
- public Brush ForeBrush { get; set; }
- public Brush BackgroundBrush { get; set; }
- public FontStyle FontStyle { get; set; }
- public override void Draw(Graphics gr, Point position, Range range)
- {
- //draw background
- if (BackgroundBrush != null)
- gr.FillRectangle(BackgroundBrush, position.X, position.Y,
- (range.End.iChar - range.Start.iChar) *
- range.tb.CharWidth, range.tb.CharHeight);
- //draw chars
- Font f = new Font(range.tb.Font, FontStyle);
- Line line = range.tb[range.Start.iLine];
- float dx = range.tb.CharWidth;
- float y = position.Y - 2f;
- float x = position.X - 2f;
- Brush foreBrush = this.ForeBrush ?? new SolidBrush(range.tb.ForeColor);
- for (int i = range.Start.iChar; i < range.End.iChar; i++)
- {
- //draw char
- gr.DrawString(line[i].c.ToString(), f, foreBrush, x, y);
- x += dx;
- }
- }
- }
und wollte den Style so deklarieren:
Aber dann kommt dieser Fehler:
VS 2010 schrieb:
"WindowsFormsApplication1.TextStyle" enthält keinen Konstruktor, der 3-Argumente akzeptiert.
Habe schon mit TextStyle anstatt Style probiert, aber es hat immer noch nicht funktioniert.
Hoffe, jemand kann mir helfen.
Freue mich auf Antworten.
MFG
Alex-Digital
EDIT: Habe es rausgefunden! Habe gedacht, man muss TextStyle übernehmen, aber die ist ja schon integriert Trotzdem danke!
~ Alex-Digital :D
if(!Internet.VBP.Get<User>("Alex-Digital").IsOnline) this.Close();
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Alex-Digital“ ()