Metro UI 菜单(Winform)
生活随笔
收集整理的這篇文章主要介紹了
Metro UI 菜单(Winform)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我有個項目需要要到菜單導航,就自己動作做了一個,感覺還可以,分享給大家。下載地址: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++;}}}
?
轉載于:https://www.cnblogs.com/dyj057/p/4973984.html
總結
以上是生活随笔為你收集整理的Metro UI 菜单(Winform)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android NDK编程,引入第三方.
- 下一篇: ThinkPHP 发送post请求