预览
代码
手机端效果
web端效果
demoIconMenuView.cs
demoIconMenuView.Designer.cs
web:demoIconMenuView.cs
web:demoIconMenuView.Designer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Controls
{
partial class demoIconMenuView : Smobiler.Core.Controls.MobileForm
{
public demoIconMenuView()
: base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void button1_Press(object sender, EventArgs e)
{
this.popList1.ShowDialog();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void demoIconMenuView_Load(object sender, EventArgs e)
{
PopListGroup g1 = new PopListGroup();
g1.AddListItem("Groups");
g1.AddListItem("ColumnNum");
g1.AddListItem("ItemWidth");
g1.AddListItem("MenuGroupHeight");
g1.AddListItem("MenuItemHeight");
g1.AddListItem("ShowGroupTitle");
g1.AddListItem("ImageSizeMode");
g1.AddListItem("FontSize");
g1.AddListItem("ForeColor");
g1.AddListItem("GridLines");
g1.AddListItem("GridLinesColor");
g1.AddListItem("GroupBackColor");
g1.AddListItem("GroupFontSize");
g1.AddListItem("GroupForeColor");
g1.AddListItem("MessageWidth");
g1.AddListItem("MessageBackColor");
g1.AddListItem("MessageFontSize");
g1.AddListItem("MessageForeColor");
g1.AddListItem("ShowDialogMenu");
g1.AddListItem("ItemPress");
popList1.Groups.Add(g1);
}
Random rd = new Random();
private void popList1_Selected(object sender, EventArgs e)
{
switch (popList1.Selections[0].Text)
{
case "Groups":
this.iconMenuView1.Groups.Clear();
for (int i = 0; i < 5; i++)
{
AddGroup();
}
labContent.Text = "设置菜单组集合";
break;
case "ColumnNum":
this.iconMenuView1.ColumnNum += 1;
labContent.Text = "设置列数";
break;
case "ItemWidth":
this.iconMenuView1.ItemWidth += 5;
labContent.Text = "设置图像空间大小";
break;
case "MenuGroupHeight":
this.iconMenuView1.MenuGroupHeight += 5;
labContent.Text = "设置菜单组标题行高度";
break;
case "MenuItemHeight":
this.iconMenuView1.MenuItemHeight += 5;
labContent.Text = "设置菜单项高度";
break;
case "ShowGroupTitle":
this.iconMenuView1.ShowGroupTitle = true;
labContent.Text = "是否显示菜单组标题";
break;
case "ImageSizeMode":
this.iconMenuView1.ImageSizeMode = ImageSizeMode.Default;
labContent.Text = "设置图片显示模式(Zoom->Default)";
break;
case "FontSize":
this.iconMenuView1.FontSize += 2;
labContent.Text = "设置菜单项字体大小";
break;
case "ForeColor":
this.iconMenuView1.ForeColor=System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置菜单项前景色";
break;
case "GridLines":
this.iconMenuView1.GridLines = true;
labContent.Text = "是否显示网格线";
break;
case "GridLinesColor":
this.iconMenuView1.GridLinesColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "网格线颜色";
break;
case "GroupBackColor":
this.iconMenuView1.GroupBackColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置菜单组标题背景色";
break;
case "GroupFontSize":
this.iconMenuView1.GroupFontSize += 2;
labContent.Text = "设置菜单组标题字体大小";
break;
case "GroupForeColor":
this.iconMenuView1.GroupForeColor= System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置菜单组标题字体颜色";
break;
case "MessageWidth":
this.iconMenuView1.MessageWidth += 1;
labContent.Text = "设置消息框大小";
break;
case "MessageBackColor":
this.iconMenuView1.MessageBackColor= System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置消息框背景色";
break;
case "MessageFontSize":
this.iconMenuView1.MessageFontSize += 2;
labContent.Text = "设置消息框中字体大小";
break;
case "MessageForeColor":
this.iconMenuView1.MessageForeColor= System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置消息框中字体颜色";
break;
case "ShowDialogMenu":
IconMenuViewGroup mvg = new IconMenuViewGroup(DateTime.Now.ToString());
for (int j = 0; j < 10; j++)
mvg.Items.Add(new IconMenuViewItem("logon", j.ToString()));
this.iconMenuView1.ShowDialogMenu(mvg);
labContent.Text = "显示二级菜单";
break;
case "ItemPress":
labContent.Text = "在菜单项点击时发生";
break;
}
}
private void AddGroup()
{
IconMenuViewGroup mvg = new IconMenuViewGroup(this.iconMenuView1.Groups.Count.ToString("类别"+i.ToString()));
mvg.ShowTitle = true;
mvg.Items.Add(new IconMenuViewItem("设计师.png", "设计师"));
mvg.Items.Add(new IconMenuViewItem("拟定合同.png", "拟定合同"));
mvg.Items.Add(new IconMenuViewItem("搜索.png", "搜索"));
mvg.Items.Add(new IconMenuViewItem("咨询.png", "咨询", "1", "1", "1"));
mvg.Items.Add(new IconMenuViewItem("方案.png", "方案", "2", "2", "2"));
this.iconMenuView1.Groups.Add(mvg);
}
private void iconMenuView1_ItemPress(object sender, IconMenuViewItemPressEventArgs e)
{
MessageBox.Show(e.Item.Text);
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Controls
{
partial class demoIconMenuView : Smobiler.Core.Controls.MobileForm
{
#region "SmobilerForm generated code "
//SmobilerForm overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerForm
//It can be modified using the SmobilerForm.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.panel10 = new Smobiler.Core.Controls.Panel();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.labContent = new Smobiler.Core.Controls.Label();
this.labTitle = new Smobiler.Core.Controls.Label();
this.button1 = new Smobiler.Core.Controls.Button();
this.iconMenuView1 = new Smobiler.Core.Controls.IconMenuView();
this.popList1 = new Smobiler.Core.Controls.PopList();
//
// title1
//
this.title1.ImageType = Smobiler.Core.Controls.ImageEx.ImageStyle.FontIcon;
this.title1.Name = "title1";
this.title1.ResourceID = "angle-left";
this.title1.Size = new System.Drawing.Size(300, 30);
this.title1.Text = "IconMenuView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel10
//
this.panel10.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1,
this.iconMenuView1});
this.panel10.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel10.Location = new System.Drawing.Point(0, 30);
this.panel10.Name = "panel10";
this.panel10.Scrollable = true;
this.panel10.Size = new System.Drawing.Size(300, 970);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Border = new Smobiler.Core.Controls.Border(1F);
this.panel1.BorderColor = System.Drawing.Color.Silver;
this.panel1.BorderRadius = 5;
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.labTitle,
this.button1});
this.panel1.Location = new System.Drawing.Point(5, 9);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(290, 123);
//
// labContent
//
this.labContent.BackColor = System.Drawing.Color.WhiteSmoke;
this.labContent.FontSize = 15F;
this.labContent.Location = new System.Drawing.Point(0, 26);
this.labContent.Name = "labContent";
this.labContent.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labContent.Size = new System.Drawing.Size(290, 54);
this.labContent.Text = "组件,在设计器中不显示设计界面,可使用Show与ShowDialog显示界面";
//
// labTitle
//
this.labTitle.BackColor = System.Drawing.Color.WhiteSmoke;
this.labTitle.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.labTitle.BorderColor = System.Drawing.Color.DarkSeaGreen;
this.labTitle.FontSize = 16F;
this.labTitle.Name = "labTitle";
this.labTitle.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labTitle.Size = new System.Drawing.Size(290, 26);
this.labTitle.Text = "图标菜单控件";
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(67)))), ((int)(((byte)(81)))));
this.button1.Location = new System.Drawing.Point(39, 87);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(212, 30);
this.button1.Text = "控件介绍";
this.button1.Press += new System.EventHandler(this.button1_Press);
//
// iconMenuView1
//
this.iconMenuView1.Location = new System.Drawing.Point(0, 141);
this.iconMenuView1.Name = "iconMenuView1";
this.iconMenuView1.Size = new System.Drawing.Size(300, 300);
this.iconMenuView1.ItemPress += new Smobiler.Core.Controls.IconMenuViewItemPressClickHandler(this.iconMenuView1_ItemPress);
//
// popList1
//
this.popList1.Name = "popList1";
this.popList1.Selected += new System.EventHandler(this.popList1_Selected);
//
// demoIconMenuView
//
this.Components.AddRange(new Smobiler.Core.Controls.MobileComponent[] {
this.popList1});
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel10});
this.Load += new System.EventHandler(this.demoIconMenuView_Load);
this.Name = "demoIconMenuView";
}
#endregion
private Core.Controls.Title title1;
private Core.Controls.Panel panel10;
private Core.Controls.Panel panel1;
private Core.Controls.Label labContent;
private Core.Controls.Label labTitle;
private Core.Controls.Button button1;
private Core.Controls.PopList popList1;
private Core.Controls.IconMenuView iconMenuView1;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace SmobilerTutorialsWeb.Components
{
partial class demoIconMenuView : Smobiler.Core.Controls.MobileForm
{
public demoIconMenuView() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void demoIconMenuView_Load(object sender, EventArgs e)
{
spinner1.Items = new string[] { "Groups", "ColumnNum", "ItemWidth", "MenuGroupHeight", "MenuItemHeight", "ShowGroupTitle", "ImageSizeMode", "FontSize", "ForeColor", "GridLines", "GridLinesColor", "GroupBackColor" , "GroupFontSize" , "GroupForeColor" , "MessageWidth" , "MessageBackColor" , "MessageFontSize" , "MessageForeColor" , "ShowDialogMenu" , "ItemPress" };
}
Random rd = new Random();
private void spinner1_ItemSelected(object sender, SpinnerItemSelectedEventArgs e)
{
switch (spinner1.Text)
{
case "Groups":
this.iconMenuView1.Groups.Clear();
for (int i = 0; i < 5; i++)
{
AddGroup();
}
labContent.Text = "设置菜单组集合";
break;
case "ColumnNum":
this.iconMenuView1.ColumnNum += 1;
labContent.Text = "设置列数";
break;
case "ItemWidth":
this.iconMenuView1.ItemWidth += 5;
labContent.Text = "设置图像空间大小";
break;
case "MenuGroupHeight":
this.iconMenuView1.MenuGroupHeight += 5;
labContent.Text = "设置菜单组标题行高度";
break;
case "MenuItemHeight":
this.iconMenuView1.MenuItemHeight += 5;
labContent.Text = "设置菜单项高度";
break;
case "ShowGroupTitle":
this.iconMenuView1.ShowGroupTitle = true;
labContent.Text = "是否显示菜单组标题";
break;
case "ImageSizeMode":
this.iconMenuView1.ImageSizeMode = ImageSizeMode.Default;
labContent.Text = "设置图片显示模式(Zoom->Default)";
break;
case "FontSize":
this.iconMenuView1.FontSize += 2;
labContent.Text = "设置菜单项字体大小";
break;
case "ForeColor":
this.iconMenuView1.ForeColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置菜单项前景色";
break;
case "GridLines":
this.iconMenuView1.GridLines = true;
labContent.Text = "是否显示网格线";
break;
case "GridLinesColor":
this.iconMenuView1.GridLinesColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "网格线颜色";
break;
case "GroupBackColor":
this.iconMenuView1.GroupBackColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置菜单组标题背景色";
break;
case "GroupFontSize":
this.iconMenuView1.GroupFontSize += 2;
labContent.Text = "设置菜单组标题字体大小";
break;
case "GroupForeColor":
this.iconMenuView1.GroupForeColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置菜单组标题字体颜色";
break;
case "MessageWidth":
this.iconMenuView1.MessageWidth += 1;
labContent.Text = "设置消息框大小";
break;
case "MessageBackColor":
this.iconMenuView1.MessageBackColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置消息框背景色";
break;
case "MessageFontSize":
this.iconMenuView1.MessageFontSize += 2;
labContent.Text = "设置消息框中字体大小";
break;
case "MessageForeColor":
this.iconMenuView1.MessageForeColor = System.Drawing.Color.FromArgb(rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255), rd.Next(0, 255));
labContent.Text = "设置消息框中字体颜色";
break;
case "ShowDialogMenu":
IconMenuViewGroup mvg = new IconMenuViewGroup(DateTime.Now.ToString());
for (int j = 0; j < 10; j++)
mvg.Items.Add(new IconMenuViewItem("logon", j.ToString()));
this.iconMenuView1.ShowDialogMenu(mvg);
labContent.Text = "显示二级菜单";
break;
case "ItemPress":
labContent.Text = "在菜单项点击时发生";
break;
}
}
private void iconMenuView1_ItemPress(object sender, IconMenuViewItemPressEventArgs e)
{
MessageBox.Show(e.Item.Text);
}
private void AddGroup()
{
IconMenuViewGroup mvg = new IconMenuViewGroup(this.iconMenuView1.Groups.Count.ToString("类别"+i.ToString()));
mvg.ShowTitle = true;
mvg.Items.Add(new IconMenuViewItem("设计师.png", "设计师"));
mvg.Items.Add(new IconMenuViewItem("拟定合同.png", "拟定合同"));
mvg.Items.Add(new IconMenuViewItem("搜索.png", "搜索"));
mvg.Items.Add(new IconMenuViewItem("咨询.png", "咨询", "1", "1", "1"));
mvg.Items.Add(new IconMenuViewItem("方案.png", "方案", "2", "2", "2"));
this.iconMenuView1.Groups.Add(mvg);
}
}
}
using System;
using Smobiler.Core;
namespace SmobilerTutorialsWeb.Components
{
partial class demoIconMenuView : Smobiler.Core.Controls.MobileForm
{
#region "SmobilerForm generated code "
//SmobilerForm overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerForm
//It can be modified using the SmobilerForm.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.panel10 = new Smobiler.Core.Controls.Panel();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.labContent = new Smobiler.Core.Controls.Label();
this.iconMenuView1 = new Smobiler.Core.Controls.IconMenuView();
this.spinner1 = new Smobiler.Core.Controls.Spinner();
this.labTitle = new Smobiler.Core.Controls.Label();
//
// title1
//
this.title1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(246)))), ((int)(((byte)(246)))));
this.title1.ImageType = Smobiler.Core.Controls.ImageEx.ImageStyle.FontIcon;
this.title1.Name = "title1";
this.title1.ResourceID = "angle-left";
this.title1.Size = new System.Drawing.Size(0, 30);
this.title1.Text = "IconMenuView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel10
//
this.panel10.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1,
this.labTitle});
this.panel10.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel10.Flex = 1;
this.panel10.Name = "panel10";
this.panel10.Scrollable = true;
this.panel10.Size = new System.Drawing.Size(0, 0);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Border = new Smobiler.Core.Controls.Border(1F);
this.panel1.BorderColor = System.Drawing.Color.Silver;
this.panel1.BorderRadius = 5;
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.iconMenuView1,
this.spinner1});
this.panel1.Location = new System.Drawing.Point(300, 57);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(600, 522);
//
// labContent
//
this.labContent.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.labContent.Location = new System.Drawing.Point(0, 87);
this.labContent.Name = "labContent";
this.labContent.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labContent.Size = new System.Drawing.Size(600, 30);
this.labContent.Text = "组件,在设计器中不显示设计界面,可使用Show与ShowDialog显示界面";
//
// iconMenuView1
//
this.iconMenuView1.Location = new System.Drawing.Point(150, 138);
this.iconMenuView1.MessageBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(249)))));
this.iconMenuView1.MessageForeColor = System.Drawing.Color.White;
this.iconMenuView1.Name = "iconMenuView1";
this.iconMenuView1.Size = new System.Drawing.Size(300, 300);
this.iconMenuView1.ItemPress += new Smobiler.Core.Controls.IconMenuViewItemPressClickHandler(this.iconMenuView1_ItemPress);
//
// spinner1
//
this.spinner1.FontSize = 100F;
this.spinner1.Location = new System.Drawing.Point(150, 33);
this.spinner1.Name = "spinner1";
this.spinner1.Size = new System.Drawing.Size(300, 40);
this.spinner1.ItemSelected += new System.EventHandler(this.spinner1_ItemSelected);
//
// labTitle
//
this.labTitle.BackColor = System.Drawing.Color.White;
this.labTitle.Bold = true;
this.labTitle.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.labTitle.BorderColor = System.Drawing.Color.White;
this.labTitle.FontSize = 16F;
this.labTitle.Location = new System.Drawing.Point(300, 30);
this.labTitle.Name = "labTitle";
this.labTitle.Size = new System.Drawing.Size(600, 26);
this.labTitle.Text = "图标菜单控件";
//
// demoIconMenuView
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel10});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(1200, 800);
this.Load += new System.EventHandler(this.demoIconMenuView_Load);
this.Name = "demoIconMenuView";
}
#endregion
private Smobiler.Core.Controls.Title title1;
private Smobiler.Core.Controls.Panel panel10;
private Smobiler.Core.Controls.Panel panel1;
private Smobiler.Core.Controls.Label labContent;
private Smobiler.Core.Controls.IconMenuView iconMenuView1;
private Smobiler.Core.Controls.Spinner spinner1;
private Smobiler.Core.Controls.Label labTitle;
}
}