FastColoredTextbox Konstruktor Problem

  • C#
  • .NET (FX) 1.0–2.0

    FastColoredTextbox Konstruktor Problem

    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:

    C#-Quellcode

    1. public class TextStyle : Style
    2. {
    3. public Brush ForeBrush { get; set; }
    4. public Brush BackgroundBrush { get; set; }
    5. public FontStyle FontStyle { get; set; }
    6. public override void Draw(Graphics gr, Point position, Range range)
    7. {
    8. //draw background
    9. if (BackgroundBrush != null)
    10. gr.FillRectangle(BackgroundBrush, position.X, position.Y,
    11. (range.End.iChar - range.Start.iChar) *
    12. range.tb.CharWidth, range.tb.CharHeight);
    13. //draw chars
    14. Font f = new Font(range.tb.Font, FontStyle);
    15. Line line = range.tb[range.Start.iLine];
    16. float dx = range.tb.CharWidth;
    17. float y = position.Y - 2f;
    18. float x = position.X - 2f;
    19. Brush foreBrush = this.ForeBrush ?? new SolidBrush(range.tb.ForeColor);
    20. for (int i = range.Start.iChar; i < range.End.iChar; i++)
    21. {
    22. //draw char
    23. gr.DrawString(line[i].c.ToString(), f, foreBrush, x, y);
    24. x += dx;
    25. }
    26. }
    27. }


    und wollte den Style so deklarieren:

    C#-Quellcode

    1. Style GreenStyle = new TextStyle(Brushes.Green,null,FontStyle.Italic);


    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 :D

    EDIT: Habe es rausgefunden! Habe gedacht, man muss TextStyle übernehmen, aber die ist ja schon integriert :S Trotzdem danke!
    ~ Alex-Digital :D

    if(!Internet.VBP.Get<User>("Alex-Digital").IsOnline) this.Close(); :D

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Alex-Digital“ ()