// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
}
}
- public override string Text {\r
- get {\r
- if (document == null || document.Root == null || document.Root.text == null) {\r
- return string.Empty;\r
- }\r
-\r
- if (!multiline) {\r
- return document.Root.text.ToString();\r
- } else {\r
+ public override string Text {
+ get {
+ if (document == null || document.Root == null || document.Root.text == null) {
+ return string.Empty;
+ }
+
+ if (!multiline) {
+ return document.Root.text.ToString();
+ } else {
StringBuilder sb;
int i;
}
return sb.ToString();
- }\r
- }\r
-\r
- set {\r
+ }
+ }
+
+ set {
Line line;
if (multiline) {
}
base.Text = value;
OnTextChanged(EventArgs.Empty);
- }\r
- }\r
+ }
+ }
public virtual int TextLength {
get {
- if (document == null || document.Root == null || document.Root.text == null) {\r
- return 0;\r
- }\r
-\r
- if (!multiline) {\r
- return document.Root.text.Length;\r
- } else {\r
- int total;\r
+ if (document == null || document.Root == null || document.Root.text == null) {
+ return 0;
+ }
+
+ if (!multiline) {
+ return document.Root.text.Length;
+ } else {
+ int total;
int i;
total = 0;
}
return total;
- }\r
+ }
}
}
base.CreateHandle ();
}
- protected override bool IsInputKey(Keys keyData) {\r
- switch (keyData) {\r
- case Keys.Enter: {\r
+ protected override bool IsInputKey(Keys keyData) {
+ switch (keyData) {
+ case Keys.Enter: {
if (multiline && (accepts_return || ((keyData & Keys.Control) != 0))) {
return true;
}
return false;
- }\r
-\r
- case Keys.Tab: {\r
- if (accepts_tab) {\r
- return true;\r
- }\r
- return false;\r
- }\r
- }\r
- return false;\r
- }\r
+ }
+
+ case Keys.Tab: {
+ if (accepts_tab) {
+ return true;
+ }
+ return false;
+ }
+ }
+ return false;
+ }
protected virtual void OnAcceptsTabChanged(EventArgs e) {
if (!multiline) {
if (height > PreferredHeight) {
text_bounds = new Rectangle(x, y, width, height);
- height = PreferredHeight;
+ text_bounds.Height = PreferredHeight;
}
}
}
document.SetSelectionToCaret(false);
document.DisplayCaret();
}
- }\r
- \r
- private void TextBoxBase_FontOrColorChanged(object sender, EventArgs e) {\r
- if (!richtext) {\r
- Line line;\r
-\r
- // Font changes apply to the whole document\r
- for (int i = 1; i <= document.Lines; i++) {\r
- line = document.GetLine(i);\r
- LineTag.FormatText(line, 1, line.text.Length, Font, ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor));\r
+ }
+
+ private void TextBoxBase_FontOrColorChanged(object sender, EventArgs e) {
+ if (!richtext) {
+ Line line;
+
+ // Font changes apply to the whole document
+ for (int i = 1; i <= document.Lines; i++) {
+ line = document.GetLine(i);
+ LineTag.FormatText(line, 1, line.text.Length, Font, ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor));
document.UpdateView(line, 0);
- }\r
- // Make sure the caret height is matching the new font height\r
- document.AlignCaret();\r
- }\r
- }\r
+ }
+ // Make sure the caret height is matching the new font height
+ document.AlignCaret();
+ }
+ }
}
}