Metro UI 菜单(Winform)
2015-11-18 11:42
597 查看
我有个项目需要要到菜单导航,就自己动作做了一个,感觉还可以,分享给大家。下载地址:http://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++; } } }
相关文章推荐
- EasyUI中将DateBox的默认值设置成yyyy-mm-dd格式
- IOS开发指南读书笔记6(UIView家族)
- iOS开发——本地通知,本地推送(UILocalNotification)
- ios上 更改 状态栏(UIStatusBar)的颜色,你值得一看、收藏
- android gradle build
- UICollectionView基础
- UVA 题目10128 Queue(DP)
- UITableViewDelete 删除
- UITabView 添加
- Random_QuickSort
- UIView常用的一些方法小记之setNeedsDisplay和setNeedsLayout 还有drawRect方法
- 根据源码总结String,StringBuffer,StringBuider差异
- iOS小技巧:用runtime 解决UIButton 重复点击问题
- UIButton篇
- 【HDU5565 BestCoder Round 62 (div1)C】【STL or 二分答案 or 计数排序】Clarke and baton n个人减肥m次求最后异或值
- UItableViewController添加UITouch事件(添加点击事件)
- MySQL 报错 Truncated incorrect INTEGER value: ''
- iOS9 Storyboard unwind segue反回传递事件时机详细步骤
- EasyUI 之datagrid 使用 【DataGrid属性解释】
- openstack通过qemu-guest-agent在物理机上操作虚拟机