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

推荐订阅源

IT之家
IT之家
Y
Y Combinator Blog
月光博客
月光博客
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
博客园 - 司徒正美
V
Visual Studio Blog
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
The Cloudflare Blog

博客园 - 南桥一梦

Windows Hyper-v 开启嵌套虚拟化的方法 MySQL命令记录 Windows Server 2019 安装Windows Docker和.NET Framework 4.8镜像 Windows Docker 固定容器IP地址 透明网络驱动程序 MySQL优化 右键菜单怎样添加“在此处打开命令提示符”选项 MemSQL与MySQL不兼容问题总结 Ubuntu Server 18.04 修改网路配置 How to Install MemSQL Windows Server 2008 系统设置集合 Ubuntu 12.04和MySQL5.5安装 MySQL 参数设置 VS中如何自定义新建文件模板(添加自定义版权信息) Microsoft Windows Server 2008 R2 CHS 官方最新正版下载 在Hyper-V中安装和配置Ubuntu Server 11.04 10.10 解决WebClient或HttpWebRequest首次连接缓慢问题 Ubuntu MySQL Master-Master InnoDb Utf-8 配置文件 Ubuntu MySQL热备份安装 HOWTO:为 Hyper-V 配置外部网络
Metro UI 菜单(Winform)
南桥一梦 · 2015-11-18 · via 博客园 - 南桥一梦

我有个项目需要要到菜单导航,就自己动作做了一个,感觉还可以,分享给大家。下载地址:https://files.cnblogs.com/files/dyj057/MetroUIMenu.zip

主要代码:

 private void SetElements()
        {
            if (Elements == null) return;
            int eWidth = BorderWidth + ElementWidth;
            int eHeight = BorderWidth + ElementHeight;
            int count = Elements.Count;
            int col = this.Size.Width / eWidth;
            if (col == 0) return;
            int row = (int)Math.Ceiling((double)count / col);
            Console.WriteLine("{0}x{1}",row,col);
            var k = 0;
            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < col; j++)
                {
                    if (k >= count) break;
                    var child = Elements[k];
                    child.Location = new Point(j * eWidth  + BorderWidth, eHeight * i + BorderWidth);
                    child.Size = new Size(ElementWidth, ElementHeight);
                    Console.WriteLine("X:{0} Y:{1} W:{2} H:{3}", child.Location.X, child.Location.Y, child.Size.Width,child.Size.Height);
                    if (!this.Controls.Contains(child))
                    {
                        child.SelectedChanged += Child_SelectedChanged;
                        this.Controls.Add(child);
                    }
                    k++;
                }
            }
        }