📄 chateditctrlmanager.cs
字号:
return;
}
}
}
}
finally
{
enumerator.Dispose();
}
if (this.LinkClick != null)
{
ChatEditClickEventArgs args2 = new ChatEditClickEventArgs(null, e.LinkText, e.LinkText, string.Empty, ChatEditEventType.Link);
this.LinkClick(this, args2);
}
}
private void _richTextBox_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (this._richTextBox.SelectionLength > 0)
{
this._mouseDownLocation = new Point(e.X, e.Y);
}
else
{
this._mouseDownLocation = Point.Empty;
}
}
}
private void _richTextBox_MouseMove(object sender, MouseEventArgs e)
{
if ((e.Button == MouseButtons.Left) && (this._mouseDownLocation != Point.Empty))
{
string sHtml = this.SelectedHTML;
if (sHtml != string.Empty)
{
Size dragSize = SystemInformation.DragSize;
if (((dragSize.Width > Math.Abs((int) (this._mouseDownLocation.X - e.X))) || (dragSize.Height > Math.Abs((int) (this._mouseDownLocation.Y - e.Y)))) && ((Math.Abs((int) (this._mouseDownLocation.X - e.X)) != 0) || (Math.Abs((int) (this._mouseDownLocation.Y - e.Y)) != 0)))
{
ImpsDragDropHelper.DragDropHelper.DoDragDrop(this._richTextBox, this.SelectedText, sHtml, DragDropEffects.Move | DragDropEffects.Copy | DragDropEffects.Scroll);
}
}
}
}
public void _richTextBox_TextChanged(object sender, EventArgs e)
{
if (this._convertSympol)
{
if (this.m_fIsProcessKey)
{
this.m_fIsProcessKey = false;
}
else if ((!this._firedByAnimation && !this.ReadOnly) && !this._firedByFunction)
{
this.FormatRichTextBox(string.Empty, true, true);
if (this._richTextBox.Text == string.Empty)
{
this._richTextBox.SelectionColor = this._defaultFontColor;
}
}
}
}
public void AddRichTextString(string sText)
{
this.InsertRichTextString(this._richTextBox.TextLength, sText, this._richTextBox.SelectionFont, this._richTextBox.SelectionColor);
}
public void AddRichTextString(string sText, Font font)
{
this.InsertRichTextString(this._richTextBox.TextLength, sText, font, this._richTextBox.SelectionColor);
}
public void AddRichTextString(string sText, Font font, Color color)
{
this.InsertRichTextString(this._richTextBox.TextLength, sText, font, color);
}
private bool AllowUpdateOleObject(int charIndex, Size oleSize)
{
Rectangle rect = new Rectangle(this._richTextBox.GetPositionFromCharIndex(charIndex), oleSize);
Rectangle displayRectangle = this._richTextBox.DisplayRectangle;
if (displayRectangle.Contains(rect))
{
return true;
}
if (!displayRectangle.IntersectsWith(rect))
{
return false;
}
return ((rect.Bottom > displayRectangle.Bottom) && (rect.Top > displayRectangle.Top));
}
public void AppendCRLF()
{
this._firedByFunction = true;
this._richTextBox.AppendText("\n");
this._firedByFunction = false;
}
public bool AppendImage(Image image, string sText, OleKey key)
{
return this.InsertImage(this._richTextBox.TextLength, image, sText, key, this._sympolSize, false);
}
public bool AppendImage(Image image, string sText, OleKey key, Size size)
{
return this.InsertImage(this._richTextBox.TextLength, image, sText, key, size, false);
}
public void AppendLink(OleKey key, string LinkText, string LinkCommand)
{
this._firedByFunction = true;
this.InsertLink(this._richTextBox.TextLength, key, LinkText, LinkCommand, null, Keys.None);
this._firedByFunction = false;
}
public void AppendLink(OleKey key, string LinkText, string LinkCommand, Keys hotKey)
{
this._firedByFunction = true;
this.InsertLink(this._richTextBox.TextLength, key, LinkText, LinkCommand, null, hotKey);
this._firedByFunction = false;
}
public bool AppendProgressbar(OleKey key, string text, AmigoImage image, string barText)
{
return this.InserProgressbar(this._richTextBox.TextLength, key, text, image, barText);
}
public void AppendRichTextPlainString(string sText)
{
this.InsertRichTextPlainString(this._richTextBox.TextLength, sText, this._richTextBox.SelectionFont, this._richTextBox.SelectionColor);
}
public void AppendRichTextPlainString(string sText, Font font, Color color)
{
this.InsertRichTextPlainString(this._richTextBox.TextLength, sText, font, color);
}
public void AppentString(string sHTMLText)
{
this.AppentString(sHTMLText, this._sympolSize);
}
public void AppentString(string sHTMLText, Size size)
{
int iPos = this._richTextBox.TextLength;
this.InsertString(iPos, sHTMLText, size);
}
public void CancelLink(OleKey key)
{
this.CancelLinkWithPara(key, this.DefaultTextFont, Color.FromName("Black"));
}
public void CancelLinkWithPara(OleKey key, Font font, Color color)
{
this._firedByFunction = true;
int selectionStart = this._richTextBox.SelectionStart;
List<ChatEditLinkObject>.Enumerator enumerator = this._linkObjectDict.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ChatEditLinkObject obj2 = enumerator.get_Current();
if (obj2.key == key)
{
this._richTextBox.SelectionStart = obj2.Pos;
this._richTextBox.SelectionLength = obj2.Text.Length;
this._richTextBox.SetSelectionLink(false);
try
{
this._richTextBox.SelectionFont = font;
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
this._richTextBox.SelectionColor = color;
this._richTextBox.SelectionLength = 0;
goto Label_00AF;
}
}
}
finally
{
enumerator.Dispose();
}
Label_00AF:
this._richTextBox.SelectionStart = selectionStart;
this._firedByFunction = false;
}
private bool ContainTag(string tag, params string[] tags)
{
foreach (string text in tags)
{
if (text.ToLower() == tag.ToLower())
{
return true;
}
}
return false;
}
private void ContextMenuStrip_Opening(object sender, CancelEventArgs e)
{
if (this._richTextBox.SelectionType == RichTextBoxSelectionTypes.Object)
{
if (this.BeforeContextMenuShow != null)
{
REOBJECT oleObject = this._richTextBox.GetOleObject(this._richTextBox.SelectionStart);
if (this._oleObjIndexDict.ContainsKey((int) oleObject.dwUser))
{
ChatEditOleObject obj2 = this._oleObjIndexDict.get_Item((int) oleObject.dwUser);
ChatEditImageObject obj3 = obj2 as ChatEditImageObject;
if (obj3 != null)
{
ChatEditEventArgs args = null;
if (obj3.CustomEmotion != null)
{
args = new ChatEditEventArgs(obj3.Key, string.Empty, obj3.Text, ChatEditEventType.CustomEmotion);
args.Context = obj3.CustomEmotion;
this._selectedObject = obj3.CustomEmotion;
}
else
{
args = new ChatEditEventArgs(obj3.Key, string.Empty, obj3.Text, ChatEditEventType.IMAGE);
args.Context = obj3.ObjectImage.Image;
this._selectedObject = obj3.ObjectImage.Image;
}
this.BeforeContextMenuShow(this, args);
}
else
{
ChatEditProgressBarObject obj4 = obj2 as ChatEditProgressBarObject;
if (obj4 != null)
{
ChatEditEventArgs args2 = new ChatEditEventArgs(obj4.Key, string.Empty, string.Empty, ChatEditEventType.PROGRESSBAR);
args2.Context = null;
this._selectedObject = null;
this.BeforeContextMenuShow(this, args2);
}
}
}
}
}
else if (this.BeforeContextMenuShow != null)
{
ChatEditEventArgs args3 = new ChatEditEventArgs(null, string.Empty, string.Empty, ChatEditEventType.TEXT);
args3.Context = this._richTextBox.SelectedText;
this._selectedObject = this._richTextBox.SelectedText;
this.BeforeContextMenuShow(this, args3);
}
}
public void Dispose()
{
if (this._textFont != null)
{
this._textFont.Dispose();
}
if (this._linkButtonFont != null)
{
this._linkButtonFont.Dispose();
}
if (this._linkButtonHotKeyFont != null)
{
this._linkButtonHotKeyFont.Dispose();
}
if (!this._richTextBox.IsDisposed)
{
this._richTextBox.Dispose();
}
}
public void DoCopy()
{
this.DoCopy(ImpsDataFormat.ImpsHtml);
}
public void DoCopy(string format)
{
if (format == ImpsDataFormat.ImpsHtml)
{
string sHtml = this.SelectedHTML;
if (0 < sHtml.Length)
{
ImpsClipboard.SetImpsHtml(sHtml);
}
}
else if (format == ImpsDataFormat.ImpsText)
{
if (0 < this.SelectedText.Length)
{
ImpsClipboard.SetImpsText(this.SelectedText);
}
}
else if (0 < this.SelectedText.Length)
{
Clipboard.SetText(this.SelectedText);
}
}
public void DoCut()
{
this.DoCut(ImpsDataFormat.ImpsHtml);
}
public void DoCut(string format)
{
if (format == ImpsDataFormat.ImpsHtml)
{
ImpsClipboard.SetImpsHtml(this.SelectedHTML);
}
else if (format == ImpsDataFormat.ImpsText)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -