winform 自定义form皮肤 代码适合c#初学者
2022-11-10 11:30:38 1.13MB winform form皮肤
1
自定义winform 窗口标题栏 主要代码 public partial class ZForm : Form { private bool moving = false; private Point oldMousePosition; public new FormBorderStyle FormBorderStyle { get { return base.FormBorderStyle; } set { if (value != FormBorderStyle.Sizable && value != FormBorderStyle.SizableToolWindow) { titlepanel.Controls.Remove(button2); } base.FormBorderStyle = value; } } #region 隐藏父类的属性,使其不可见 [Browsable(false)] public new string Text { get { return titlelabel.Text; } set { } } [Browsable(false)] public new bool ControlBox { get { return false; } set { base.ControlBox = false; } } #endregion [Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always)] [Description("窗体标题")] public string Title { get { return titlelabel.Text; } set { titlelabel.Text = value; } } [Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always)] [Description("窗体标题字体样式")] public Font TitleFont { get { return titlelabel.Font; } set { titlelabel.Font = value; } } [Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always)] [Description("窗体标题字体颜色")] public Color TitleColor { get { return titlelabel.ForeColor; } set { titlelabel.ForeColor = value; } } [Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always)] [Description("窗体标题栏背景色")] public Color TitleBarBackColor { get { return titlepanel.BackColor; } set { titlepanel.BackColor = value; } } public new bool MaximizeBox { get { return titlepanel.Contains(button2); } set { if (!value) { titlepanel.Controls.Remove(button2); } else if (!titlepanel.Contains(button2)) { titlepanel.Controls.Add(button2); } } } public new bool MinimizeBox { get { return titlepanel.Contains(button3); } set { if (!value) { titlepanel.Controls.Remove(button3); } else if (!titlepanel.Contains(button3)) { titlepanel.Controls.Add(button3); } } } private void ResetTitlePanel() { base.ControlBox = false; base.Text = null; SetToolTip(button1, "关闭"); button2.Size = button1.Size; SetToolTip(button2, "最大化或还原"); button3.Size = button1.Size; SetToolTip(button3, "最小化"); } private void SetToolTip(Control ctrl, string tip) { new ToolTip().SetToolTip(ctrl, tip); } public ZForm() { InitializeComponent(); ResetTitlePanel(); } private void Titlebutton_Click(object sender, EventArgs e) { Button btn = (Button)sender; switch (btn.Tag.ToString()) { case "close": { this.Close(); break; } case "max": { if (this.WindowState == FormWindowState.Maximized) { this.WindowState = FormWindowState.Normal; } else { this.WindowState = FormWindowState.Maximized; } break; } case "min": { if (this.WindowState != FormWindowState.Minimized) { this.WindowState = FormWindowState.Minimized; } break; } } } private void Titlepanel_MouseDown(object sender, MouseEventArgs e) { if (this.WindowState == FormWindowState.Maximized) { return; } //Titlepanel.Cursor = Cursors.NoMove2D; oldMousePosition = e.Location; moving = true; } private void Titlepanel_MouseUp(object sender, MouseEventArgs e) { //Titlepanel.Cursor = Cursors.Default; moving = false; } private void Titlepanel_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && moving) { Point newPosition = new Point(e.Location.X - oldMousePosition.X, e.Location.Y - oldMousePosition.Y); this.Location += new Size(newPosition); } } private void Titlepanel_DoubleClick(object sender, EventArgs e) { if (titlepanel.Contains(button2)) { button2.PerformClick(); } } private void titlepanel_ControlRemoved(object sender, ControlEventArgs e) { switch (e.Control.Name) { case "button2": { if (titlepanel.Contains(button3)) { button3.Left = button1.Left - button1.Width; } break; } } } private void titlepanel_ControlAdded(object sender, ControlEventArgs e) { switch (e.Control.Name) { case "button2": { if (titlepanel.Contains(button3)) { button3.Left = button2.Left - button2.Width; } break; } case "button3": { if (titlepanel.Contains(button2)) { button3.Left = button2.Left - button2.Width; } break; } } } }
2022-11-10 11:30:27 122KB 窗口标题栏
1
根据不同屏幕尺寸修改安卓手机显示分辨率和大小 也可以输入自定义屏幕大小 可以自动截屏 分辨率更改完后恢复初始化分辨率
2022-11-09 16:18:46 576KB 屏幕模拟器 修改屏幕分辨率
1
这是一个notpad++自定义语言xml导出文件,用以使notpad++能够自动识别caple脚本cin、can文件。文件内容学习参考: https://blog.csdn.net/sxkcosmos/article/details/125778101
2022-11-09 16:04:51 5KB Notpad++自定义语言 高亮显示 cin can
1
强迫症笔者近来看到托盘里有几个程序,日常会使用到但是不会对其托盘图标进行操作,所以想把它们隐藏(保留程序功能),就查阅了一些资料,在此分享一下
2022-11-09 14:00:32 17KB 隐藏 安全
1
工业机器人现场编程与调试运行
2022-11-09 13:21:39 141.21MB 工业机器人 现场编程 调试运行
C# .net+DevExpress自定义控件(UserControl)之分页控件(含源代码),可直接调用,调用方法见https://blog.csdn.net/weixin_41607453/article/details/108294695
2022-11-08 23:57:51 471KB 自定义控件 C# DEV
1
komorebi:适用于Linux的美丽且可自定义的壁纸管理器
2022-11-08 14:57:40 31.41MB linux wallpaper vala desktop
1
echarts自定义地图,根据地图的坐标进行绘制自己相关的地图,用html+css+echarts来实现,费用值得借鉴过来使用。
2022-11-08 14:31:24 470KB echarts 地图 自定义
1
BottomSheetBehavior、SwipeDismissBehavior、自定义Behavior等。原理和教程请移步严振杰的博客:http://blog.csdn.net/yanzhenjie1003。修复了之前BottomSheetDialog滑动关闭后不能打开的问题。
2022-11-08 10:11:37 83KB Behavior
1