初始备份。

This commit is contained in:
如果当时 committed 2020-11-28 16:15:24 +08:00
commit 59677e1a85
152 files changed
+54611

No files matched your search

@@ -0,0 +1,42 @@
namespace ryProcessManager.hezuo
{
partial class ContextMenuStripHighlightText
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ContextMenuStripRichText
//
this.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripRichText_Opening);
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,142 @@
using ICSharpCode.TextEditor;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using XmlPad;
namespace ryProcessManager.hezuo
{
public partial class ContextMenuStripHighlightText : ContextMenuStrip
{
public ContextMenuStripHighlightText()
{
InitializeComponent();
AddMenu("撤销", "undo").Click += Undo_Click;
AddMenu("重做", "redo").Click += Redo_Click;
AddSeparatorMenu();
AddMenu("剪切", "cut").Click += Cut_Click;
AddMenu("复制", "copy").Click += Copy_Click;
AddMenu("粘贴", "paste").Click += Paste_Click;
AddMenu("删除", "del").Click += Del_Click;
AddMenu("全选", "selectall").Click += SelectAll_Click;
AddMenu("查找", "find").Click += Find_Click;
}
private void Find_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
FindAndReplaceForm _findForm = new FindAndReplaceForm();
TextEditorControl editor = rich_txt;
if (editor == null) return;
_findForm.ShowFor(editor, false);
_findForm.ReplaceMode = false;
}
private void SelectAll_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
//var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
Thread th = new Thread(sendkey);
th.Start();
void sendkey()
{
Thread.Sleep(100);
this.Invoke(new Action(() =>
{
SendKeys.SendWait("^a");
}));
}
}
private void Undo_Click(object sender, EventArgs e)
{
if(!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
rich_txt.Undo();
}
private void Redo_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
rich_txt.Redo();
}
private void Cut_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
ryCommon.RyFiles.CopyToClip(rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText);
rich_txt.ActiveTextAreaControl.TextArea.InsertString("");
}
private void Copy_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
ryCommon.RyFiles.CopyToClip(rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText);
}
private void Paste_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
rich_txt.ActiveTextAreaControl.TextArea.InsertString(Clipboard.GetText().Replace("\r\n", "\r").Replace("\r", "\r\n"));
}
private void Del_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
rich_txt.ActiveTextAreaControl.TextArea.InsertString("");
}
public ToolStripSeparator AddSeparatorMenu()
{
ToolStripSeparator item = new ToolStripSeparator();
base.Items.Add(item);
return item;
}
public ToolStripMenuItem AddMenu(string name, string tag)
{
ToolStripMenuItem item = new ToolStripMenuItem(name)
{
Tag = tag
};
base.Items.Add(item);
return item;
}
private void ContextMenuStripRichText_Opening(object sender, CancelEventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
for (int i = 0; i < base.Items.Count; i++)
{
var item = base.Items[i];
if (item.Tag == null) { continue; }
switch(item.Tag.ToString())
{
case "undo":
item.Enabled = rich_txt.EnableUndo;
break;
case "redo":
item.Enabled = rich_txt.EnableRedo;
break;
case "cut":
item.Enabled = (rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != "" && !rich_txt.IsReadOnly) ? true : false;
break;
case "copy":
item.Enabled = rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != "" ? true : false;
break;
case "paste":
item.Enabled = !rich_txt.IsReadOnly;
break;
case "del":
item.Enabled =(rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != "" && !rich_txt.IsReadOnly) ? true : false;
break;
case "selectall":
item.Enabled = rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != rich_txt.Text ? true : false;
break;
}
}
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,42 @@
namespace ryProcessManager.hezuo
{
partial class ContextMenuStripRichText
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ContextMenuStripRichText
//
this.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripRichText_Opening);
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ryProcessManager.hezuo
{
public partial class ContextMenuStripRichText : ContextMenuStrip
{
public ContextMenuStripRichText()
{
InitializeComponent();
AddMenu("撤销", "undo").Click += Undo_Click;
AddMenu("重做", "redo").Click += Redo_Click;
AddSeparatorMenu();
AddMenu("剪切", "cut").Click += Cut_Click;
AddMenu("复制", "copy").Click += Copy_Click;
AddMenu("粘贴", "paste").Click += Paste_Click;
AddMenu("删除", "del").Click += Del_Click;
AddMenu("全选", "selectall").Click += SelectAll_Click;
}
private void SelectAll_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
rich_txt.SelectAll();
}
private void Undo_Click(object sender, EventArgs e)
{
if(!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
rich_txt.Undo();
}
private void Redo_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
rich_txt.Redo();
}
private void Cut_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
rich_txt.Cut();
}
private void Copy_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
rich_txt.Copy();
}
private void Paste_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
rich_txt.Paste();
}
private void Del_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
rich_txt.SelectedText="";
}
private ToolStripSeparator AddSeparatorMenu()
{
ToolStripSeparator item = new ToolStripSeparator();
base.Items.Add(item);
return item;
}
private ToolStripMenuItem AddMenu(string name, string tag)
{
ToolStripMenuItem item = new ToolStripMenuItem(name)
{
Tag = tag
};
base.Items.Add(item);
return item;
}
private void ContextMenuStripRichText_Opening(object sender, CancelEventArgs e)
{
if (!(base.SourceControl is RichTextBox)) { return; }
var rich_txt = (RichTextBox)base.SourceControl;
for (int i = 0; i < base.Items.Count; i++)
{
var item = base.Items[i];
if (item.Tag == null) { continue; }
switch(item.Tag.ToString())
{
case "undo":
item.Enabled = rich_txt.CanUndo;
break;
case "redo":
item.Enabled = rich_txt.CanRedo;
break;
case "cut":
item.Enabled = (rich_txt.SelectedText != "" && !rich_txt.ReadOnly) ? true : false;
break;
case "copy":
item.Enabled = rich_txt.SelectedText != "" ? true : false;
break;
case "paste":
item.Enabled = rich_txt.CanPaste(DataFormats.GetFormat(DataFormats.Text));
break;
case "del":
item.Enabled =(rich_txt.SelectedText != "" && !rich_txt.ReadOnly) ? true : false;
break;
case "selectall":
item.Enabled = rich_txt.SelectedText != rich_txt.Text ? true : false;
break;
}
}
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,520 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor;
using System.Diagnostics;
using System.IO;
namespace XmlPad
{
public partial class FindAndReplaceForm : Form
{
public FindAndReplaceForm()
{
InitializeComponent();
_search = new TextEditorSearcher();
}
TextEditorSearcher _search;
TextEditorControl _editor;
TextEditorControl Editor
{
get { return _editor; }
set
{
_editor = value;
_search.Document = _editor.Document;
UpdateTitleBar();
}
}
private void UpdateTitleBar()
{
string text = ReplaceMode ? "查找和替换" : "查找";
if (_editor != null && _editor.FileName != null)
text += " - " + Path.GetFileName(_editor.FileName);
if (_search.HasScanRegion)
text += " (只可选)";
this.Text = text;
}
public void ShowFor(TextEditorControl editor, bool replaceMode)
{
Editor = editor;
_search.ClearScanRegion();
SelectionManager sm = editor.ActiveTextAreaControl.SelectionManager;
if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1)
{
ISelection sel = sm.SelectionCollection[0];
if (sel.StartPosition.Y == sel.EndPosition.Y)
txtLookFor.Text = sm.SelectedText;
else
_search.SetScanRegion(sel);
}
else
{
// Get the current word that the caret is on
Caret caret = editor.ActiveTextAreaControl.Caret;
int start = TextUtilities.FindWordStart(editor.Document, caret.Offset);
int endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset);
txtLookFor.Text = editor.Document.GetText(start, endAt - start);
}
ReplaceMode = replaceMode;
this.Owner = (Form)editor.TopLevelControl;
this.Show();
txtLookFor.SelectAll();
txtLookFor.Focus();
}
public bool ReplaceMode
{
get { return txtReplaceWith.Visible; }
set
{
btnReplace.Visible = btnReplaceAll.Visible = value;
lblReplaceWith.Visible = txtReplaceWith.Visible = value;
btnFindAllHighlightAll.Visible = !value;
this.AcceptButton = value ? btnReplace : btnFindNext;
UpdateTitleBar();
}
}
private void BtnFindPrevious_Click(object sender, EventArgs e)
{
FindNext(false, true, "内容没有找到!");
}
private void BtnFindNext_Click(object sender, EventArgs e)
{
FindNext(false, false, "内容没有找到");
}
public bool _lastSearchWasBackward = false;
public bool _lastSearchLoopedAround;
public TextRange FindNext(bool viaF3, bool searchBackward, string messageIfNotFound)
{
if (string.IsNullOrEmpty(txtLookFor.Text))
{
MessageBox.Show("没有指定要查找的内容!", "提示");
return null;
}
_lastSearchWasBackward = searchBackward;
_search.LookFor = txtLookFor.Text;
_search.MatchCase = chkMatchCase.Checked;
_search.MatchWholeWordOnly = chkMatchWholeWord.Checked;
Caret caret = _editor.ActiveTextAreaControl.Caret;
if (viaF3 && _search.HasScanRegion && !Globals.IsInRange(caret.Offset, _search.BeginOffset, _search.EndOffset))
{
// user moved outside of the originally selected region
_search.ClearScanRegion();
UpdateTitleBar();
}
int startFrom = caret.Offset - (searchBackward ? 1 : 0);
TextRange range = _search.FindNext(startFrom, searchBackward, out _lastSearchLoopedAround);
if (range != null)
SelectResult(range);
else if (messageIfNotFound != null)
MessageBox.Show(messageIfNotFound, "提示");
return range;
}
private void SelectResult(TextRange range)
{
TextLocation p1 = _editor.Document.OffsetToPosition(range.Offset);
TextLocation p2 = _editor.Document.OffsetToPosition(range.Offset + range.Length);
_editor.ActiveTextAreaControl.SelectionManager.SetSelection(p1, p2);
//_editor.ActiveTextAreaControl.ScrollTo(p1.Line, p1.Column);
// Also move the caret to the end of the selection, because when the user
// presses F3, the caret is where we start searching next time.
_editor.ActiveTextAreaControl.Caret.Position =
_editor.Document.OffsetToPosition(range.Offset + range.Length);
}
Dictionary<TextEditorControl, HighlightGroup> _highlightGroups = new Dictionary<TextEditorControl, HighlightGroup>();
private void btnHighlightAll_Click(object sender, EventArgs e)
{
if (!_highlightGroups.ContainsKey(_editor))
_highlightGroups[_editor] = new HighlightGroup(_editor);
HighlightGroup group = _highlightGroups[_editor];
if (string.IsNullOrEmpty(LookFor))
// Clear highlights
group.ClearMarkers();
else
{
_search.LookFor = txtLookFor.Text;
_search.MatchCase = chkMatchCase.Checked;
_search.MatchWholeWordOnly = chkMatchWholeWord.Checked;
bool looped = false;
int offset = 0, count = 0;
for (; ; )
{
TextRange range = _search.FindNext(offset, false, out looped);
if (range == null || looped)
break;
offset = range.Offset + range.Length;
count++;
TextMarker m = new TextMarker(range.Offset, range.Length,
TextMarkerType.SolidBlock, Color.Yellow, Color.Black);
group.AddMarker(m);
}
if (count == 0)
MessageBox.Show("没有找到你要查找的内容", "提示");
else
Close();
}
}
private void FindAndReplaceForm_FormClosing(object sender, FormClosingEventArgs e)
{ // Prevent dispose, as this form can be re-used
if (e.CloseReason != CloseReason.FormOwnerClosing)
{
if (this.Owner != null)
this.Owner.Select(); // prevent another app from being activated instead
e.Cancel = true;
Hide();
// Discard search region
_search.ClearScanRegion();
_editor.Refresh(); // must repaint manually
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
Close();
}
private void btnReplace_Click(object sender, EventArgs e)
{
SelectionManager sm = _editor.ActiveTextAreaControl.SelectionManager;
if (string.Equals(sm.SelectedText, txtLookFor.Text, StringComparison.OrdinalIgnoreCase))
InsertText(txtReplaceWith.Text);
FindNext(false, _lastSearchWasBackward, "内容没有找到!");
}
private void btnReplaceAll_Click(object sender, EventArgs e)
{
int count = 0;
// BUG FIX: if the replacement string contains the original search string
// (e.g. replace "red" with "very red") we must avoid looping around and
// replacing forever! To fix, start replacing at beginning of region (by
// moving the caret) and stop as soon as we loop around.
_editor.ActiveTextAreaControl.Caret.Position =
_editor.Document.OffsetToPosition(_search.BeginOffset);
//_editor.Document.UndoStack.StartUndoGroup();
//try
//{
lock (_editor.Document.UndoStack)
{
while (FindNext(false, false, null) != null)
{
if (_lastSearchLoopedAround)
break;
// Replace
count++;
InsertText(txtReplaceWith.Text);
}
}
//}
//finally
//{
// _editor.Document.UndoStack.EndUndoGroup();
//}
if (count == 0)
MessageBox.Show(string.Format("没有找到目标内容: {0}!", txtLookFor.Text), "提示");
else
{
MessageBox.Show(string.Format("替换了 {0} 处内容!", count), "提示");
Close();
}
}
private void InsertText(string text)
{
TextArea textArea = _editor.ActiveTextAreaControl.TextArea;
//textArea.Document.UndoStack.StartUndoGroup();
//try
//{
lock (textArea.Document.UndoStack)
{
if (textArea.SelectionManager.HasSomethingSelected)
{
textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition;
textArea.SelectionManager.RemoveSelectedText();
}
textArea.InsertString(text);
}
//}
//finally
//{
// textArea.Document.UndoStack.EndUndoGroup();
//}
}
public string LookFor { get { return txtLookFor.Text; } }
}
public class TextRange : AbstractSegment
{
IDocument _document;
public TextRange(IDocument document, int offset, int length)
{
_document = document;
this.offset = offset;
this.length = length;
}
}
/// <summary>This class finds occurrances of a search string in a text
/// editor's IDocument... it's like Find box without a GUI.</summary>
public class TextEditorSearcher : IDisposable
{
IDocument _document;
public IDocument Document
{
get { return _document; }
set
{
if (_document != value)
{
ClearScanRegion();
_document = value;
}
}
}
// I would have used the TextAnchor class to represent the beginning and
// end of the region to scan while automatically adjusting to changes in
// the document--but for some reason it is sealed and its constructor is
// internal. Instead I use a TextMarker, which is perhaps even better as
// it gives me the opportunity to highlight the region. Note that all the
// markers and coloring information is associated with the text document,
// not the editor control, so TextEditorSearcher doesn't need a reference
// to the TextEditorControl. After adding the marker to the document, we
// must remember to remove it when it is no longer needed.
TextMarker _region = null;
/// <summary>Sets the region to search. The region is updated
/// automatically as the document changes.</summary>
public void SetScanRegion(ISelection sel)
{
SetScanRegion(sel.Offset, sel.Length);
}
/// <summary>Sets the region to search. The region is updated
/// automatically as the document changes.</summary>
public void SetScanRegion(int offset, int length)
{
Color bkgColor = _document.HighlightingStrategy.GetColorFor("Default").BackgroundColor;
_region = new TextMarker(offset, length, TextMarkerType.SolidBlock,
Globals.HalfMix(bkgColor, Color.FromArgb(160, 160, 160)));
_document.MarkerStrategy.AddMarker(_region);
}
public bool HasScanRegion
{
get { return _region != null; }
}
public void ClearScanRegion()
{
if (_region != null)
{
_document.MarkerStrategy.RemoveMarker(_region);
_region = null;
}
}
public void Dispose() { ClearScanRegion(); GC.SuppressFinalize(this); }
~TextEditorSearcher() { Dispose(); }
/// <summary>Begins the start offset for searching</summary>
public int BeginOffset
{
get
{
if (_region != null)
return _region.Offset;
else
return 0;
}
}
/// <summary>Begins the end offset for searching</summary>
public int EndOffset
{
get
{
if (_region != null)
return _region.EndOffset;
else
return _document.TextLength;
}
}
public bool MatchCase;
public bool MatchWholeWordOnly;
string _lookFor;
string _lookFor2; // uppercase in case-insensitive mode
public string LookFor
{
get { return _lookFor; }
set { _lookFor = value; }
}
/// <summary>Finds next instance of LookFor, according to the search rules
/// (MatchCase, MatchWholeWordOnly).</summary>
/// <param name="beginAtOffset">Offset in Document at which to begin the search</param>
/// <remarks>If there is a match at beginAtOffset precisely, it will be returned.</remarks>
/// <returns>Region of document that matches the search string</returns>
public TextRange FindNext(int beginAtOffset, bool searchBackward, out bool loopedAround)
{
Debug.Assert(!string.IsNullOrEmpty(_lookFor));
loopedAround = false;
int startAt = BeginOffset, endAt = EndOffset;
int curOffs = Globals.InRange(beginAtOffset, startAt, endAt);
_lookFor2 = MatchCase ? _lookFor : _lookFor.ToUpperInvariant();
TextRange result;
if (searchBackward)
{
result = FindNextIn(startAt, curOffs, true);
if (result == null)
{
loopedAround = true;
result = FindNextIn(curOffs, endAt, true);
}
}
else
{
result = FindNextIn(curOffs, endAt, false);
if (result == null)
{
loopedAround = true;
result = FindNextIn(startAt, curOffs, false);
}
}
return result;
}
public delegate TResult Func<T1, T2, TResult>(T1 arg1, T2 arg2);
public delegate TResult Func<T, TResult>(T arg);
private TextRange FindNextIn(int offset1, int offset2, bool searchBackward)
{
Debug.Assert(offset2 >= offset1);
offset2 -= _lookFor.Length;
// Make behavior decisions before starting search loop
Func<char, char, bool> matchFirstCh;
Func<int, bool> matchWord;
if (MatchCase)
matchFirstCh = delegate(char lookFor, char c)
{
return lookFor == c;
};
else
matchFirstCh = delegate(char lookFor, char c)
{
return lookFor == Char.ToUpperInvariant(c);
};
if (MatchWholeWordOnly)
matchWord = IsWholeWordMatch;
else
matchWord = IsPartWordMatch;
// Search
char lookForCh = _lookFor2[0];
if (searchBackward)
{
for (int offset = offset2; offset >= offset1; offset--)
{
if (matchFirstCh(lookForCh, _document.GetCharAt(offset))
&& matchWord(offset))
return new TextRange(_document, offset, _lookFor.Length);
}
}
else
{
for (int offset = offset1; offset <= offset2; offset++)
{
if (matchFirstCh(lookForCh, _document.GetCharAt(offset))
&& matchWord(offset))
return new TextRange(_document, offset, _lookFor.Length);
}
}
return null;
}
private bool IsWholeWordMatch(int offset)
{
if (IsWordBoundary(offset) && IsWordBoundary(offset + _lookFor.Length))
return IsPartWordMatch(offset);
else
return false;
}
private bool IsWordBoundary(int offset)
{
return offset <= 0 || offset >= _document.TextLength ||
!IsAlphaNumeric(offset - 1) || !IsAlphaNumeric(offset);
}
private bool IsAlphaNumeric(int offset)
{
char c = _document.GetCharAt(offset);
return Char.IsLetterOrDigit(c) || c == '_';
}
private bool IsPartWordMatch(int offset)
{
string substr = _document.GetText(offset, _lookFor.Length);
if (!MatchCase)
substr = substr.ToUpperInvariant();
return substr == _lookFor2;
}
}
/// <summary>Bundles a group of markers together so that they can be cleared
/// together.</summary>
public class HighlightGroup : IDisposable
{
List<TextMarker> _markers = new List<TextMarker>();
TextEditorControl _editor;
IDocument _document;
public HighlightGroup(TextEditorControl editor)
{
_editor = editor;
_document = editor.Document;
}
public void AddMarker(TextMarker marker)
{
_markers.Add(marker);
_document.MarkerStrategy.AddMarker(marker);
}
public void ClearMarkers()
{
foreach (TextMarker m in _markers)
_document.MarkerStrategy.RemoveMarker(m);
_markers.Clear();
_editor.Refresh();
}
public void Dispose() { ClearMarkers(); GC.SuppressFinalize(this); }
~HighlightGroup() { Dispose(); }
public IList<TextMarker> Markers { get { return _markers.AsReadOnly(); } }
}
}
@@ -0,0 +1,235 @@
namespace XmlPad
{
partial class FindAndReplaceForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.lblReplaceWith = new System.Windows.Forms.Label();
this.txtLookFor = new System.Windows.Forms.TextBox();
this.txtReplaceWith = new System.Windows.Forms.TextBox();
this.btnFindNext = new System.Windows.Forms.Button();
this.btnReplace = new System.Windows.Forms.Button();
this.btnReplaceAll = new System.Windows.Forms.Button();
this.chkMatchWholeWord = new System.Windows.Forms.CheckBox();
this.chkMatchCase = new System.Windows.Forms.CheckBox();
this.btnFindAllHighlightAll = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnFindPrevious = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(77, 12);
this.label1.TabIndex = 0;
this.label1.Text = "查找内容(&N):";
//
// lblReplaceWith
//
this.lblReplaceWith.AutoSize = true;
this.lblReplaceWith.Location = new System.Drawing.Point(12, 36);
this.lblReplaceWith.Name = "lblReplaceWith";
this.lblReplaceWith.Size = new System.Drawing.Size(65, 12);
this.lblReplaceWith.TabIndex = 2;
this.lblReplaceWith.Text = "替换为(&P):";
//
// txtLookFor
//
this.txtLookFor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtLookFor.Location = new System.Drawing.Point(95, 6);
this.txtLookFor.Name = "txtLookFor";
this.txtLookFor.Size = new System.Drawing.Size(232, 21);
this.txtLookFor.TabIndex = 1;
//
// txtReplaceWith
//
this.txtReplaceWith.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtReplaceWith.Location = new System.Drawing.Point(95, 33);
this.txtReplaceWith.Name = "txtReplaceWith";
this.txtReplaceWith.Size = new System.Drawing.Size(232, 21);
this.txtReplaceWith.TabIndex = 3;
//
// btnFindNext
//
this.btnFindNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFindNext.Location = new System.Drawing.Point(228, 137);
this.btnFindNext.Name = "btnFindNext";
this.btnFindNext.Size = new System.Drawing.Size(100, 30);
this.btnFindNext.TabIndex = 6;
this.btnFindNext.Text = "查找下一个(&F)";
this.btnFindNext.UseVisualStyleBackColor = true;
this.btnFindNext.Click += new System.EventHandler(this.BtnFindNext_Click);
//
// btnReplace
//
this.btnReplace.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnReplace.Location = new System.Drawing.Point(12, 174);
this.btnReplace.Name = "btnReplace";
this.btnReplace.Size = new System.Drawing.Size(100, 30);
this.btnReplace.TabIndex = 7;
this.btnReplace.Text = "替换(&R)";
this.btnReplace.UseVisualStyleBackColor = true;
this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click);
//
// btnReplaceAll
//
this.btnReplaceAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnReplaceAll.Location = new System.Drawing.Point(119, 174);
this.btnReplaceAll.Name = "btnReplaceAll";
this.btnReplaceAll.Size = new System.Drawing.Size(100, 30);
this.btnReplaceAll.TabIndex = 9;
this.btnReplaceAll.Text = "全部替换(&A)";
this.btnReplaceAll.UseVisualStyleBackColor = true;
this.btnReplaceAll.Click += new System.EventHandler(this.btnReplaceAll_Click);
//
// chkMatchWholeWord
//
this.chkMatchWholeWord.AutoSize = true;
this.chkMatchWholeWord.Location = new System.Drawing.Point(145, 27);
this.chkMatchWholeWord.Name = "chkMatchWholeWord";
this.chkMatchWholeWord.Size = new System.Drawing.Size(90, 16);
this.chkMatchWholeWord.TabIndex = 5;
this.chkMatchWholeWord.Text = "全字匹配(&W)";
this.chkMatchWholeWord.UseVisualStyleBackColor = true;
//
// chkMatchCase
//
this.chkMatchCase.AutoSize = true;
this.chkMatchCase.Location = new System.Drawing.Point(22, 27);
this.chkMatchCase.Name = "chkMatchCase";
this.chkMatchCase.Size = new System.Drawing.Size(102, 16);
this.chkMatchCase.TabIndex = 4;
this.chkMatchCase.Text = "大小写匹配(&C)";
this.chkMatchCase.UseVisualStyleBackColor = true;
//
// btnFindAllHighlightAll
//
this.btnFindAllHighlightAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFindAllHighlightAll.Location = new System.Drawing.Point(66, 174);
this.btnFindAllHighlightAll.Name = "btnFindAllHighlightAll";
this.btnFindAllHighlightAll.Size = new System.Drawing.Size(150, 30);
this.btnFindAllHighlightAll.TabIndex = 8;
this.btnFindAllHighlightAll.Text = "查找全部并高亮显示(&H)";
this.btnFindAllHighlightAll.UseVisualStyleBackColor = true;
this.btnFindAllHighlightAll.Visible = false;
this.btnFindAllHighlightAll.Click += new System.EventHandler(this.btnHighlightAll_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(228, 173);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(100, 30);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnFindPrevious
//
this.btnFindPrevious.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFindPrevious.Location = new System.Drawing.Point(118, 138);
this.btnFindPrevious.Name = "btnFindPrevious";
this.btnFindPrevious.Size = new System.Drawing.Size(100, 30);
this.btnFindPrevious.TabIndex = 6;
this.btnFindPrevious.Text = "查找上一个(&P)";
this.btnFindPrevious.UseVisualStyleBackColor = true;
this.btnFindPrevious.Click += new System.EventHandler(this.BtnFindPrevious_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.chkMatchCase);
this.groupBox1.Controls.Add(this.chkMatchWholeWord);
this.groupBox1.Location = new System.Drawing.Point(14, 64);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(313, 63);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查找选项";
//
// FindAndReplaceForm
//
this.AcceptButton = this.btnReplace;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(339, 215);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnReplaceAll);
this.Controls.Add(this.btnReplace);
this.Controls.Add(this.btnFindAllHighlightAll);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnFindPrevious);
this.Controls.Add(this.btnFindNext);
this.Controls.Add(this.txtReplaceWith);
this.Controls.Add(this.txtLookFor);
this.Controls.Add(this.lblReplaceWith);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FindAndReplaceForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "查找和替换";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindAndReplaceForm_FormClosing);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblReplaceWith;
private System.Windows.Forms.TextBox txtLookFor;
private System.Windows.Forms.TextBox txtReplaceWith;
private System.Windows.Forms.Button btnFindNext;
private System.Windows.Forms.Button btnReplace;
private System.Windows.Forms.Button btnReplaceAll;
private System.Windows.Forms.CheckBox chkMatchWholeWord;
private System.Windows.Forms.CheckBox chkMatchCase;
private System.Windows.Forms.Button btnFindAllHighlightAll;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnFindPrevious;
private System.Windows.Forms.GroupBox groupBox1;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,78 @@
namespace SuperDesign.Controls
{
partial class FrmInsertUnixTime
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dateTimePickerEX1 = new ryControls.DateTimePickerEX();
this.BtnOK = new ryControls.ButtonEx();
this.SuspendLayout();
//
// dateTimePickerEX1
//
this.dateTimePickerEX1.CustomFormat = "yyyy年MM月dd日 dddd HH:mm:ss";
this.dateTimePickerEX1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.dateTimePickerEX1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePickerEX1.Location = new System.Drawing.Point(12, 25);
this.dateTimePickerEX1.Name = "dateTimePickerEX1";
this.dateTimePickerEX1.Size = new System.Drawing.Size(277, 23);
this.dateTimePickerEX1.TabIndex = 6;
//
// BtnOK
//
this.BtnOK.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
this.BtnOK.Location = new System.Drawing.Point(222, 80);
this.BtnOK.Name = "BtnOK";
this.BtnOK.Size = new System.Drawing.Size(67, 26);
this.BtnOK.TabIndex = 113;
this.BtnOK.Text = "确定";
this.BtnOK.UseVisualStyleBackColor = true;
this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
//
// FrmInsertUnixTime
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(303, 112);
this.Controls.Add(this.BtnOK);
this.Controls.Add(this.dateTimePickerEX1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmInsertUnixTime";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "插入时间戳";
this.ResumeLayout(false);
}
#endregion
private ryControls.ButtonEx BtnOK;
public ryControls.DateTimePickerEX dateTimePickerEX1;
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SuperDesign.Controls
{
public partial class FrmInsertUnixTime : Form
{
public FrmInsertUnixTime()
{
InitializeComponent();
}
private void BtnOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+103
View File
@@ -0,0 +1,103 @@
namespace 开发辅助工具.Controls
{
partial class FrmText
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panelEx1 = new ryControls.PanelEx();
this.BtnSave = new ryControls.ButtonEx();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.contextMenuStripRichText1 = new ryProcessManager.hezuo.ContextMenuStripRichText();
this.panelEx1.SuspendLayout();
this.SuspendLayout();
//
// panelEx1
//
this.panelEx1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(216)))), ((int)(((byte)(223)))));
this.panelEx1.Controls.Add(this.richTextBox1);
this.panelEx1.Location = new System.Drawing.Point(12, 36);
this.panelEx1.Name = "panelEx1";
this.panelEx1.RoundeStyle = ryControls.RoundStyle.None;
this.panelEx1.Size = new System.Drawing.Size(725, 467);
this.panelEx1.TabIndex = 0;
this.panelEx1.TileBackColor = System.Drawing.Color.White;
//
// BtnSave
//
this.BtnSave.ForeColor = System.Drawing.Color.White;
this.BtnSave.Location = new System.Drawing.Point(12, 6);
this.BtnSave.Name = "BtnSave";
this.BtnSave.Size = new System.Drawing.Size(65, 26);
this.BtnSave.TabIndex = 1;
this.BtnSave.Text = "保存";
this.BtnSave.UseVisualStyleBackColor = true;
this.BtnSave.Click += new System.EventHandler(this.BtnSave_Click);
//
// richTextBox1
//
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.ContextMenuStrip = this.contextMenuStripRichText1;
this.richTextBox1.Location = new System.Drawing.Point(3, 7);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(719, 455);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// contextMenuStripRichText1
//
this.contextMenuStripRichText1.Name = "contextMenuStripRichText1";
this.contextMenuStripRichText1.Size = new System.Drawing.Size(101, 164);
//
// FrmText
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(749, 515);
this.Controls.Add(this.BtnSave);
this.Controls.Add(this.panelEx1);
this.Name = "FrmText";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "文本编辑 ";
this.panelEx1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private ryControls.PanelEx panelEx1;
private ryControls.ButtonEx BtnSave;
private ryProcessManager.hezuo.ContextMenuStripRichText contextMenuStripRichText1;
public System.Windows.Forms.RichTextBox richTextBox1;
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 开发辅助工具.Controls
{
public partial class FrmText : Form
{
public FrmText()
{
InitializeComponent();
}
private void BtnSave_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStripRichText1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
+91
View File
@@ -0,0 +1,91 @@
namespace SuperDesign.Controls
{
partial class FrmTitle
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.TxtTitle = new ryControls.TextBoxEx2();
this.BtnOK = new ryControls.ButtonEx();
this.SuspendLayout();
//
// TxtTitle
//
this.TxtTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TxtTitle.BackColor = System.Drawing.Color.White;
this.TxtTitle.EmptyText = "请输入标题";
this.TxtTitle.ImeMode = System.Windows.Forms.ImeMode.Close;
this.TxtTitle.Location = new System.Drawing.Point(12, 23);
this.TxtTitle.MaxLength = 999999999;
this.TxtTitle.Multiline = false;
this.TxtTitle.Name = "TxtTitle";
this.TxtTitle.OnlyNumeric = false;
this.TxtTitle.PasswordChar = '\0';
this.TxtTitle.ReadOnly = false;
this.TxtTitle.SelectedText = "";
this.TxtTitle.SelectionLength = 0;
this.TxtTitle.SelectionStart = 0;
this.TxtTitle.Size = new System.Drawing.Size(363, 23);
this.TxtTitle.TabIndex = 111;
this.TxtTitle.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.TxtTitle.ToolTip = "";
this.TxtTitle.WordWrap = true;
//
// BtnOK
//
this.BtnOK.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
this.BtnOK.Location = new System.Drawing.Point(292, 78);
this.BtnOK.Name = "BtnOK";
this.BtnOK.Size = new System.Drawing.Size(82, 26);
this.BtnOK.TabIndex = 112;
this.BtnOK.Text = "确定";
this.BtnOK.UseVisualStyleBackColor = true;
this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
//
// FrmTitle
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(383, 116);
this.Controls.Add(this.BtnOK);
this.Controls.Add(this.TxtTitle);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmTitle";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "请输入标题";
this.ResumeLayout(false);
}
#endregion
private ryControls.ButtonEx BtnOK;
public ryControls.TextBoxEx2 TxtTitle;
}
}
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SuperDesign.Controls
{
public partial class FrmTitle : Form
{
public FrmTitle()
{
InitializeComponent();
}
private void BtnOK_Click(object sender, EventArgs e)
{
if(TxtTitle.Text.Length<2)
{
MessageBox.Show("标题输入太短。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
DialogResult = DialogResult.OK;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+36
View File
@@ -0,0 +1,36 @@
namespace ryPaiban.Model
{
partial class MenuRight
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
@@ -0,0 +1,161 @@
using ryCommonDb;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using 开发辅助工具.Manager;
namespace ryPaiban.Model
{
[Description("子标签右键菜单")]
public partial class MenuRight : System.Windows.Forms.ContextMenuStrip
{
public MenuRight()
{
InitializeComponent();
LoadMenu();
}
private DockContent _SourceContent = null;
[Description("菜单所属的子窗体")]
public DockContent SourceContent
{
get { return _SourceContent; }
set
{
if (_SourceContent != value)
{
if (_SourceContent != null)
{
_SourceContent.FormClosing -= _SourceContent_FormClosing;
}
_SourceContent = value;
if (value != null)
{
_SourceContent.FormClosing += _SourceContent_FormClosing;
_SourceContent.TabPageContextMenuStrip = this;
}
}
}
}
private void _SourceContent_FormClosing(object sender, FormClosingEventArgs e)
{
if (Itrycn_Db.IsCloseConfirm)
{
switch (MessageBox.Show("是否确定要关闭?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
case DialogResult.Cancel:
e.Cancel = true;
break;
}
}
}
ToolStripMenuItem menu_start = null;
private void LoadMenu()
{
base.Items.Add("关闭本标签").Click += OnClose_Click;
base.Items.Add("除此之外全部关闭").Click += OnCloseAllNoMe_Click;
base.Items.Add("临时重命名").Click += OnRename_Click;
menu_start = (ToolStripMenuItem)base.Items.Add("软件启动时自动打开");
menu_start.Click += OnStart_Click;
base.Opening += MenuRight_Opening;
}
private void MenuRight_Opening(object sender, CancelEventArgs e)
{
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
{
RyQuickSQL mySQL = new RyQuickSQL("Starts");
mySQL.AddField("Addr", SourceContent.GetType().ToString());
DataSet ds = db.ReadData("select * from Starts where Addr=@Addr", mySQL);
menu_start.Checked = mydb.HaveData(ds);
}
db.Free();
}
private void OnStart_Click(object sender, EventArgs e)
{
if (SourceContent == null) { return; }
ToolStripMenuItem item = (ToolStripMenuItem)sender;
item.Checked = !item.Checked;
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
{
RyQuickSQL mySQL = new RyQuickSQL("Starts");
mySQL.AddField("Name", SourceContent.Text);
mySQL.AddField("Addr", SourceContent.GetType().ToString());
mySQL.AddField("EditTime", DateTime.Now);
if (item.Checked)
{
DataSet ds = db.ReadData("select * from Starts where Addr=@Addr", mySQL);
if (!mydb.HaveData(ds))
{
mySQL.AddField("AddTime", DateTime.Now);
db.ExecuteNonQuery(mySQL.GetInsertSQL(),mySQL);
}
}
else
{
db.ExecuteNonQuery("delete from Starts where Addr=@Addr", mySQL);
}
}
db.Free();
}
private void OnClose_Click(object sender, EventArgs e)
{
if (SourceContent == null) { return; }
SourceContent.Close();
}
private void OnCloseAllNoMe_Click(object sender, EventArgs e)
{
if (SourceContent == null) { return; }
switch (MessageBox.Show("是否确定要关闭?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
case DialogResult.Cancel:
return;
}
Itrycn_Db.IsCloseConfirm = false;
DockContentCollection contents = SourceContent.DockPanel.Contents;
int num = 0;
while (num < contents.Count)
{
if (contents[num].DockHandler.DockState == DockState.Document && SourceContent.DockPanel.ActiveContent != contents[num])
{
contents[num].DockHandler.Close();
}
else
{
num++;
}
}
Itrycn_Db.IsCloseConfirm = true;
}
private void OnRename_Click(object sender, EventArgs e)
{
if (SourceContent == null) { return; }
SuperDesign.Controls.FrmTitle frm = new SuperDesign.Controls.FrmTitle();
frm.TxtTitle.Text = SourceContent.Text;
frm.Icon = SourceContent.Icon;
if(frm.ShowDialog()==DialogResult.OK)
{
SourceContent.Text = frm.TxtTitle.Text;
}
frm.Dispose();
}
public MenuRight(IContainer container)
{
container.Add(this);
InitializeComponent();
LoadMenu();
}
}
}