### 2021-09-03更新

------
#### ryControls    V3.0.2109.0301
- *.[改进]RichTextBox2控件现在可以自由选择字符区间。
- *.[改进]RichTextBox2控件改用Courier New等宽字体。
This commit is contained in:
鑫Intel 2021-09-03 17:31:31 +08:00
parent a1d6dce946
commit b9de6d327a
49 changed files with 547 additions and 223 deletions

View File

@ -2766,6 +2766,22 @@
<param name="type"></param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.SetParentWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
将窗体植入到容器控件中
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.ResizeWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
重新调整窗体大小以适配容器大小
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="T:ryCommon.RyRegedit">
<summary>
设置注册表操作,部分功能需要管理员权限

View File

@ -1,2 +1,2 @@
[Money_Op]
hwnd=198392
hwnd=602346

View File

@ -1,4 +1,4 @@
<root>
<list id="LastUpdateTime" Value="2021/7/5 21:54:17" />
<list id="LastUpdateTime" Value="2021/9/3 14:27:07" />
<list id="UpdateAfterTime" Value="0" />
</root>

View File

@ -439,6 +439,12 @@
RichTextBox
</summary>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHandleCreated(System.EventArgs)">
<summary>
</summary>
<param name="e"></param>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHScroll(System.EventArgs)">
<summary>
@ -4513,6 +4519,16 @@
<param name="selected"></param>
<param name="mouseOver"></param>
</member>
<member name="P:ryControls.ChromeTabControl.Radius">
<summary>
设置圆角半径
</summary>
</member>
<member name="P:ryControls.ChromeTabControl.TabStrLeftMargin">
<summary>
Tab文字左边距离
</summary>
</member>
<member name="M:ryControls.ChromeTabControl.DrawRect(System.Drawing.Graphics,System.Drawing.Rectangle,System.Boolean,System.Boolean)">
<summary>
@ -4546,6 +4562,12 @@
<param name="rect"></param>
<param name="mouseOn"></param>
</member>
<member name="M:ryControls.ChromeTabControl.GetTabTotalWidth">
<summary>
获取所有选项卡合起来的宽度
</summary>
<returns></returns>
</member>
<member name="M:ryControls.ChromeTabControl.OnPaint(System.Windows.Forms.PaintEventArgs)">
<summary>

View File

@ -1,23 +1,10 @@
2021/3/13 16:06:28
2021/9/2 17:28:18
错误描述:未将对象引用设置到对象的实例。
异常堆栈: 在 MGdu.WinFormUI.GMForm.OnSizeChanged(EventArgs e) 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\ryControls\Gdu.WinFormUI\Forms\GMForm.cs:行号 1495
在 System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
在 System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
在 System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
在 System.Windows.Forms.Form.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
在 MGdu.WinFormUI.GMForm.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified) 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\ryControls\Gdu.WinFormUI\Forms\GMForm.cs:行号 1431
在 System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
在 System.Windows.Forms.Control.set_Size(Size value)
在 System.Windows.Forms.Control.SetClientSizeCore(Int32 x, Int32 y)
在 System.Windows.Forms.Form.SetClientSizeCore(Int32 x, Int32 y)
在 MGdu.WinFormUI.GMForm.SetClientSizeCore(Int32 x, Int32 y) 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\ryControls\Gdu.WinFormUI\Forms\GMForm.cs:行号 1457
在 System.Windows.Forms.Control.set_ClientSize(Size value)
在 System.Windows.Forms.Form.set_ClientSize(Size value)
在 MGdu.WinFormUI.GMForm.InitializeComponent() 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\ryControls\Gdu.WinFormUI\Forms\GMForm.Designer.cs:行号 37
在 MGdu.WinFormUI.GMForm..ctor() 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\ryControls\Gdu.WinFormUI\Forms\GMForm.cs:行号 769
在 Itrycn_Project2.FrmTest..ctor() 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\Itrycn_Project2\FrmTest.cs:行号 14
在 Itrycn_Project.Program.Main(String[] args) 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\Itrycn_Project2\Program.cs:行号 35
异常堆栈: 在 ryControls.Controls.RichTextBox2..ctor() 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\ryControls\Controls\RichTextBox2.cs:行号 45
在 Itrycn_Project2.FrmStart.InitializeComponent() 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\Itrycn_Project2\FrmStart.Designer.cs:行号 46
在 Itrycn_Project2.FrmStart..ctor(String[] args) 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\Itrycn_Project2\FrmStart.cs:行号 20
在 Itrycn_Project2.Program.Main(String[] args) 位置 E:\My Datas\毕方项目\C#\睿元公用控件组\Source\Itrycn_Project2\Program.cs:行号 36
异常方法Void OnSizeChanged(System.EventArgs)
异常方法Void .ctor()

View File

@ -2766,6 +2766,22 @@
<param name="type"></param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.SetParentWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
将窗体植入到容器控件中
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.ResizeWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
重新调整窗体大小以适配容器大小
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="T:ryCommon.RyRegedit">
<summary>
设置注册表操作,部分功能需要管理员权限

View File

@ -439,6 +439,12 @@
RichTextBox
</summary>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHandleCreated(System.EventArgs)">
<summary>
</summary>
<param name="e"></param>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHScroll(System.EventArgs)">
<summary>
@ -4513,6 +4519,16 @@
<param name="selected"></param>
<param name="mouseOver"></param>
</member>
<member name="P:ryControls.ChromeTabControl.Radius">
<summary>
设置圆角半径
</summary>
</member>
<member name="P:ryControls.ChromeTabControl.TabStrLeftMargin">
<summary>
Tab文字左边距离
</summary>
</member>
<member name="M:ryControls.ChromeTabControl.DrawRect(System.Drawing.Graphics,System.Drawing.Rectangle,System.Boolean,System.Boolean)">
<summary>
@ -4546,6 +4562,12 @@
<param name="rect"></param>
<param name="mouseOn"></param>
</member>
<member name="M:ryControls.ChromeTabControl.GetTabTotalWidth">
<summary>
获取所有选项卡合起来的宽度
</summary>
<returns></returns>
</member>
<member name="M:ryControls.ChromeTabControl.OnPaint(System.Windows.Forms.PaintEventArgs)">
<summary>

View File

@ -2766,6 +2766,22 @@
<param name="type"></param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.SetParentWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
将窗体植入到容器控件中
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.ResizeWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
重新调整窗体大小以适配容器大小
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="T:ryCommon.RyRegedit">
<summary>
设置注册表操作,部分功能需要管理员权限

View File

@ -439,6 +439,12 @@
RichTextBox
</summary>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHandleCreated(System.EventArgs)">
<summary>
</summary>
<param name="e"></param>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHScroll(System.EventArgs)">
<summary>
@ -4513,6 +4519,16 @@
<param name="selected"></param>
<param name="mouseOver"></param>
</member>
<member name="P:ryControls.ChromeTabControl.Radius">
<summary>
设置圆角半径
</summary>
</member>
<member name="P:ryControls.ChromeTabControl.TabStrLeftMargin">
<summary>
Tab文字左边距离
</summary>
</member>
<member name="M:ryControls.ChromeTabControl.DrawRect(System.Drawing.Graphics,System.Drawing.Rectangle,System.Boolean,System.Boolean)">
<summary>
@ -4546,6 +4562,12 @@
<param name="rect"></param>
<param name="mouseOn"></param>
</member>
<member name="M:ryControls.ChromeTabControl.GetTabTotalWidth">
<summary>
获取所有选项卡合起来的宽度
</summary>
<returns></returns>
</member>
<member name="M:ryControls.ChromeTabControl.OnPaint(System.Windows.Forms.PaintEventArgs)">
<summary>

View File

@ -2766,6 +2766,22 @@
<param name="type"></param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.SetParentWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
将窗体植入到容器控件中
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="M:ryCommon.RyForm.ResizeWin(System.Windows.Forms.Form,System.Windows.Forms.Control)">
<summary>
重新调整窗体大小以适配容器大小
</summary>
<param name="frm"></param>
<param name="panrent_ctl">作为窗体容器的控件</param>
<returns></returns>
</member>
<member name="T:ryCommon.RyRegedit">
<summary>
设置注册表操作,部分功能需要管理员权限

View File

@ -439,6 +439,12 @@
RichTextBox
</summary>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHandleCreated(System.EventArgs)">
<summary>
</summary>
<param name="e"></param>
</member>
<member name="M:ryControls.Controls.RichTextBox2.OnHScroll(System.EventArgs)">
<summary>
@ -4513,6 +4519,16 @@
<param name="selected"></param>
<param name="mouseOver"></param>
</member>
<member name="P:ryControls.ChromeTabControl.Radius">
<summary>
设置圆角半径
</summary>
</member>
<member name="P:ryControls.ChromeTabControl.TabStrLeftMargin">
<summary>
Tab文字左边距离
</summary>
</member>
<member name="M:ryControls.ChromeTabControl.DrawRect(System.Drawing.Graphics,System.Drawing.Rectangle,System.Boolean,System.Boolean)">
<summary>
@ -4546,6 +4562,12 @@
<param name="rect"></param>
<param name="mouseOn"></param>
</member>
<member name="M:ryControls.ChromeTabControl.GetTabTotalWidth">
<summary>
获取所有选项卡合起来的宽度
</summary>
<returns></returns>
</member>
<member name="M:ryControls.ChromeTabControl.OnPaint(System.Windows.Forms.PaintEventArgs)">
<summary>

View File

@ -1,4 +1,10 @@
### 2021-08-03更新
### 2021-09-03更新
------
#### ryControls V3.0.2109.0301
- *.[改进]RichTextBox2控件现在可以自由选择字符区间。
- *.[改进]RichTextBox2控件改用Courier New等宽字体。
### 2021-08-03更新
------
#### MyDbV4 V3.0.2108.0301
- *.[新增]新增内置HtmlAgilityPack组件。

View File

@ -36,16 +36,21 @@
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.退ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chromeTabControl1 = new ryControls.ChromeTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chromeTabControl2 = new ryControls.ChromeTabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.MenuTray.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.chromeTabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.chromeTabControl2.SuspendLayout();
this.SuspendLayout();
//
// notifyIcon1
@ -87,6 +92,21 @@
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// 工具ToolStripMenuItem
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "工具ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.ToolStripMenuItem.Text = "工具";
//
// 选项ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "选项ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.ToolStripMenuItem.Text = "选项";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 关于ToolStripMenuItem
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -99,14 +119,14 @@
// 打开官网ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "打开官网ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.ToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
this.ToolStripMenuItem.Text = "打开官网";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 捐助ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "捐助ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.ToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
this.ToolStripMenuItem.Text = "关于和捐助";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
@ -133,6 +153,7 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.chromeTabControl2);
this.tabPage1.Location = new System.Drawing.Point(1, 29);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
@ -141,20 +162,44 @@
this.tabPage1.Text = "首页";
this.tabPage1.UseVisualStyleBackColor = true;
//
// 工具ToolStripMenuItem
// chromeTabControl2
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "工具ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.ToolStripMenuItem.Text = "工具";
this.chromeTabControl2.AllowDragTab = true;
this.chromeTabControl2.BackTabPageImage = null;
this.chromeTabControl2.Controls.Add(this.tabPage2);
this.chromeTabControl2.Controls.Add(this.tabPage3);
this.chromeTabControl2.Cursor = System.Windows.Forms.Cursors.Default;
this.chromeTabControl2.ItemSize = new System.Drawing.Size(185, 25);
this.chromeTabControl2.Location = new System.Drawing.Point(306, 57);
this.chromeTabControl2.Name = "chromeTabControl2";
this.chromeTabControl2.SelectedIndex = 0;
this.chromeTabControl2.ShowAddButton = true;
this.chromeTabControl2.ShowCloseButton = true;
this.chromeTabControl2.Size = new System.Drawing.Size(401, 255);
this.chromeTabControl2.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.chromeTabControl2.TabContextMenuStrip = null;
this.chromeTabControl2.TabIndex = 0;
this.chromeTabControl2.TabMaxWidth = 200;
//
// 选项ToolStripMenuItem
// tabPage2
//
this.ToolStripMenuItem.Name = "选项ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.ToolStripMenuItem.Text = "选项";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
this.tabPage2.Location = new System.Drawing.Point(1, 29);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(399, 225);
this.tabPage2.TabIndex = 0;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tabPage3
//
this.tabPage3.Location = new System.Drawing.Point(1, 29);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(399, 225);
this.tabPage3.TabIndex = 1;
this.tabPage3.Text = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true;
//
// FrmStart
//
@ -163,6 +208,7 @@
this.ClientSize = new System.Drawing.Size(789, 592);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.chromeTabControl1);
this.Location = new System.Drawing.Point(0, 0);
this.Name = "FrmStart";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmStart";
@ -173,15 +219,14 @@
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.chromeTabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.chromeTabControl2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private ryControls.ChromeTabControl chromeTabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.ContextMenuStrip MenuTray;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
@ -192,5 +237,10 @@
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.TabPage tabPage1;
private ryControls.ChromeTabControl chromeTabControl1;
private ryControls.ChromeTabControl chromeTabControl2;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
}
}

View File

@ -46,7 +46,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />

View File

@ -32,5 +32,5 @@ using System;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.2108.2101")]
[assembly: AssemblyFileVersion("3.0.2108.2101")]
[assembly: AssemblyVersion("3.0.2109.0101")]
[assembly: AssemblyFileVersion("3.0.2109.0101")]

View File

@ -193,5 +193,33 @@ namespace ryCommon
catch { }
return null;
}
/// <summary>
/// 将窗体植入到容器控件中
/// </summary>
/// <param name="frm"></param>
/// <param name="panrent_ctl">作为窗体容器的控件</param>
/// <returns></returns>
public static bool SetParentWin(Form frm, Control panrent_ctl)
{
if (frm == null) { return false; }
if (panrent_ctl == null) { return false; }
frm.FormBorderStyle = FormBorderStyle.None;
_ = WinAPI.User32.SetParent(frm.Handle, panrent_ctl.Handle);
_ = WinAPI.User32.MoveWindow(frm.Handle, 0, 0, panrent_ctl.Width, panrent_ctl.Height, false);
return true;
}
/// <summary>
/// 重新调整窗体大小以适配容器大小
/// </summary>
/// <param name="frm"></param>
/// <param name="panrent_ctl">作为窗体容器的控件</param>
/// <returns></returns>
public static bool ResizeWin(Form frm, Control panrent_ctl)
{
if (frm == null) { return false; }
if (panrent_ctl == null) { return false; }
_ = WinAPI.User32.MoveWindow(frm.Handle, 0, 0, panrent_ctl.Width, panrent_ctl.Height, true);
return true;
}
}
}

View File

@ -38,9 +38,9 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.98.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
<Reference Include="System.Data.SQLite, Version=1.0.115.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\Program Files (x86)\System.Data.SQLite\.NET 4.0\bin\System.Data.SQLite.dll</HintPath>
<HintPath>..\..\Bin\Debug\CommonControls\.NET4\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />

View File

@ -36,6 +36,7 @@ namespace ryControls.Controls
//
this.contextMenuStripRichText1.Name = "contextMenuStripRichText1";
this.contextMenuStripRichText1.Size = new System.Drawing.Size(101, 142);
this.contextMenuStripRichText1.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripRichText1_Opening);
this.ResumeLayout(false);
}

View File

@ -33,15 +33,55 @@ namespace ryControls.Controls
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
private const int WM_SETREDRAW = 0x0b;
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, ref Rectangle lParam);//
private const int EM_SETRECT = 0x00b3;
/// <summary>
/// RichTextBox
/// </summary>
public RichTextBox2()
public RichTextBox2():base()
{
//this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles();
InitializeComponent();
this.DetectUrls = false;
this.AutoWordSelection = false;
contextMenuStripRichText1.Opening += ContextMenuStripRichText1_Opening;
this.Multiline = true;
this.WordWrap = false;
this.Font = new Font("Courier New",10, FontStyle.Regular);
//this.contextMenuStripRichText1.Opening += ContextMenuStripRichText1_Opening;
}
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
if (this.DesignMode) return;
// The following operations should not recreate the handle
// Workaround for .NET bug:
// AutoWordSelection remembers the value of the property
// correctly, but incorrectly sends a message as follows:
// SendMessage(EM_SETOPTIONS, value ? ECOOP_OR : ECOOP_XOR,
// ECO_AUTOWORDSELECTION);
// So, when setting AutoWordSelection to false, the control
// style is toggled instead of turned off (the internal value
// is updated correctly)
bool bAutoWord = this.AutoWordSelection; // Internal, no message
if (!bAutoWord) // Only 'false' needs workaround
{
// Ensure control style is on (currently we're in a
// random state, as it could be set to false multiple
// times; e.g. base.OnHandleCreated does the following:
// 'this.AutoWordSelection = this.AutoWordSelection;')
this.AutoWordSelection = true;
// Toggle control style to false
this.AutoWordSelection = false;
Rectangle rect2 = new Rectangle(this.ClientRectangle.Left + 7, this.ClientRectangle.Top + 5, this.ClientRectangle.Width - 14, this.ClientRectangle.Height - 10);
SendMessage(this.Handle, EM_SETRECT, IntPtr.Zero, ref rect2);
}
}
/// <summary>
///
@ -128,29 +168,29 @@ namespace ryControls.Controls
}
base.OnEnter(e);
}
private bool _Selecting = false;
private int _StartPosition = 0;
//private bool _Selecting = false;
//private int _StartPosition = 0;
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{
if (_Selecting)
{
int charPosition = base.GetCharIndexFromPosition(new System.Drawing.Point(e.X, e.Y));
int length = 0;
if (charPosition >= _StartPosition)
{
length = charPosition - _StartPosition + 1;
this.Select(_StartPosition, length);
}
else
{
length = _StartPosition - charPosition;
this.Select(charPosition, length);
}
}
//if (_Selecting)
//{
// int charPosition = base.GetCharIndexFromPosition(new System.Drawing.Point(e.X, e.Y));
// int length = 0;
// if (charPosition >= _StartPosition)
// {
// length = charPosition - _StartPosition + 1;
// this.Select(_StartPosition, length);
// }
// else
// {
// length = _StartPosition - charPosition;
// this.Select(charPosition, length);
// }
//}
base.OnMouseMove(e);
}
@ -172,8 +212,8 @@ namespace ryControls.Controls
/// <param name="e"></param>
protected override void OnMouseDown(MouseEventArgs e)
{
this._Selecting = true;
_StartPosition = base.GetCharIndexFromPosition(new System.Drawing.Point(e.X, e.Y));
//this._Selecting = true;
//_StartPosition = base.GetCharIndexFromPosition(new System.Drawing.Point(e.X, e.Y));
if (e.Button==MouseButtons.Right && this.ContextMenuStrip==null)
{
contextMenuStripRichText1.Show(this, e.Location);
@ -186,9 +226,13 @@ namespace ryControls.Controls
/// <param name="e"></param>
protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
{
this._Selecting = false;
//this._Selecting = false;
base.OnMouseUp(e);
}
private const UInt32 WM_USER = 0x0400;
private const UInt32 EM_SETBKGNDCOLOR = (WM_USER + 67);
private const UInt32 WM_KILLFOCUS = 0x0008;
/// <summary>
///
/// </summary>
@ -204,18 +248,28 @@ namespace ryControls.Controls
Graphics g = Graphics.FromHwnd(m.HWnd);
g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
pen.Dispose();
return;
//m.Result = IntPtr.Zero;
}
if(!base.Focused && this.Text.Length==0)
{
Graphics g = Graphics.FromHwnd(m.HWnd);
Brush brush = new SolidBrush(Color.FromArgb(175, 185, 200));
g.DrawString(EmptyText,Font, brush, 3, 3);
g.DrawString(EmptyText,Font, brush, 3, 7);
brush.Dispose();
}
//返回结果
m.Result = IntPtr.Zero;
}
if (m.Msg == EM_SETBKGNDCOLOR) //color disabled background
{
Invalidate();
}
if (m.Msg == WM_KILLFOCUS) //set border back to normal on lost focus
{
Invalidate();
}
}
/// <summary>
/// 当文本框为空时,显示的内容。

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.2107.2901")]
[assembly: AssemblyFileVersion("3.0.2107.2901")]
[assembly: AssemblyVersion("3.0.2109.0301")]
[assembly: AssemblyFileVersion("3.0.2109.0301")]

View File

@ -364,7 +364,7 @@ namespace ryControls
{
try
{
rectFont = new Rectangle(rect.X + 10, rect.Y + 9, rect.Width - 30, rect.Height - 10);
rectFont = new Rectangle(rect.X + TabStrLeftMargin, rect.Y + 9, rect.Width - 30, rect.Height - TabStrLeftMargin);
rectClose = new Rectangle(rect.X + rect.Width - 25, 11, 12, 12);
if(!ShowCloseButton)
{
@ -400,6 +400,42 @@ namespace ryControls
}
catch { }
}
private int _radius = 15; //圆角半径
/// <summary>
///设置圆角半径
/// </summary>
[Description("圆角半径")]
[DefaultValue(15)]//设置圆角半径默认值为8最小值为4px
public int Radius
{
get { return _radius; }
set
{
if (_radius != value)
{
_radius = value < 4 ? 4 : value;
base.Invalidate();
}
}
}
private int _FontLeft = 10; //Tab文字左边距离
/// <summary>
///Tab文字左边距离
/// </summary>
[Description("Tab文字左边距离")]
[DefaultValue(10)]//
public int TabStrLeftMargin
{
get { return _FontLeft; }
set
{
if (_FontLeft != value)
{
_FontLeft = value < 4 ? 4 : value;
base.Invalidate();
}
}
}
/// <summary>
///
/// </summary>
@ -418,16 +454,16 @@ namespace ryControls
new Point(rect.X, rect.Bottom + 2));
//path.AddLine(rect.X + 4, rect.Bottom - 4, rect.Left + 15 - 4, rect.Y + 4);
path.AddBezier(
new Point(rect.Left + 15 - 4, rect.Y + 4),
new Point(rect.Left + 15 - 3, rect.Y + 2),
new Point(rect.Left + 15 - 3, rect.Y + 2),
new Point(rect.Left + 15, rect.Y));
new Point(rect.Left + _radius - 4, rect.Y + 4),
new Point(rect.Left + _radius - 3, rect.Y + 2),
new Point(rect.Left + _radius - 3, rect.Y + 2),
new Point(rect.Left + _radius, rect.Y));
//path.AddLine(rect.Left + 15, rect.Y, rect.Right - 15, rect.Y);
path.AddBezier(
new Point(rect.Right - 15, rect.Y),
new Point(rect.Right - 15 + 3, rect.Y + 2),
new Point(rect.Right - 15 + 3, rect.Y + 2),
new Point(rect.Right - 15 + 4, rect.Y + 4));
new Point(rect.Right - _radius, rect.Y),
new Point(rect.Right - _radius + 3, rect.Y + 2),
new Point(rect.Right - _radius + 3, rect.Y + 2),
new Point(rect.Right - _radius + 4, rect.Y + 4));
//path.AddLine(rect.Right - 15 + 4, rect.Y + 4, rect.Right - 4, rect.Bottom - 4);
path.AddBezier(
new Point(rect.Right, rect.Bottom),
@ -437,7 +473,7 @@ namespace ryControls
Region region = new System.Drawing.Region(path);
g.DrawPath(new Pen(Color.Black), path);
g.DrawPath(new Pen(Color.Gray), path);
if (mouseOver)
{
@ -502,6 +538,14 @@ namespace ryControls
return rectClose.Contains(cltPosition);
}
/// <summary>
/// 获取所有选项卡合起来的宽度
/// </summary>
/// <returns></returns>
private int GetTabTotalWidth()
{
return this.ItemSize.Width * this.TabCount;
}
/// <summary>
///
/// </summary>
/// <param name="e"></param>
@ -511,14 +555,14 @@ namespace ryControls
Draw(e.Graphics);
Graphics g = e.Graphics;
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
if (this.TabCount > 0)
{
if ((this.ItemSize.Width * this.TabCount) + 30 > this.ClientSize.Width || (this.ClientSize.Width - 30) / (this.TabCount) > this.ItemSize.Width)
if (GetTabTotalWidth() + 30 > this.ClientSize.Width || (this.ClientSize.Width - 30) / (this.TabCount) > this.ItemSize.Width)
{
if (this.ClientSize.Width < (this.TabCount * this.ItemSize.Width) + 30 || this.ItemSize.Width < TabMaxWidth)
if (this.ClientSize.Width < GetTabTotalWidth() + 30 || this.ItemSize.Width < TabMaxWidth)
{
if (this.TabCount > 0)
{
@ -532,13 +576,13 @@ namespace ryControls
}
}
addRec = new Rectangle((this.ItemSize.Width * this.TabCount) + 5, 8, 16, 16); //指定显示区域的位置的大小
addRec = new Rectangle(GetTabTotalWidth() + 5, 8, 16, 16); //指定显示区域的位置的大小
if (ShowAddButton)
{
e.Graphics.FillEllipse(new SolidBrush(colorMouseOn), addRec);
e.Graphics.DrawLine(new Pen(Color.White, 1.55f), (this.ItemSize.Width * this.TabCount) + 8, 16, (this.ItemSize.Width * this.TabCount) + 18, 16);
e.Graphics.DrawLine(new Pen(Color.White, 1.55f), (this.ItemSize.Width * this.TabCount) + 13, 11, (this.ItemSize.Width * this.TabCount) + 13, 21);
e.Graphics.DrawLine(new Pen(Color.White, 1.55f), GetTabTotalWidth() + 8, 16, GetTabTotalWidth() + 18, 16);
e.Graphics.DrawLine(new Pen(Color.White, 1.55f), GetTabTotalWidth() + 13, 11, GetTabTotalWidth() + 13, 21);
}
for (int i = 0; i < this.TabCount; i++)
{