} // GetMaxLine /// <summary> /// Draw the text. /// </summary> private void ClientAreaDraw(object sender, DrawEventArgs e) { Color col = SkinInformation.Layers["Control"].Text.Colors.Enabled; SkinLayer cursor = SkinInformation.Layers["Cursor"]; Alignment al = mode == TextBoxMode.Multiline ? Alignment.TopLeft : Alignment.MiddleLeft; Rectangle r = e.Rectangle; bool drawsel = !selection.IsEmpty; string tmpText; font = (SkinInformation.Layers["Control"].Text != null) ? SkinInformation.Layers["Control"].Text.Font.Font : null; if (Text != null && font != null) { DeterminePages(); if (mode == TextBoxMode.Multiline) { shownText = Text; tmpText = lines[PositionY]; } else if (mode == TextBoxMode.Password) { shownText = ""; foreach (char character in Text) { shownText = shownText + passwordCharacter; } tmpText = shownText; } else { shownText = Text; tmpText = lines[PositionY]; } if (TextColor != UndefinedColor && ControlState != ControlState.Disabled) { col = TextColor; } if (mode != TextBoxMode.Multiline) { linesDrawn = 0; verticalScrollBar.Value = 0; } if (drawsel) { DrawSelection(r); } int sizey = font.LineSpacing; if (showCursor && caretVisible) { Vector2 size = Vector2.Zero; if (PositionX > 0 && PositionX <= tmpText.Length) { size = font.MeasureString(tmpText.Substring(0, PositionX)); } if (size.Y == 0) { size = font.MeasureString(" "); size.X = 0; } int m = r.Height - font.LineSpacing; Rectangle rc = new Rectangle(r.Left - horizontalScrollBar.Value + (int)size.X, r.Top + m / 2, cursor.Width, font.LineSpacing); if (mode == TextBoxMode.Multiline) { rc = new Rectangle(r.Left + (int)size.X - horizontalScrollBar.Value, r.Top + (int)((PositionY - verticalScrollBar.Value) * font.LineSpacing), cursor.Width, font.LineSpacing); } cursor.Alignment = al; Renderer.DrawLayer(cursor, rc, col, 0); } for (int i = 0; i < linesDrawn + 1; i++) { int ii = i + verticalScrollBar.Value; if (ii >= lines.Count || ii < 0) break; if (lines[ii] != "") { if (mode == TextBoxMode.Multiline) { Renderer.DrawString(font.Resource, lines[ii], r.Left - horizontalScrollBar.Value, r.Top + (i * sizey), col); } else { Rectangle rx = new Rectangle(r.Left - horizontalScrollBar.Value, r.Top, r.Width, r.Height); Renderer.DrawString(font.Resource, shownText, rx, col, al, false); } } } } } // ClientArea_Draw