自定义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
C#,WinForm,重绘 C#重绘标题栏
2022-11-10 11:29:59 43KB C# WinForm 重绘
1
PyQt实现自定义标题栏、鼠标移入移出效果切换、点击切换窗口界面等基本操作
2022-11-06 10:57:37 10.56MB pyqt5
1
Android应用设计源码安卓实例源代码,可供学习及设计参考。
参数: 导航栏标题 导航栏背景颜色,支持渐变色和透明 显示导航栏按钮 显示导航栏home按钮 导航栏按钮颜色 是否显示用户自定义icon 用户自定义icon路径 取消导航栏粘性布局 标题颜色 标题对齐方式 标题左边距 标题字体大小 标题粗细 等等
2022-10-25 15:09:31 6KB 小程序 组件化
1
QT5 Widget 无边框标题栏和自定义程序启动画面的小例子,可以直接拿来用
2022-10-20 13:04:19 168KB QT5
1
1、采用WPF; 2、支持菜单栏,工具栏; 3、标题栏可修改背景色; 4、TabControl动态添加、删除(支持左右滑动,选择)
2022-09-15 14:04:39 18.11MB WPF TabControl添加删除
1
初学者项目需要,自己封装的一个qt自定义标题栏,可以直接调用。环境是vs2013+qt5.6.2,其他环境我也不知道能否使用,谨慎下载。 大部分标题栏的显示效果都放在paintEvent函数中,可以动态更改。大部分效果都写了函数,其他参数写死的,如果需要动态改,自己加个函数就好。
2022-09-14 10:07:00 4.44MB QT 标题栏 封装
1
Android五种隐藏状态栏和标题栏的方法 方法一: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 隐藏标题栏 requestWindowFeature(Window.FEATURE_NO_TITLE); // 隐藏状态栏 getWindow().setFlags(WindowManager
2022-08-29 16:14:59 44KB activity android开发 id
1
主要介绍了Android五种隐藏状态栏和标题栏的方法的相关资料,需要的朋友可以参考下
1