惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
小众软件
小众软件
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
博客园 - 【当耐特】
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
The Last Watchdog
The Last Watchdog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
S
Secure Thoughts
O
OpenAI News
P
Proofpoint News Feed
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
T
Tenable Blog
A
Arctic Wolf
L
LINUX DO - 热门话题
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
博客园 - Franky
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
博客园_首页
雷峰网
雷峰网
IT之家
IT之家
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
H
Heimdal Security Blog

博客园 - LiuLei

[转]oracle RAC 日志体系 [转]Oracle10g RAC crsctl&srvctl [转]oracle v$sqlarea 分析SQL语句使用资源情况 SQL2008数据库还原后显示受限制用户解决办法 [转].net 连接oracle的几种方式 [转]动态交叉表 二维表 [转]日常养生:按摩七大养生穴位 让你百毒不侵! [转]两个长寿穴合谷与内关 [原]C#错误解决-"Window无法访问指定设备,路径或文件..." [转]VS2010 项目引用了DLL文件,也写了Using,但是编译时提示:未能找到类型或命名空间名称 [原]升级sqlserver2008 r2的错误:perf-ReportServer-rsctr.dll被使用 [原]安装SQL SERVER2008错误:Microsoft.SqlServer.Configuration.LandingPage.Properties.Settings [原]卸载mssqlserver2008R2并重新安装 [原] sqlserver2008 还原数据库出现错误:3154 [转]【C#】Color颜色对照表 [转]关于本博客数据仓库方面的原创文章汇总 [解决]CS0016: 未能写入输出文件...\App_Web_default.aspx.cdcab7d2.zii776dc.dll”--"拒绝访问。 " 解决方法 - LiuLei [解决]Windows 7 IIS (HTTP Error 500.21 - Internal Server Error)解决 [解决]无法识别的属性“targetFramework”。请注意属性名称区分大小写。错误解决办法
[转]WeifenLuo.WinFormsUI.Docking——DockPanel的一点点改进
LiuLei · 2013-05-02 · via 博客园 - LiuLei

转自:http://www.cnblogs.com/yvesliao/archive/2008/08/26/1276609.html

1、当双击Tab时,原先是直接把当前Tab所表示的这个窗体,从主窗体的框架上分离现来,成为一个浮动的窗体。这不是我想要的,我把它改成了双击关闭。 在DockPaneStripBase.cs 的WndProc方法里,对于左键双击消息重新作了处理(下面注释掉的一行是原先的写法,它下面那行是改的):

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override void WndProc(ref Message m)
{
    if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
    {
        base.WndProc(ref m);

        int index = HitTest();
        if (DockPane.DockPanel.AllowEndUserDocking && index != -1)
        {
            IDockContent content = Tabs[index].Content;
            //if (content.DockHandler.CheckDockState(!content.DockHandler.IsFloat) != DockState.Unknown)
                //content.DockHandler.IsFloat = !content.DockHandler.IsFloat; //这句表示窗口还原初始大小并且脱离任何停靠
            if (content.DockHandler.HideOnClose)
                content.DockHandler.Hide();//隐藏
            else
                content.DockHandler.Close(); //关闭        

        }



        return;
    }

    base.WndProc(ref m);
    return;
}

2、很多窗体都在Tab中有个右键菜单,右击的里面有关闭,所以最好继承一下DockContent,让其它窗体只要继承这个就有了这个右键菜单

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WeifenLuo.WinFormsUI.Docking
{
    public class DockContentEx : WeifenLuo.WinFormsUI.Docking.DockContent
    {
//在标签上点击右键显示关闭菜单
        public DockContentEx()
        {
            ContextMenuStrip cms = new System.Windows.Forms.ContextMenuStrip();
            ToolStripMenuItem tsmiClose = new System.Windows.Forms.ToolStripMenuItem();
            // 
            // cms
            // 
            tsmiClose.Name = "cms";
            tsmiClose.Size = new System.Drawing.Size(98, 22);
            tsmiClose.Text = "关闭";
            tsmiClose.Click += new System.EventHandler(this.tsmiClose_Click);
            // 
            // tsmiClose
            // 
            cms.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            tsmiClose});
            cms.Name = "tsmiClose";
            cms.Size = new System.Drawing.Size(99, 26);

            this.TabPageContextMenuStrip = cms;
        }

        private void tsmiClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}