1 Star 0 Fork 122

熊松泉/DevelopAssistant

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
TextBoxControl.cs 2.83 KB
Copy Edit Raw Blame History
wxd_tony1984 authored 2018-02-08 16:44 +08:00 . 给ICsharpCode.TextEditor 添加缩进功能
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ICSharpCode.WinFormsUI.Controls
{
public partial class TextBoxControl : TextBoxBase
{
private TextBoxBase textBox = null;
private string _text = string.Empty;
private int _lastDocumentType = -1;
public override string Text
{
get
{
return textBox == null ? _text : textBox.Text;
}
set
{
_text = value;
if (textBox != null)
textBox.Text = _text;
}
}
public override DocumentType DocumentType
{
get
{
return base.DocumentType;
}
set
{
if (this.textBox != null
&& this.textBox.Text != "undefined")
{
this._text = this.textBox.Text;
}
base.DocumentType = value;
InitializeControl();
}
}
public TextBoxControl()
{
InitializeComponent();
}
protected void InitializeControl()
{
int _newDocumentType = 0;
switch (documentType)
{
case WinFormsUI.Controls.DocumentType.None:
case WinFormsUI.Controls.DocumentType.Text:
case WinFormsUI.Controls.DocumentType.Word:
_newDocumentType = 1;
break;
default:
_newDocumentType = 0;
break;
}
if (_newDocumentType != _lastDocumentType)
{
this.BackColor = Color.White;
this.Controls.Clear();
switch (documentType)
{
case WinFormsUI.Controls.DocumentType.None:
case WinFormsUI.Controls.DocumentType.Text:
case WinFormsUI.Controls.DocumentType.Word:
textBox = new DocoFormatControl();
break;
default:
textBox = new CodeFormatControl();
break;
}
textBox.Dock = DockStyle.Fill;
this.Controls.Add(textBox);
}
textBox.DocumentType = documentType;
textBox.Text = _text;
_lastDocumentType = _newDocumentType;
}
public override void ReleaseDispose()
{
textBox.ReleaseDispose();
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/yisansky/DevelopAssistant.git
git@gitee.com:yisansky/DevelopAssistant.git
yisansky
DevelopAssistant
DevelopAssistant
master

Search