diff --git a/Bin/Debug/MyTimeClock/MyTimeClock.exe b/Bin/Debug/MyTimeClock/MyTimeClock.exe index e76f10e..b3c4e18 100644 Binary files a/Bin/Debug/MyTimeClock/MyTimeClock.exe and b/Bin/Debug/MyTimeClock/MyTimeClock.exe differ diff --git a/Bin/Debug/MyTimeClock/RyWeb.dll b/Bin/Debug/MyTimeClock/RyWeb.dll deleted file mode 100644 index 44dd329..0000000 Binary files a/Bin/Debug/MyTimeClock/RyWeb.dll and /dev/null differ diff --git a/Bin/Debug/MyTimeClock/RyWeb.xml b/Bin/Debug/MyTimeClock/RyWeb.xml deleted file mode 100644 index 0f17d55..0000000 --- a/Bin/Debug/MyTimeClock/RyWeb.xml +++ /dev/null @@ -1,603 +0,0 @@ - - - - RyWeb - - - - - Http连接操作帮助类 - - - - - - - - - - - - 根据相传入的数据,得到相应页面数据 - - 参数类对象 - 返回HttpResult类型 - - - - 获取数据的并解析的方法 - - - - - - - 设置编码 - - HttpItem - HttpResult - byte[] - - - - 提取网页Byte - - - - - - 为请求准备参数 - - 参数列表 - - - - 设置证书 - - - - - - 设置多个证书 - - - - - - 设置Cookie - - Http参数 - - - - 设置Post数据 - - Http参数 - - - - 设置代理 - - 参数对象 - - - - 回调验证证书问题 - - 流对象 - 证书 - X509Chain - SslPolicyErrors - bool - - - - 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 - - - - - - - - - Http请求参考类 - - - - - 请求URL必须填写 - - - - - 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 - - - - - 默认请求超时时间 - - - - - 默认写入Post数据超时间 - - - - - 设置Host的标头信息 - - - - - 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 - - - - - 请求标头值 默认为text/html, application/xhtml+xml, */* - - - - - 请求返回类型默认 text/html - - - - - 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) - - - - - 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 - - - - - Post的数据类型 - - - - - Post请求时要发送的字符串Post数据 - - - - - Post请求时要发送的Byte类型的Post数据 - - - - - Cookie对象集合 - - - - - 请求时的Cookie - - - - - 来源地址,上次访问地址 - - - - - 证书绝对路径 - - - - - 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp - - - - - 是否设置为全文小写,默认为不转化 - - - - - 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 - - - - - 最大连接数 - - - - - 代理Proxy 服务器用户名 - - - - - 代理 服务器密码 - - - - - 代理 服务IP,如果要使用IE代理就设置为ieproxy - - - - - 设置返回类型String和Byte - - - - - header对象 - - - - - 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 - - - - - 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 - - - - - 设置509证书集合 - - - - - 设置或获取Post参数编码,默认的为Default编码 - - - - - Cookie返回类型,默认的是只返回字符串类型 - - - - - 获取或设置请求的身份验证信息。 - - - - - 设置请求将跟随的重定向的最大数目 - - - - - 获取和设置IfModifiedSince,默认为当前日期和时间 - - - - - 设置本地的出口ip和端口 - ] - - item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); - - - - - Http返回参数类 - - - - - Http请求返回的Cookie - - - - - Cookie对象集合 - - - - - 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 - - - - - 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 - - - - - header对象 - - - - - 返回状态说明 - - - - - 返回状态码,默认为OK - - - - - 最后访问的URl - - - - - 获取重定向的URl - - - - - 返回类型 - - - - - 表示只返回字符串 只有Html有数据 - - - - - 表示返回字符串和字节流 ResultByte和Html都有数据返回 - - - - - Post的数据格式默认为string - - - - - 字符串类型,这时编码Encoding可不设置 - - - - - Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 - - - - - 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 - - - - - Cookie返回类型 - - - - - 只返回字符串类型的Cookie - - - - - CookieCollection格式的Cookie集合同时也返回String类型的cookie - - - - - - - - - - 以post方式获取网页源码 - - - - - - - - - 以post方式提交json内容 - - - - - - - - - 以post方式提交json内容 - - - - - - - - 以post方式获取网页源码 - - - - - - - - - - 以post方式获取网页源码 - - - - - - - - 获取网址对应的文件大小 - - - - - - - - - - - - 获取网页源码 - - - - - - - - 获取网页源码 - - - - - - - - - 获取网页源码 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 将相对网址转换成绝对网址 - - 相对网址 - 当前页面地址 - 转换后的绝对网址 - - - - - - - - - - - - - - url解密 - - - - - - - - url解密,按UTF8方式解密 - - - - - - - Url加密 - - - - - - - - Url加密,按UTF8方式加密 - - - - - - - 解密 - - - - - - - 加密 - - - - - - - - - - - - - - - - - - - - - - - - - url加密,Unicode - - - - - - - - - - - - - - - - - - - - - - Html解码,将html里未转义成功的重新转义。 - - - - - - diff --git a/Bin/Debug/MyTimeClock/TimeClock.dll b/Bin/Debug/MyTimeClock/TimeClock.dll index 3f02e42..2e411f3 100644 Binary files a/Bin/Debug/MyTimeClock/TimeClock.dll and b/Bin/Debug/MyTimeClock/TimeClock.dll differ diff --git a/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat b/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat index a6df10d..743caeb 100644 Binary files a/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat and b/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat differ diff --git a/Bin/Debug/MyTimeClock/UserDb/Win.dat b/Bin/Debug/MyTimeClock/UserDb/Win.dat index 56b6c90..92b945e 100644 --- a/Bin/Debug/MyTimeClock/UserDb/Win.dat +++ b/Bin/Debug/MyTimeClock/UserDb/Win.dat @@ -1,2 +1,2 @@ [TimeClock] -hwnd=143234 +hwnd=4594100 diff --git a/Bin/Debug/MyTimeClock/cUpdate.dat b/Bin/Debug/MyTimeClock/cUpdate.dat index 4fe85a0..51a59ab 100644 --- a/Bin/Debug/MyTimeClock/cUpdate.dat +++ b/Bin/Debug/MyTimeClock/cUpdate.dat @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6425273..d50ff19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ -### 2021-10-16更新 +### 2021-10-18更新 +------ +#### TimeClock V1.0.2110.1801 +- *.[新增]便笺窗体圆角显示。 +- *.[新增]便笺标题栏不再自动隐藏,标题栏按钮加上点击效果。 +- *.[新增]便笺支持输入标题。 +### 2021-10-16更新 ------ #### TimeClock V1.0.2110.1601 - *.[新增]便笺新增靠边隐藏功能。 diff --git a/Source/MyTimeClock/.vs/TimeClock/v17/.suo b/Source/MyTimeClock/.vs/TimeClock/v17/.suo index d3351a5..98a1f2f 100644 Binary files a/Source/MyTimeClock/.vs/TimeClock/v17/.suo and b/Source/MyTimeClock/.vs/TimeClock/v17/.suo differ diff --git a/Source/MyTimeClock/TimeClock/API/ControlBoxManager.cs b/Source/MyTimeClock/TimeClock/API/ControlBoxManager.cs new file mode 100644 index 0000000..bdf460a --- /dev/null +++ b/Source/MyTimeClock/TimeClock/API/ControlBoxManager.cs @@ -0,0 +1,145 @@ +using MGdu.WinFormUI; +using MGdu.WinFormUI.MyGraphics; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace TimeClock.API +{ + class ControlBoxManager + { + private DbOp.FrmSticky _owner; + + private WLButton closeBtn; + private WLButton AddBtn; + #region event handler + + private void CloseBtnClick(object sender, EventArgs e) + { + _owner.CloseByUser(); + } + private void AddBtnClick(object sender, EventArgs e) + { + _owner.AddClick(); + } + #endregion + public static Color ChangeColor(Color color, float correctionFactor) + { + float red = (float)color.R; + float green = (float)color.G; + float blue = (float)color.B; + if (correctionFactor < 0) + { + correctionFactor = 1 + correctionFactor; + red *= correctionFactor; + green *= correctionFactor; + blue *= correctionFactor; + } + else + { + red = (255 - red) * correctionFactor + red; + green = (255 - green) * correctionFactor + green; + blue = (255 - blue) * correctionFactor + blue; + } + if (red < 0) red = 0; + if (red > 255) red = 255; + if (green < 0) green = 0; + if (green > 255) green = 255; + if (blue < 0) blue = 0; + if (blue > 255) blue = 255; + return Color.FromArgb(color.A, (int)red, (int)green, (int)blue); + } + private Color _ButtonColor = Color.Gray; + /// + /// 按钮字体颜色 + /// + [Category("GMForm")] + [Description("按钮字体颜色")] + public Color ButtonColor + { + get { return _ButtonColor; } + set + { + _ButtonColor = value; + } + } + private void SetControlBoxColor() + { + ButtonColorTable closeTable = new ButtonColorTable(); + closeTable.ForeColorNormal = closeTable.ForeColorHover + = closeTable.ForeColorPressed = _ButtonColor; + closeTable.BackColorHover = ChangeColor(_owner.BackColor,-0.3f); + closeTable.BackColorPressed = Color.FromArgb(240, 231, 232); + closeBtn.ColorTable = closeTable; + AddBtn.ColorTable = closeTable; + //closeBtn.BackImageNormal = _owner.XTheme.CloseBoxBackImageNormal; + //closeBtn.BackImageHover = _owner.XTheme.CloseBoxBackImageHover; + //closeBtn.BackImagePressed = _owner.XTheme.CloseBoxBackImagePressed; + } + public void ButtonVisible(bool visible) + { + AddBtn.Visible = visible; + closeBtn.Visible = visible; + } + public bool AddBtnVisible + { + get { return AddBtn.Visible; } + } + private void BtnIni() + { + // add box + AddBtn = new WLButton(_owner); + AddBtn.Visible = true; + AddBtn.Bounds = _owner.AddBoxRect; + + AddBtn.Click += new EventHandler(AddBtnClick); + AddBtn.ForePathGetter = new ButtonForePathGetter( + GraphicsPathHelper.CreatePlusFlag); + // close box + closeBtn = new WLButton(_owner); + closeBtn.Visible = true; + closeBtn.Bounds = _owner.CloseBoxRect; + + closeBtn.Click += new EventHandler(CloseBtnClick); + closeBtn.ForePathGetter = new ButtonForePathGetter( + GraphicsPathHelper.CreateCloseFlagPath); + SetControlBoxColor(); + } + + public ControlBoxManager(DbOp.FrmSticky owner) + { + _owner = owner; + BtnIni(); + } + + public void FormResize() + { + AddBtn.Bounds = _owner.AddBoxRect; + closeBtn.Bounds = _owner.CloseBoxRect; + } + + public void MouseOperation(Point location, MouseOperationType type) + { + AddBtn.MouseOperation(location, type); + closeBtn.MouseOperation(location, type); + } + + public void DrawBoxes(Graphics g) + { + if (_owner.ControlBox) + { + AddBtn.DrawButton(g); + closeBtn.DrawButton(g); + } + } + + public void ResetBoxColor() + { + SetControlBoxColor(); + } + } +} diff --git a/Source/MyTimeClock/TimeClock/API/Win32.cs b/Source/MyTimeClock/TimeClock/API/Win32.cs new file mode 100644 index 0000000..a722776 --- /dev/null +++ b/Source/MyTimeClock/TimeClock/API/Win32.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace TimeClock.API +{ + public class Win32 + { + public enum WindowMessages + { + WM_MOVE = 0x0003, + WM_SIZE = 0x0005, + WM_ACTIVATE = 0x0006, + + WM_ACTIVATEAPP = 0x001C, + + WM_SETCURSOR = 0x0020, + WM_MOUSEACTIVATE = 0x0021, + WM_GETMINMAXINFO = 0x24, + WM_WINDOWPOSCHANGING = 0x0046, + WM_WINDOWPOSCHANGED = 0x0047, + + // non client area + WM_NCCREATE = 0x0081, + WM_NCDESTROY = 0x0082, + WM_NCCALCSIZE = 0x0083, + WM_NCHITTEST = 0x84, + WM_NCPAINT = 0x0085, + WM_NCACTIVATE = 0x0086, + + // non client mouse + WM_NCMOUSEMOVE = 0x00A0, + WM_NCLBUTTONDOWN = 0x00A1, + WM_NCLBUTTONUP = 0x00A2, + WM_NCLBUTTONDBLCLK = 0x00A3, + WM_NCRBUTTONDOWN = 0x00A4, + WM_NCRBUTTONUP = 0x00A5, + WM_NCRBUTTONDBLCLK = 0x00A6, + WM_NCMBUTTONDOWN = 0x00A7, + WM_NCMBUTTONUP = 0x00A8, + WM_NCMBUTTONDBLCLK = 0x00A9, + + WM_SYSCOMMAND = 0x0112, + WM_PARENTNOTIFY = 0x0210, + + WM_MDINEXT = 0x224, + } + [StructLayout(LayoutKind.Sequential)] + public struct NCCALCSIZE_PARAMS + { + /// + /// Contains the new coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates. + /// + public RECT rectNewForm; + /// + /// Contains the coordinates of the window before it was moved or resized. + /// + public RECT rectOldForm; + /// + /// Contains the coordinates of the window's client area before the window was moved or resized. + /// + public RECT rectOldClient; + /// + /// Pointer to a WINDOWPOS structure that contains the size and position values specified in the operation that moved or resized the window. + /// + public WINDOWPOS lpPos; + } + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int Left; + public int Top; + public int Right; + public int Bottom; + + public RECT(int left, int top, int right, int bottom) + { + this.Left = left; + this.Top = top; + this.Right = right; + this.Bottom = bottom; + } + + public override string ToString() + { + return "{ Left:" + this.Left + ", Top:" + this.Top + + ", Width:" + (this.Right - this.Left).ToString() + + ", Height:" + (this.Bottom - this.Top).ToString() + "}"; + } + } + [StructLayout(LayoutKind.Sequential)] + public struct WINDOWPOS + { + public IntPtr hwnd; + public IntPtr hWndInsertAfter; + public int x; + public int y; + public int cx; + public int cy; + public uint flags; + } + } +} diff --git a/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.Designer.cs b/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.Designer.cs index 06aa0f0..7c7736b 100644 --- a/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.Designer.cs +++ b/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.Designer.cs @@ -54,13 +54,12 @@ this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripMenuItem(); + this.靠边隐藏ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator(); this.插入ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.插入时间ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PnlTop = new System.Windows.Forms.Panel(); this.LblTopMost = new System.Windows.Forms.Label(); - this.LblClose = new System.Windows.Forms.Label(); - this.LblAdd = new System.Windows.Forms.Label(); this.PnlBottom = new System.Windows.Forms.Panel(); this.LblImage = new System.Windows.Forms.Label(); this.LblBullet = new System.Windows.Forms.Label(); @@ -73,7 +72,8 @@ this.fontDialog1 = new System.Windows.Forms.FontDialog(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.靠边隐藏ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.TxtTitle = new System.Windows.Forms.TextBox(); + this.置顶显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MenuNote.SuspendLayout(); this.PnlTop.SuspendLayout(); this.PnlBottom.SuspendLayout(); @@ -81,13 +81,16 @@ // // txtContent // - this.txtContent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.txtContent.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.txtContent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(247)))), ((int)(((byte)(209))))); this.txtContent.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtContent.ContextMenuStrip = this.MenuNote; - this.txtContent.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtContent.Location = new System.Drawing.Point(3, 32); + this.txtContent.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtContent.Location = new System.Drawing.Point(5, 32); this.txtContent.Name = "txtContent"; - this.txtContent.Size = new System.Drawing.Size(345, 262); + this.txtContent.Size = new System.Drawing.Size(341, 260); this.txtContent.TabIndex = 0; this.txtContent.Text = ""; this.txtContent.TextChanged += new System.EventHandler(this.txtContent_TextChanged); @@ -110,17 +113,18 @@ this.背景颜色ToolStripMenuItem, this.透明度ToolStripMenuItem, this.靠边隐藏ToolStripMenuItem, + this.置顶显示ToolStripMenuItem, this.toolStripMenuItem4, this.插入ToolStripMenuItem}); this.MenuNote.Name = "MenuNote"; - this.MenuNote.Size = new System.Drawing.Size(181, 336); + this.MenuNote.Size = new System.Drawing.Size(149, 336); this.MenuNote.Opening += new System.ComponentModel.CancelEventHandler(this.MenuNote_Opening); // // 撤销ToolStripMenuItem // this.撤销ToolStripMenuItem.Name = "撤销ToolStripMenuItem"; this.撤销ToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Z"; - this.撤销ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.撤销ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.撤销ToolStripMenuItem.Text = "撤销"; this.撤销ToolStripMenuItem.Click += new System.EventHandler(this.撤销ToolStripMenuItem_Click); // @@ -128,20 +132,20 @@ // this.重做ToolStripMenuItem.Name = "重做ToolStripMenuItem"; this.重做ToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Y"; - this.重做ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.重做ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.重做ToolStripMenuItem.Text = "重做"; this.重做ToolStripMenuItem.Click += new System.EventHandler(this.重做ToolStripMenuItem_Click); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem1.Size = new System.Drawing.Size(145, 6); // // 剪切ToolStripMenuItem // this.剪切ToolStripMenuItem.Name = "剪切ToolStripMenuItem"; this.剪切ToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+X"; - this.剪切ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.剪切ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.剪切ToolStripMenuItem.Text = "剪切"; this.剪切ToolStripMenuItem.Click += new System.EventHandler(this.剪切ToolStripMenuItem_Click); // @@ -149,7 +153,7 @@ // this.复制ToolStripMenuItem.Name = "复制ToolStripMenuItem"; this.复制ToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; - this.复制ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.复制ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.复制ToolStripMenuItem.Text = "复制"; this.复制ToolStripMenuItem.Click += new System.EventHandler(this.复制ToolStripMenuItem_Click); // @@ -157,7 +161,7 @@ // this.粘贴ToolStripMenuItem.Name = "粘贴ToolStripMenuItem"; this.粘贴ToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+V"; - this.粘贴ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.粘贴ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.粘贴ToolStripMenuItem.Text = "粘贴"; this.粘贴ToolStripMenuItem.Click += new System.EventHandler(this.粘贴ToolStripMenuItem_Click); // @@ -165,46 +169,46 @@ // this.删除ToolStripMenuItem.Name = "删除ToolStripMenuItem"; this.删除ToolStripMenuItem.ShortcutKeyDisplayString = "Delete"; - this.删除ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.删除ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.删除ToolStripMenuItem.Text = "删除"; this.删除ToolStripMenuItem.Click += new System.EventHandler(this.删除ToolStripMenuItem_Click); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem2.Size = new System.Drawing.Size(145, 6); // // 全选ToolStripMenuItem // this.全选ToolStripMenuItem.Name = "全选ToolStripMenuItem"; this.全选ToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+A"; - this.全选ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.全选ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.全选ToolStripMenuItem.Text = "全选"; this.全选ToolStripMenuItem.Click += new System.EventHandler(this.全选ToolStripMenuItem_Click); // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem3.Size = new System.Drawing.Size(145, 6); // // 字体ToolStripMenuItem // this.字体ToolStripMenuItem.Name = "字体ToolStripMenuItem"; - this.字体ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.字体ToolStripMenuItem.Size = new System.Drawing.Size(148, 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(148, 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(148, 22); this.背景颜色ToolStripMenuItem.Text = "便笺背景颜色"; this.背景颜色ToolStripMenuItem.Click += new System.EventHandler(this.背景颜色ToolStripMenuItem_Click); // @@ -221,100 +225,110 @@ this.toolStripMenuItem12, this.toolStripMenuItem13}); this.透明度ToolStripMenuItem.Name = "透明度ToolStripMenuItem"; - this.透明度ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.透明度ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.透明度ToolStripMenuItem.Text = "透明度"; // // 不透明ToolStripMenuItem // this.不透明ToolStripMenuItem.Name = "不透明ToolStripMenuItem"; - this.不透明ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.不透明ToolStripMenuItem.Size = new System.Drawing.Size(112, 22); this.不透明ToolStripMenuItem.Text = "不透明"; this.不透明ToolStripMenuItem.Click += new System.EventHandler(this.不透明ToolStripMenuItem_Click); // // toolStripMenuItem5 // this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem5.Size = new System.Drawing.Size(109, 6); // // toolStripMenuItem7 // this.toolStripMenuItem7.Name = "toolStripMenuItem7"; - this.toolStripMenuItem7.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem7.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem7.Text = "60%"; this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click); // // toolStripMenuItem8 // this.toolStripMenuItem8.Name = "toolStripMenuItem8"; - this.toolStripMenuItem8.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem8.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem8.Text = "70%"; this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click); // // toolStripMenuItem9 // this.toolStripMenuItem9.Name = "toolStripMenuItem9"; - this.toolStripMenuItem9.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem9.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem9.Text = "75%"; this.toolStripMenuItem9.Click += new System.EventHandler(this.toolStripMenuItem9_Click); // // toolStripMenuItem10 // this.toolStripMenuItem10.Name = "toolStripMenuItem10"; - this.toolStripMenuItem10.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem10.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem10.Text = "80%"; this.toolStripMenuItem10.Click += new System.EventHandler(this.toolStripMenuItem10_Click); // // toolStripMenuItem11 // this.toolStripMenuItem11.Name = "toolStripMenuItem11"; - this.toolStripMenuItem11.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem11.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem11.Text = "85%"; this.toolStripMenuItem11.Click += new System.EventHandler(this.toolStripMenuItem11_Click); // // toolStripMenuItem12 // this.toolStripMenuItem12.Name = "toolStripMenuItem12"; - this.toolStripMenuItem12.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem12.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem12.Text = "90%"; this.toolStripMenuItem12.Click += new System.EventHandler(this.toolStripMenuItem12_Click); // // toolStripMenuItem13 // this.toolStripMenuItem13.Name = "toolStripMenuItem13"; - this.toolStripMenuItem13.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem13.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem13.Text = "95%"; this.toolStripMenuItem13.Click += new System.EventHandler(this.toolStripMenuItem13_Click); // + // 靠边隐藏ToolStripMenuItem + // + this.靠边隐藏ToolStripMenuItem.Checked = true; + this.靠边隐藏ToolStripMenuItem.CheckOnClick = true; + this.靠边隐藏ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.靠边隐藏ToolStripMenuItem.Name = "靠边隐藏ToolStripMenuItem"; + this.靠边隐藏ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); + this.靠边隐藏ToolStripMenuItem.Text = "靠边隐藏"; + // // toolStripMenuItem4 // this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem4.Size = new System.Drawing.Size(145, 6); // // 插入ToolStripMenuItem // this.插入ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.插入时间ToolStripMenuItem}); this.插入ToolStripMenuItem.Name = "插入ToolStripMenuItem"; - this.插入ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.插入ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.插入ToolStripMenuItem.Text = "插入"; // // 插入时间ToolStripMenuItem // this.插入时间ToolStripMenuItem.Name = "插入时间ToolStripMenuItem"; - this.插入时间ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.插入时间ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.插入时间ToolStripMenuItem.Text = "插入时间"; this.插入时间ToolStripMenuItem.Click += new System.EventHandler(this.插入时间ToolStripMenuItem_Click); // // PnlTop // + this.PnlTop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.PnlTop.Controls.Add(this.TxtTitle); this.PnlTop.Controls.Add(this.LblTopMost); - this.PnlTop.Controls.Add(this.LblClose); - this.PnlTop.Controls.Add(this.LblAdd); - this.PnlTop.Dock = System.Windows.Forms.DockStyle.Top; - this.PnlTop.Location = new System.Drawing.Point(3, 3); + this.PnlTop.Location = new System.Drawing.Point(35, 3); this.PnlTop.Name = "PnlTop"; - this.PnlTop.Size = new System.Drawing.Size(345, 29); + this.PnlTop.Size = new System.Drawing.Size(282, 27); this.PnlTop.TabIndex = 1; + this.PnlTop.Visible = false; // // LblTopMost // @@ -322,40 +336,15 @@ this.LblTopMost.BackColor = System.Drawing.Color.Transparent; this.LblTopMost.Cursor = System.Windows.Forms.Cursors.Hand; this.LblTopMost.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LblTopMost.Location = new System.Drawing.Point(298, 5); + this.LblTopMost.Location = new System.Drawing.Point(235, 5); this.LblTopMost.Name = "LblTopMost"; this.LblTopMost.Size = new System.Drawing.Size(20, 19); this.LblTopMost.TabIndex = 2; this.LblTopMost.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.toolTip1.SetToolTip(this.LblTopMost, "置顶/取消置顶"); + this.LblTopMost.Visible = false; this.LblTopMost.Click += new System.EventHandler(this.LblTopMost_Click); // - // LblClose - // - this.LblClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.LblClose.BackColor = System.Drawing.Color.Transparent; - this.LblClose.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblClose.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LblClose.Location = new System.Drawing.Point(324, 5); - this.LblClose.Name = "LblClose"; - this.LblClose.Size = new System.Drawing.Size(20, 19); - this.LblClose.TabIndex = 1; - this.LblClose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.toolTip1.SetToolTip(this.LblClose, "关闭"); - this.LblClose.Click += new System.EventHandler(this.LblClose_Click); - // - // LblAdd - // - this.LblAdd.BackColor = System.Drawing.Color.Transparent; - this.LblAdd.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblAdd.Font = new System.Drawing.Font("黑体", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LblAdd.Location = new System.Drawing.Point(6, 4); - this.LblAdd.Name = "LblAdd"; - this.LblAdd.Size = new System.Drawing.Size(20, 19); - this.LblAdd.TabIndex = 0; - this.LblAdd.Text = "+"; - this.LblAdd.Click += new System.EventHandler(this.LblAdd_Click); - // // PnlBottom // this.PnlBottom.Controls.Add(this.LblImage); @@ -365,9 +354,9 @@ this.PnlBottom.Controls.Add(this.LblItalic); this.PnlBottom.Controls.Add(this.LblBold); this.PnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; - this.PnlBottom.Location = new System.Drawing.Point(3, 294); + this.PnlBottom.Location = new System.Drawing.Point(5, 292); this.PnlBottom.Name = "PnlBottom"; - this.PnlBottom.Size = new System.Drawing.Size(345, 25); + this.PnlBottom.Size = new System.Drawing.Size(341, 25); this.PnlBottom.TabIndex = 2; // // LblImage @@ -375,10 +364,10 @@ this.LblImage.AutoSize = true; this.LblImage.BackColor = System.Drawing.Color.Transparent; this.LblImage.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblImage.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LblImage.Font = new System.Drawing.Font("Courier New", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LblImage.Location = new System.Drawing.Point(153, 6); this.LblImage.Name = "LblImage"; - this.LblImage.Size = new System.Drawing.Size(22, 14); + this.LblImage.Size = new System.Drawing.Size(24, 17); this.LblImage.TabIndex = 6; this.LblImage.Text = "图"; this.toolTip1.SetToolTip(this.LblImage, "插入图片"); @@ -389,10 +378,10 @@ this.LblBullet.AutoSize = true; this.LblBullet.BackColor = System.Drawing.Color.Transparent; this.LblBullet.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblBullet.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LblBullet.Font = new System.Drawing.Font("Courier New", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LblBullet.Location = new System.Drawing.Point(125, 6); this.LblBullet.Name = "LblBullet"; - this.LblBullet.Size = new System.Drawing.Size(22, 14); + this.LblBullet.Size = new System.Drawing.Size(13, 17); this.LblBullet.TabIndex = 5; this.LblBullet.Text = "┇"; this.toolTip1.SetToolTip(this.LblBullet, "项目符号"); @@ -403,10 +392,10 @@ this.LblStrikeout.AutoSize = true; this.LblStrikeout.BackColor = System.Drawing.Color.Transparent; this.LblStrikeout.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblStrikeout.Font = new System.Drawing.Font("宋体", 10.5F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Strikeout))), System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LblStrikeout.Font = new System.Drawing.Font("Courier New", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LblStrikeout.Location = new System.Drawing.Point(88, 6); this.LblStrikeout.Name = "LblStrikeout"; - this.LblStrikeout.Size = new System.Drawing.Size(31, 14); + this.LblStrikeout.Size = new System.Drawing.Size(32, 17); this.LblStrikeout.TabIndex = 4; this.LblStrikeout.Text = "abc"; this.toolTip1.SetToolTip(this.LblStrikeout, "删除线"); @@ -417,10 +406,10 @@ this.LblUnderline.AutoSize = true; this.LblUnderline.BackColor = System.Drawing.Color.Transparent; this.LblUnderline.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblUnderline.Font = new System.Drawing.Font("宋体", 10.5F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LblUnderline.Font = new System.Drawing.Font("Courier New", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LblUnderline.Location = new System.Drawing.Point(62, 6); this.LblUnderline.Name = "LblUnderline"; - this.LblUnderline.Size = new System.Drawing.Size(15, 14); + this.LblUnderline.Size = new System.Drawing.Size(16, 17); this.LblUnderline.TabIndex = 3; this.LblUnderline.Text = "U"; this.toolTip1.SetToolTip(this.LblUnderline, "下划线"); @@ -431,10 +420,10 @@ this.LblItalic.AutoSize = true; this.LblItalic.BackColor = System.Drawing.Color.Transparent; this.LblItalic.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblItalic.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LblItalic.Font = new System.Drawing.Font("Courier New", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LblItalic.Location = new System.Drawing.Point(36, 6); this.LblItalic.Name = "LblItalic"; - this.LblItalic.Size = new System.Drawing.Size(15, 14); + this.LblItalic.Size = new System.Drawing.Size(16, 17); this.LblItalic.TabIndex = 2; this.LblItalic.Text = "/"; this.toolTip1.SetToolTip(this.LblItalic, "斜体"); @@ -445,10 +434,10 @@ this.LblBold.AutoSize = true; this.LblBold.BackColor = System.Drawing.Color.Transparent; this.LblBold.Cursor = System.Windows.Forms.Cursors.Hand; - this.LblBold.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LblBold.Font = new System.Drawing.Font("Courier New", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LblBold.Location = new System.Drawing.Point(10, 6); this.LblBold.Name = "LblBold"; - this.LblBold.Size = new System.Drawing.Size(15, 14); + this.LblBold.Size = new System.Drawing.Size(16, 17); this.LblBold.TabIndex = 1; this.LblBold.Text = "B"; this.toolTip1.SetToolTip(this.LblBold, "加粗"); @@ -463,37 +452,52 @@ // this.openFileDialog1.Filter = "图片|*.jpg;*.bmp;*.gif;*.png"; // - // 靠边隐藏ToolStripMenuItem + // TxtTitle // - this.靠边隐藏ToolStripMenuItem.Checked = true; - this.靠边隐藏ToolStripMenuItem.CheckOnClick = true; - this.靠边隐藏ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.靠边隐藏ToolStripMenuItem.Name = "靠边隐藏ToolStripMenuItem"; - this.靠边隐藏ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.靠边隐藏ToolStripMenuItem.Text = "靠边隐藏"; + 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.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(247)))), ((int)(((byte)(209))))); + this.TxtTitle.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.TxtTitle.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.TxtTitle.Location = new System.Drawing.Point(3, 3); + this.TxtTitle.MaxLength = 120; + this.TxtTitle.Name = "TxtTitle"; + this.TxtTitle.Size = new System.Drawing.Size(276, 19); + this.TxtTitle.TabIndex = 3; + this.TxtTitle.TextChanged += new System.EventHandler(this.TxtTitle_TextChanged); + // + // 置顶显示ToolStripMenuItem + // + this.置顶显示ToolStripMenuItem.CheckOnClick = true; + 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); // // FrmSticky // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(247)))), ((int)(((byte)(209))))); this.ClientSize = new System.Drawing.Size(351, 322); this.Controls.Add(this.txtContent); this.Controls.Add(this.PnlBottom); this.Controls.Add(this.PnlTop); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "FrmSticky"; - this.Padding = new System.Windows.Forms.Padding(3); + this.Padding = new System.Windows.Forms.Padding(5); this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmSticky_FormClosed); this.Load += new System.EventHandler(this.FrmSticky_Load); + this.ResizeBegin += new System.EventHandler(this.FrmSticky_ResizeBegin); this.ResizeEnd += new System.EventHandler(this.FrmSticky_ResizeEnd); this.LocationChanged += new System.EventHandler(this.FrmSticky_LocationChanged); this.SizeChanged += new System.EventHandler(this.FrmSticky_SizeChanged); this.Resize += new System.EventHandler(this.FrmSticky_Resize); this.MenuNote.ResumeLayout(false); this.PnlTop.ResumeLayout(false); + this.PnlTop.PerformLayout(); this.PnlBottom.ResumeLayout(false); this.PnlBottom.PerformLayout(); this.ResumeLayout(false); @@ -503,10 +507,7 @@ #endregion private System.Windows.Forms.RichTextBox txtContent; - private System.Windows.Forms.Panel PnlTop; private System.Windows.Forms.Panel PnlBottom; - private System.Windows.Forms.Label LblClose; - private System.Windows.Forms.Label LblAdd; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Label LblStrikeout; private System.Windows.Forms.Label LblUnderline; @@ -547,5 +548,8 @@ private System.Windows.Forms.Label LblImage; private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.ToolStripMenuItem 靠边隐藏ToolStripMenuItem; + public System.Windows.Forms.Panel PnlTop; + private System.Windows.Forms.TextBox TxtTitle; + private System.Windows.Forms.ToolStripMenuItem 置顶显示ToolStripMenuItem; } } \ No newline at end of file diff --git a/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.cs b/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.cs index 5c0f1b3..b6ef115 100644 --- a/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.cs +++ b/Source/MyTimeClock/TimeClock/DbOp/FrmSticky.cs @@ -1,21 +1,23 @@ -using ryCommon; -using ryCommonDb; +using MGdu.WinFormUI.MyGraphics; +using ryCommon; +using ryCommonDb; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Drawing.Drawing2D; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; - +using TimeClock.API; + namespace TimeClock.DbOp { public partial class FrmSticky : Form { - internal AnchorStyles StopAanhor = AnchorStyles.Top; - bool hideFlag = false; + ControlBoxManager controlBoxManager; public FrmSticky() { InitializeComponent(); @@ -26,10 +28,19 @@ namespace TimeClock.DbOp superform.SetFormMove(PnlTop); superform.SetFormMove(PnlBottom); timer1.Start(); + SetFormRegion(); + this.SetStyle( + ControlStyles.AllPaintingInWmPaint | + ControlStyles.UserPaint | + ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw, true); + this.DoubleBuffered = true; + this.UpdateStyles(); + controlBoxManager = new ControlBoxManager(this); //RyForm.SetDesktopForm(Handle); } //定义图像反色函数 - private Bitmap PContray(Image a,Color _rev_color) + private Bitmap PContray(Image a, Color _rev_color) { int Height = a.Height; int Width = a.Width; @@ -42,11 +53,178 @@ namespace TimeClock.DbOp for (int y = 1; y < Height; y++) { pixel = MyBitmap.GetPixel(x, y); - if (pixel.A==0 && pixel.R==0 && pixel.G==0 && pixel.B==0) { continue; } + if (pixel.A == 0 && pixel.R == 0 && pixel.G == 0 && pixel.B == 0) { continue; } bitmap.SetPixel(x, y, img_color); } } - return bitmap; + return bitmap; + } + /// + /// 窗体上移动鼠标时激发 + /// + /// + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + if (ControlBox) + controlBoxManager.MouseOperation(e.Location, MGdu.WinFormUI.MouseOperationType.Move); + } + /// + /// 在窗体上按下鼠标时激发 + /// + /// + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (e.Button != System.Windows.Forms.MouseButtons.Left) + { + return; + } + + if (ControlBox) + controlBoxManager.MouseOperation(e.Location, MGdu.WinFormUI.MouseOperationType.Down); + } + /// + /// 在窗体上放开鼠标时激发 + /// + /// + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + if (e.Clicks > 1) + return; + if (ControlBox) + controlBoxManager.MouseOperation(e.Location, MGdu.WinFormUI.MouseOperationType.Up); + } + /// + /// 在鼠标离开窗体时激发 + /// + /// + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + if (ControlBox) + controlBoxManager.MouseOperation(Point.Empty, MGdu.WinFormUI.MouseOperationType.Leave); + } + private bool WmNcCalcSize(ref Message m) + { + if (m.WParam == new IntPtr(1)) + { + Win32.NCCALCSIZE_PARAMS info = (Win32.NCCALCSIZE_PARAMS) + Marshal.PtrToStructure(m.LParam, typeof(Win32.NCCALCSIZE_PARAMS)); + //if (IsAboutToMaximize(info.rectNewForm)) + //{ + // Rectangle workingRect = Screen.GetWorkingArea(this); + // info.rectNewForm.Left = workingRect.Left - 1; + // info.rectNewForm.Top = workingRect.Top - 1; + // info.rectNewForm.Right = workingRect.Right + 1; + // info.rectNewForm.Bottom = workingRect.Bottom + 1; + // Marshal.StructureToPtr(info, m.LParam, false); + //} + } + return true; + } + /// + /// 消息 + /// + /// + protected override void WndProc(ref Message m) + { + //if (this.DesignMode) { base.WndProc(ref m); return; } + bool alreadyHandled = false; + switch (m.Msg) + { + case (int)Win32.WindowMessages.WM_NCCALCSIZE: + alreadyHandled = WmNcCalcSize(ref m); + break; + case (int)Win32.WindowMessages.WM_NCPAINT: + alreadyHandled = true; + break; + + default: + break; + } + + if (!alreadyHandled) + base.WndProc(ref m); + } + private Color _ButtonColor = Color.Gray; + /// + /// 按钮字体颜色 + /// + [Category("GMForm")] + [Description("按钮字体颜色")] + public Color ButtonColor + { + get { return _ButtonColor; } + set + { + _ButtonColor = value; + Invalidate(); + } + } + private Size _CloseBoxSize=new Size(24, 24); + /// + /// 窗体关闭按钮的尺寸 + /// + [Category("GMForm")] + [Description("窗体关闭按钮的尺寸")] + [DefaultValue(typeof(Size), "24, 24")] + public Size CloseBoxSize + { + get { return _CloseBoxSize; } + set + { + _CloseBoxSize = value; + Invalidate(); + } + } + internal Rectangle CloseBoxRect + { + get + { + if (ControlBox) + { + int x = ClientSize.Width -2 - CloseBoxSize.Width; + return new Rectangle( + new Point(x, 2), + CloseBoxSize); + } + else + return Rectangle.Empty; + } + } + internal Rectangle AddBoxRect + { + get + { + if (ControlBox) + { + int x = 4; + return new Rectangle( + new Point(x, 2), + CloseBoxSize); + } + else + return Rectangle.Empty; + } + } + internal Rectangle TextRect + { + get + { + int x =controlBoxManager.AddBtnVisible? AddBoxRect.Right+5:8; + int y = 1; + int height = AddBoxRect.Height; + int right = this.ClientSize.Width - x; + if (ControlBox) + { + right = CloseBoxRect.Left; + } + int width = right - x; + return new Rectangle(x, y, width, height); + } } /// /// 设置或获取当前便捷的ID号 @@ -68,17 +246,20 @@ namespace TimeClock.DbOp PnlTop.BackColor = value; PnlBottom.BackColor = value; txtContent.BackColor = value; + TxtTitle.BackColor = value; var rev_color= GetRevColor(); - LblTopMost.Image = PContray(Itrycn_Db.GetSkinImg("top"), rev_color); - LblClose.Image = PContray(Itrycn_Db.GetSkinImg("close"), rev_color); + _ButtonColor = rev_color; + TxtTitle.ForeColor = rev_color; txtContent.ForeColor = rev_color; - LblAdd.ForeColor = rev_color; LblBold.ForeColor = rev_color; LblItalic.ForeColor = rev_color; LblUnderline.ForeColor = rev_color; LblStrikeout.ForeColor = rev_color; LblBullet.ForeColor = rev_color; - LblImage.ForeColor = rev_color; + LblImage.ForeColor = rev_color; + controlBoxManager.ButtonColor = ButtonColor; + controlBoxManager.ResetBoxColor(); + Invalidate(); } } private Color GetRevColor() @@ -97,17 +278,15 @@ namespace TimeClock.DbOp // Color img_color = Color.FromArgb(255 - StickyBackColor.R, 255 - StickyBackColor.G, 255 - StickyBackColor.B); return ryControls.ColorHelper.HslToRgb(hsl).GetColor(); } - #region 界面按钮设置 - private void LblClose_Click(object sender, EventArgs e) - { + public void CloseByUser() + { DeskShow = 0; if (txtContent.Text == "") { - DataProvider mydb = new DataProvider(); IDbInterface db = TimeClock.Itrycn_Db.CreateDataProvider(TimeClock.Itrycn_Db.dataType); if (db.ConnDb(TimeClock.Itrycn_Db.SQLConnStr) == 1) { - db.DelById("Sticky",Id.ToString()); + db.DelById("Sticky", Id.ToString()); } db.Free(); } @@ -117,9 +296,13 @@ namespace TimeClock.DbOp } this.Close(); } - public bool ProcUse = false; - private void LblAdd_Click(object sender, EventArgs e) + #region 界面按钮设置 + private void LblClose_Click(object sender, EventArgs e) { + + } + public void AddClick() + { FrmSticky frm = new FrmSticky(); frm.ProcUse = true; frm.Id = -1; @@ -127,8 +310,9 @@ namespace TimeClock.DbOp frm.StickyBackColor = StickyBackColor; frm.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frm.Width, 20); frm.Show(); - frm.ProcUse = false; + frm.ProcUse = false; } + public bool ProcUse = false; private void SetFontStyle(FontStyle style, bool IsRemove) { var font = txtContent.SelectionFont ?? this.Font; @@ -238,6 +422,55 @@ namespace TimeClock.DbOp StickyBackColor = colorDialog1.Color; SaveSticky(); } + } + private void LblTopMost_Click(object sender, EventArgs e) + { + this.TopMost = !this.TopMost; + SaveSticky(); + } + private void 插入时间ToolStripMenuItem_Click(object sender, EventArgs e) + { + txtContent.SelectedText = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + + private void 不透明ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Opacity = 1; SaveSticky(); + } + + private void toolStripMenuItem7_Click(object sender, EventArgs e) + { + this.Opacity = 0.6; SaveSticky(); + } + + private void toolStripMenuItem8_Click(object sender, EventArgs e) + { + this.Opacity = 0.7; SaveSticky(); + } + + private void toolStripMenuItem9_Click(object sender, EventArgs e) + { + this.Opacity = 0.75; SaveSticky(); + } + + private void toolStripMenuItem10_Click(object sender, EventArgs e) + { + this.Opacity = 0.8; SaveSticky(); + } + + private void toolStripMenuItem11_Click(object sender, EventArgs e) + { + this.Opacity = 0.85; SaveSticky(); + } + + private void toolStripMenuItem12_Click(object sender, EventArgs e) + { + this.Opacity = 0.9; SaveSticky(); + } + + private void toolStripMenuItem13_Click(object sender, EventArgs e) + { + this.Opacity = 0.95; SaveSticky(); } #endregion private void FrmSticky_Load(object sender, EventArgs e) @@ -252,6 +485,7 @@ namespace TimeClock.DbOp if (ProcUse) { return; } RyQuickSQL mySQL = new RyQuickSQL("Sticky"); mySQL.AddField("RichContent", txtContent.Rtf); + mySQL.AddField("Title", this.Text); mySQL.AddField("Content", txtContent.Text); mySQL.AddField("DeskShow", DeskShow); ryCommon.Storage mStor = new ryCommon.Storage(); @@ -309,6 +543,8 @@ namespace TimeClock.DbOp { var row = mydb.GetData(ds); #region 读取便笺信息 + this.Text= row["Title"].ToString(); + if (this.Text.Length == 0) { this.Text = "默认标题"; } try { txtContent.Rtf = row["RichContent"].ToString(); @@ -325,6 +561,7 @@ namespace TimeClock.DbOp if (this.Left > screen.Right) { this.Left = screen.Right - this.Width; } if (this.Left < 0) { this.Left = 0; } this.TopMost = mStor.GetAttrValue("TopMost", false); + this.置顶显示ToolStripMenuItem.Checked = this.TopMost; this.Opacity = mStor.GetAttrValue("Opacity", 0d); try { @@ -336,6 +573,7 @@ namespace TimeClock.DbOp } } db.Free(); + Invalidate(); ProcUse = false; } @@ -344,12 +582,6 @@ namespace TimeClock.DbOp dt_change = DateTime.Now; isChange = true; } - - private void LblTopMost_Click(object sender, EventArgs e) - { - this.TopMost = !this.TopMost; - SaveSticky(); - } /// /// 便笺状态是否发生改变 /// @@ -387,13 +619,34 @@ namespace TimeClock.DbOp } if (RyForm.GetActiveWindow() == Handle) { - if (!PnlTop.Visible) PnlTop.Visible = true; - if (!PnlBottom.Visible) PnlBottom.Visible = true; + if (!PnlTop.Visible) + { + TxtTitle.Text = Text; + PnlTop.Visible = true; + } + if (!PnlBottom.Visible) + { + controlBoxManager.ButtonVisible(true); + Invalidate(); + txtContent.Height = PnlBottom.Top - txtContent.Top - 2; + PnlBottom.Visible = true; + } } else { - if (PnlTop.Visible) PnlTop.Visible = false; - if (PnlBottom.Visible) PnlBottom.Visible = false; + if (PnlTop.Visible) + { + Text = TxtTitle.Text; + PnlTop.Visible = false; + Invalidate(); + } + if (PnlBottom.Visible) + { + controlBoxManager.ButtonVisible(false); + Invalidate(); + txtContent.Height = this.Height - txtContent.Top - 5; + PnlBottom.Visible = false; + } } if (this.WindowState == FormWindowState.Normal && 靠边隐藏ToolStripMenuItem.Checked) { @@ -421,51 +674,15 @@ namespace TimeClock.DbOp } } } - private void 插入时间ToolStripMenuItem_Click(object sender, EventArgs e) - { - txtContent.SelectedText = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + private void SetFormRegion() + { + //if (this.DesignMode) { return; } + if (base.Region != null) + base.Region.Dispose(); + Rectangle rect = new Rectangle(Point.Empty, base.Size); + GraphicsPath path = GraphicsPathHelper.CreateRoundedRect(rect, Radius, RoundStyle.All, false); + this.Region = new Region(path); } - - private void 不透明ToolStripMenuItem_Click(object sender, EventArgs e) - { - this.Opacity = 1; SaveSticky(); - } - - private void toolStripMenuItem7_Click(object sender, EventArgs e) - { - this.Opacity = 0.6; SaveSticky(); - } - - private void toolStripMenuItem8_Click(object sender, EventArgs e) - { - this.Opacity = 0.7; SaveSticky(); - } - - private void toolStripMenuItem9_Click(object sender, EventArgs e) - { - this.Opacity = 0.75; SaveSticky(); - } - - private void toolStripMenuItem10_Click(object sender, EventArgs e) - { - this.Opacity = 0.8; SaveSticky(); - } - - private void toolStripMenuItem11_Click(object sender, EventArgs e) - { - this.Opacity = 0.85; SaveSticky(); - } - - private void toolStripMenuItem12_Click(object sender, EventArgs e) - { - this.Opacity = 0.9; SaveSticky(); - } - - private void toolStripMenuItem13_Click(object sender, EventArgs e) - { - this.Opacity = 0.95; SaveSticky(); - } - private void FrmSticky_FormClosed(object sender, FormClosedEventArgs e) { Itrycn_Info.StickyList.Remove(this); @@ -473,6 +690,8 @@ namespace TimeClock.DbOp private void FrmSticky_Resize(object sender, EventArgs e) { + //SetFormRoundRectRgn(this, 15, true); + //SetFormRoundRectRgn(this,15); if (this.WindowState == FormWindowState.Minimized) //如果窗口大小发生改变后变成最小化,则将窗口重新设置为正常大小 { this.WindowState = FormWindowState.Normal; @@ -499,9 +718,103 @@ namespace TimeClock.DbOp } } } - + /// + /// 大小改变时激发 + /// + /// + protected override void OnSizeChanged(EventArgs e) + { + base.OnSizeChanged(e); + SetFormRegion(); + if (ControlBox && controlBoxManager != null) + controlBoxManager.FormResize(); + } private void FrmSticky_SizeChanged(object sender, EventArgs e) { + // SetWindowRegion(); + } + private void DrawFormIconAndText(Graphics g) + { + if (!string.IsNullOrEmpty(Text)) + { + TextRenderer.DrawText( + g, + this.Text, + TxtTitle.Font, + TextRect, + ButtonColor, + TextFormatFlags.Left | + TextFormatFlags.VerticalCenter | + TextFormatFlags.EndEllipsis); + } + } + /// + /// 画UI + /// + /// + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + DrawFormBackground(e.Graphics); + DrawFormBorder(e.Graphics); + DrawFormIconAndText(e.Graphics); + if (ControlBox) + controlBoxManager.DrawBoxes(e.Graphics); + } + int Radius { get; set; } = 10; + private void DrawFormBackground(Graphics g) + { + SmoothingMode oldMode = g.SmoothingMode; + g.SmoothingMode = SmoothingMode.AntiAlias; + using (SolidBrush sb = new SolidBrush(BackColor)) + { + using (GraphicsPath path = GraphicsPathHelper.CreateRoundedRect( + ClientRectangle, Radius, RoundStyle.All, false)) + { + g.FillPath(sb, path); + } + } + g.SmoothingMode = oldMode; + } + private void DrawFormBorder(Graphics g) + { + //if (this.DesignMode) { return; } + int width = 1; + Rectangle rect = ClientRectangle; + + SmoothingMode oldMode = g.SmoothingMode; + g.SmoothingMode = SmoothingMode.AntiAlias; + + + // inner border + if (width > 0) + { + using (Pen p = new Pen(Color.FromArgb(230, 231, 232))) + { + //rect.Inflate(-1, -1); + using (GraphicsPath path = GraphicsPathHelper.CreateRoundedRect( + rect, Radius, RoundStyle.All, true)) + { + g.DrawPath(p, path); + } + } + } + g.SmoothingMode = oldMode; + } + private void FrmSticky_ResizeBegin(object sender, EventArgs e) + { + // SetFormRoundRectRgn(this, 15, false); + } + + private void 置顶显示ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.TopMost = 置顶显示ToolStripMenuItem.Checked; + } + + private void TxtTitle_TextChanged(object sender, EventArgs e) + { + dt_change = DateTime.Now; + isChange = true; } } } diff --git a/Source/MyTimeClock/TimeClock/Itrycn_Info.cs b/Source/MyTimeClock/TimeClock/Itrycn_Info.cs index 85928cc..0f0cd20 100644 --- a/Source/MyTimeClock/TimeClock/Itrycn_Info.cs +++ b/Source/MyTimeClock/TimeClock/Itrycn_Info.cs @@ -1168,6 +1168,7 @@ namespace TimeClock mySQL.Clear(); mySQL.TableName = "Sticky"; mySQL.AddField("Name", "");//便笺标题 + mySQL.AddField("Title", "");//便笺标题 mySQL.AddField("RichContent", "");//便笺内容的富文本格式 mySQL.AddField("Content", "");//便笺内容的txt格式 mySQL.AddField("DeskShow", 1);//是否桌面显示 diff --git a/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs b/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs index 39b03cd..40bfcb4 100644 --- a/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs +++ b/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.2110.1601")] -[assembly: AssemblyFileVersion("1.0.2110.1601")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.2110.1801")] +[assembly: AssemblyFileVersion("1.0.2110.1801")] \ No newline at end of file diff --git a/Source/MyTimeClock/TimeClock/TimeClock.csproj b/Source/MyTimeClock/TimeClock/TimeClock.csproj index f6fa822..8e68371 100644 --- a/Source/MyTimeClock/TimeClock/TimeClock.csproj +++ b/Source/MyTimeClock/TimeClock/TimeClock.csproj @@ -68,12 +68,14 @@ + + UserControl diff --git a/Source/MyTimeClock/TimeClock/images/skin/close.png b/Source/MyTimeClock/TimeClock/images/skin/close.png index 95ca528..e625576 100644 Binary files a/Source/MyTimeClock/TimeClock/images/skin/close.png and b/Source/MyTimeClock/TimeClock/images/skin/close.png differ diff --git a/Source/MyTimeClock/TimeClock/images/skin/top.png b/Source/MyTimeClock/TimeClock/images/skin/top.png index 409e930..ff43fd3 100644 Binary files a/Source/MyTimeClock/TimeClock/images/skin/top.png and b/Source/MyTimeClock/TimeClock/images/skin/top.png differ