预览
代码
手机端效果
web端效果
demoGridView.cs
demoGridView.Designer.cs
模板类 listViewTemplate.cs
模板类 listViewTemplate.Designer.cs
模板类 gridViewTemplate.cs
模板类 gridViewTemplate.Designer.cs
模板类 editLayout.cs
模板类 editLayout.Designer.cs
web:demoGridView.cs
web:demoGridView.Designer.cs
web:模板类 demoListViewTemplate.cs
web:模板类 demoListViewTemplate.Designer.cs
web:模板类 demoGridViewTemplate.cs
web:模板类 demoGridViewTemplate.Designer.cs
web:模板类 demoListViewEditTemplate.cs
web:模板类 demoListViewEditTemplate.Designer.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Components
{
partial class demoGridView : Smobiler.Core.Controls.MobileForm
{
public demoGridView() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void demoGridView_Load(object sender, EventArgs e)
{
PopListGroup pg1 = new PopListGroup();
pg1.AddListItem("DataBind");
pg1.AddListItem("删除行");
pg1.AddListItem("清空");
pg1.AddListItem("新增行");
pg1.AddListItem("编辑");
popList1.Groups.Add(pg1);
DataTable dt = new DataTable();
dt.Columns.Add("img");
dt.Columns.Add("id");
dt.Columns.Add("name");
dt.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = 0; i < 8; i++)
{
dt.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
//gridView2绑定数据
gridView2.TemplateControl = new listViewTemplate();
gridView2.DataSource = dt;
gridView2.DataBind();
//gridView3绑定数据
gridView3.TemplateControl = new listViewTemplate();
gridView3.DataSource = dt;
gridView3.DataBind();
//gridView4 绑定数据
DataTable dt1 = new DataTable();
dt1.Columns.Add("img");
dt1.Columns.Add("lab");
dt1.Rows.Add("CF", "item1");
dt1.Rows.Add("FZ", "item2");
dt1.Rows.Add("GL", "item3");
dt1.Rows.Add("KD", "item4");
dt1.Rows.Add("WX", "item5");
dt1.Rows.Add("XZ", "item6");
dt1.Rows.Add("YJ", "item7");
dt1.Rows.Add("ZS", "item8");
gridView4.TemplateControl = new gridViewTemplate();
gridView4.DataSource = dt1;
gridView4.DataBind();
}
private void button1_Press(object sender, EventArgs e)
{
popList1.ShowDialog();
}
private void popList1_Selected(object sender, EventArgs e)
{
switch (popList1.Selections[0].Text)
{
case "DataBind":
DataBind();
button1.Text = "数据绑定";
break;
case "删除行":
if (gridView1.Cells.Count > 0)
{
int i = gridView1.Cells.Count;
gridView1.Cells.RemoveAt(i - 1);
labContent.Text = "gridView1.Cells.Remove ,gridView1.Cells.RemoveAt删除行。";
}
button1.Text = "删除行";
break;
case "清空":
gridView1.Cells.Clear();
button1.Text = "清空";
break;
case "新增行":
gridTable = new DataTable();
gridTable.Columns.Add("img");
gridTable.Columns.Add("id");
gridTable.Columns.Add("name");
gridTable.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = 6; i < 12; i++)
{
gridTable.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
gridView1.NewCell(gridTable, "");
labContent.Text = "gridView1.NewCell 新增行。";
button1.Text = "新增行";
break;
case "编辑":
button1.Text = "点击行项进行编辑";
break;
}
}
DataTable gridTable;
private void DataBind()
{
gridTable = new DataTable();
gridTable.Columns.Add("img");
gridTable.Columns.Add("id");
gridTable.Columns.Add("name");
gridTable.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = 0; i < 6; i++)
{
gridTable.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
if (gridTable.Rows.Count > 0)
{
gridView1.DataSource = gridTable;
gridView1.DataBind();
}
}
int n = 5;
private void gridView3_ReachEnd(object sender, EventArgs e)
{
if (n < 30)
{
DataTable dt = new DataTable();
dt.Columns.Add("img");
dt.Columns.Add("id");
dt.Columns.Add("name");
dt.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = n; i < n + 5; i++)
{
dt.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
gridView3.NewCell(dt, "");
n += 5;
}
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class demoGridView : 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.panel1 = new Smobiler.Core.Controls.Panel();
this.panel2 = 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.gridView1 = new Smobiler.Core.Controls.GridView();
this.panel3 = new Smobiler.Core.Controls.Panel();
this.label1 = new Smobiler.Core.Controls.Label();
this.label2 = new Smobiler.Core.Controls.Label();
this.label3 = new Smobiler.Core.Controls.Label();
this.label4 = new Smobiler.Core.Controls.Label();
this.gridView2 = new Smobiler.Core.Controls.GridView();
this.gridView3 = new Smobiler.Core.Controls.GridView();
this.panel4 = new Smobiler.Core.Controls.Panel();
this.label5 = new Smobiler.Core.Controls.Label();
this.label6 = new Smobiler.Core.Controls.Label();
this.gridView4 = new Smobiler.Core.Controls.GridView();
this.title1 = new Smobiler.Core.Controls.Title();
this.popList1 = new Smobiler.Core.Controls.PopList();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel2,
this.gridView1,
this.panel3,
this.label3,
this.label4,
this.gridView2,
this.gridView3,
this.panel4,
this.gridView4});
this.panel1.Flex = 1;
this.panel1.Name = "panel1";
this.panel1.Scrollable = true;
this.panel1.Size = new System.Drawing.Size(300, 100);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Border = new Smobiler.Core.Controls.Border(1F);
this.panel2.BorderColor = System.Drawing.Color.Silver;
this.panel2.BorderRadius = 5;
this.panel2.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.labTitle,
this.button1});
this.panel2.Location = new System.Drawing.Point(5, 10);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(290, 168);
//
// 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, 87);
this.labContent.Text = "可进行数据绑定,添加数据集,删除数据集,清除数据集,设置数据集的操作\r\nGridView,ListView都没有点击事件,可以使用其模板页中控件的事件作为点击事件" +
"\r\n";
this.labContent.VerticalAlignment = Smobiler.Core.Controls.VerticalAlignment.Top;
//
// 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.Moccasin;
this.button1.Location = new System.Drawing.Point(42, 127);
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);
//
// gridView1
//
this.gridView1.BackColor = System.Drawing.Color.White;
this.gridView1.Location = new System.Drawing.Point(5, 188);
this.gridView1.Name = "gridView1";
this.gridView1.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView1.PageSizeTextSize = 11F;
this.gridView1.Size = new System.Drawing.Size(290, 210);
this.gridView1.TemplateControlName = "listViewTemplate";
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Border = new Smobiler.Core.Controls.Border(1F);
this.panel3.BorderColor = System.Drawing.Color.Silver;
this.panel3.BorderRadius = 5;
this.panel3.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.label1,
this.label2});
this.panel3.Location = new System.Drawing.Point(5, 408);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(290, 113);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.WhiteSmoke;
this.label1.FontSize = 15F;
this.label1.Location = new System.Drawing.Point(0, 26);
this.label1.Name = "label1";
this.label1.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label1.Size = new System.Drawing.Size(290, 86);
this.label1.Text = "方法1:通过设置PageSize实现分页\r\n方法2:在GridView的ReachEnd通过NewCell方法实现分页 (RaiseReachEnd属性设置tru" +
"e时,可在gridview滑动到底部时触发ReachEnd事件)";
this.label1.VerticalAlignment = Smobiler.Core.Controls.VerticalAlignment.Top;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.WhiteSmoke;
this.label2.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.label2.BorderColor = System.Drawing.Color.DarkSeaGreen;
this.label2.FontSize = 16F;
this.label2.Name = "label2";
this.label2.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label2.Size = new System.Drawing.Size(290, 26);
this.label2.Text = "实现分页";
//
// label3
//
this.label3.BackColor = System.Drawing.Color.WhiteSmoke;
this.label3.Location = new System.Drawing.Point(5, 531);
this.label3.Name = "label3";
this.label3.Padding = new Smobiler.Core.Controls.Padding(5F, 0F, 0F, 0F);
this.label3.Size = new System.Drawing.Size(290, 26);
this.label3.Text = "方法1";
//
// label4
//
this.label4.BackColor = System.Drawing.Color.WhiteSmoke;
this.label4.Location = new System.Drawing.Point(5, 751);
this.label4.Name = "label4";
this.label4.Padding = new Smobiler.Core.Controls.Padding(5F, 0F, 0F, 0F);
this.label4.Size = new System.Drawing.Size(290, 26);
this.label4.Text = "方法2";
//
// gridView2
//
this.gridView2.BackColor = System.Drawing.Color.White;
this.gridView2.Location = new System.Drawing.Point(5, 567);
this.gridView2.Name = "gridView2";
this.gridView2.PageSize = 5;
this.gridView2.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView2.PageSizeTextSize = 11F;
this.gridView2.Size = new System.Drawing.Size(290, 174);
//
// gridView3
//
this.gridView3.BackColor = System.Drawing.Color.White;
this.gridView3.Location = new System.Drawing.Point(5, 787);
this.gridView3.Name = "gridView3";
this.gridView3.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView3.PageSizeTextSize = 11F;
this.gridView3.RaiseReachEnd = true;
this.gridView3.Size = new System.Drawing.Size(290, 174);
this.gridView3.ReachEnd += new System.EventHandler(this.gridView3_ReachEnd);
//
// panel4
//
this.panel4.BackColor = System.Drawing.Color.White;
this.panel4.Border = new Smobiler.Core.Controls.Border(1F);
this.panel4.BorderColor = System.Drawing.Color.Silver;
this.panel4.BorderRadius = 5;
this.panel4.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.label5,
this.label6});
this.panel4.Location = new System.Drawing.Point(5, 971);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(290, 97);
//
// label5
//
this.label5.BackColor = System.Drawing.Color.WhiteSmoke;
this.label5.FontSize = 15F;
this.label5.Location = new System.Drawing.Point(0, 26);
this.label5.Name = "label5";
this.label5.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label5.Size = new System.Drawing.Size(290, 71);
this.label5.Text = "ColumnNum属性设置显示列数,只需设置ColumnNum=4,并且更换模板就可以很方便的实现\r\n";
//
// label6
//
this.label6.BackColor = System.Drawing.Color.WhiteSmoke;
this.label6.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.label6.BorderColor = System.Drawing.Color.DarkSeaGreen;
this.label6.FontSize = 16F;
this.label6.Name = "label6";
this.label6.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label6.Size = new System.Drawing.Size(290, 26);
this.label6.Text = "实现IconMenuView";
//
// gridView4
//
this.gridView4.BackColor = System.Drawing.Color.White;
this.gridView4.ColumnNum = 4;
this.gridView4.Location = new System.Drawing.Point(5, 1078);
this.gridView4.Name = "gridView4";
this.gridView4.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView4.PageSizeTextSize = 11F;
this.gridView4.Size = new System.Drawing.Size(290, 140);
//
// 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 = "GridView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// popList1
//
this.popList1.Name = "popList1";
this.popList1.Selected += new System.EventHandler(this.popList1_Selected);
//
// demoGridView
//
this.Components.AddRange(new Smobiler.Core.Controls.MobileComponent[] {
this.popList1});
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Load += new System.EventHandler(this.demoGridView_Load);
this.Name = "demoGridView";
}
#endregion
private Core.Controls.Panel panel1;
private Core.Controls.Title title1;
private Core.Controls.PopList popList1;
private Core.Controls.Panel panel2;
private Core.Controls.Label labContent;
private Core.Controls.Label labTitle;
private Core.Controls.Button button1;
private Core.Controls.GridView gridView1;
private Core.Controls.Panel panel3;
private Core.Controls.Label label1;
private Core.Controls.Label label2;
private Core.Controls.Label label3;
private Core.Controls.Label label4;
private Core.Controls.GridView gridView2;
private Core.Controls.GridView gridView3;
private Core.Controls.Panel panel4;
private Core.Controls.Label label5;
private Core.Controls.Label label6;
private Core.Controls.GridView gridView4;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Components
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class listViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
public listViewTemplate() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
private void panel1_Press(object sender, EventArgs e)
{
editLayout lp = new editLayout(label1.BindDataValue.ToString(), label1.Text, label2.Text, image1.ResourceID);
this.Form.ShowDialog(lp, (obj, args) =>
{
if (lp.ShowResult == ShowResult.Yes)
{
label1.Text = lp.text1;
label2.Text = lp.text2;
}
});
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class listViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl 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 SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.panel1 = new Smobiler.Core.Controls.Panel();
this.image1 = new Smobiler.Core.Controls.Image();
this.label1 = new Smobiler.Core.Controls.Label();
this.label2 = new Smobiler.Core.Controls.Label();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.image1,
this.label1,
this.label2});
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 100);
this.panel1.Touchable = true;
this.panel1.Press += new System.EventHandler(this.panel1_Press);
//
// image1
//
this.image1.DisplayMember = "img";
this.image1.Location = new System.Drawing.Point(11, 3);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(29, 30);
//
// label1
//
this.label1.DataMember = "id";
this.label1.DisplayMember = "name";
this.label1.Location = new System.Drawing.Point(49, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(135, 35);
this.label1.Text = "label1";
//
// label2
//
this.label2.DisplayMember = "sexual";
this.label2.Location = new System.Drawing.Point(184, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(91, 35);
this.label2.Text = "label1";
//
// listViewTemplate
//
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(290, 35);
this.Name = "listViewTemplate";
}
#endregion
private Core.Controls.Panel panel1;
private Core.Controls.Image image1;
private Core.Controls.Label label1;
private Core.Controls.Label label2;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Components
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class gridViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
public gridViewTemplate() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
private void panel1_Press(object sender, EventArgs e)
{
Toast(label1.Text);
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class gridViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl 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 SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.panel1 = new Smobiler.Core.Controls.Panel();
this.image1 = new Smobiler.Core.Controls.Image();
this.label1 = new Smobiler.Core.Controls.Label();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.image1,
this.label1});
this.panel1.Flex = 1;
this.panel1.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 100);
this.panel1.Touchable = true;
this.panel1.Press += new System.EventHandler(this.panel1_Press);
//
// image1
//
this.image1.DisplayMember = "img";
this.image1.Flex = 5;
this.image1.Margin = new Smobiler.Core.Controls.Margin(10F, 5F, 10F, 5F);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(0, 43);
//
// label1
//
this.label1.DisplayMember = "lab";
this.label1.Flex = 2;
this.label1.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.label1.Margin = new Smobiler.Core.Controls.Margin(0F, 0F, 0F, 5F);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 27);
this.label1.Text = "label1";
//
// gridViewTemplate
//
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(70, 70);
this.Name = "gridViewTemplate";
}
#endregion
private Core.Controls.Panel panel1;
private Core.Controls.Image image1;
private Core.Controls.Label label1;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Components
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class editLayout : Smobiler.Core.Controls.MobileUserControl
{
public string text1 { get { return textBox1.Text; } }
public string text2 { get { return textBox2.Text; } }
public editLayout() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
public editLayout(string id, string name, string sexual, string img) : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
label2.Text = id;
textBox1.Text = name;
textBox2.Text = sexual;
image1.ResourceID = img;
}
private void button1_Press(object sender, EventArgs e)
{
this.ShowResult = ShowResult.Cancel;
this.Close();
}
private void button2_Press(object sender, EventArgs e)
{
this.ShowResult = ShowResult.Yes;
this.Close();
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class editLayout : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl 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 SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.image1 = new Smobiler.Core.Controls.Image();
this.textBox1 = new Smobiler.Core.Controls.TextBox();
this.textBox2 = new Smobiler.Core.Controls.TextBox();
this.button1 = new Smobiler.Core.Controls.Button();
this.button2 = new Smobiler.Core.Controls.Button();
this.label1 = new Smobiler.Core.Controls.Label();
this.label2 = new Smobiler.Core.Controls.Label();
//
// title1
//
this.title1.Name = "title1";
this.title1.Size = new System.Drawing.Size(0, 30);
this.title1.Text = "编辑";
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.image1,
this.textBox1,
this.textBox2,
this.button1,
this.button2,
this.label1,
this.label2});
this.panel1.Direction = Smobiler.Core.Controls.LayoutDirection.Row;
this.panel1.Flex = 1;
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 100);
this.panel1.Touchable = true;
//
// image1
//
this.image1.Location = new System.Drawing.Point(27, 55);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(81, 79);
//
// textBox1
//
this.textBox1.Border = new Smobiler.Core.Controls.Border(1F);
this.textBox1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(249)))));
this.textBox1.Location = new System.Drawing.Point(142, 81);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(120, 35);
//
// textBox2
//
this.textBox2.Border = new Smobiler.Core.Controls.Border(1F);
this.textBox2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(249)))));
this.textBox2.Location = new System.Drawing.Point(142, 134);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(120, 35);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(67)))), ((int)(((byte)(81)))));
this.button1.Location = new System.Drawing.Point(27, 194);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 30);
this.button1.Text = "取消";
this.button1.Press += new System.EventHandler(this.button1_Press);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(249)))));
this.button2.Location = new System.Drawing.Point(174, 194);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 30);
this.button2.Text = "保存";
this.button2.Press += new System.EventHandler(this.button2_Press);
//
// label1
//
this.label1.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Right;
this.label1.Location = new System.Drawing.Point(142, 26);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 35);
this.label1.Text = "id:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(190, 26);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 35);
this.label2.Text = "label2";
//
// editLayout
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(0, 300);
this.Name = "editLayout";
}
#endregion
private Core.Controls.Title title1;
private Core.Controls.Panel panel1;
private Core.Controls.Image image1;
private Core.Controls.TextBox textBox1;
private Core.Controls.TextBox textBox2;
private Core.Controls.Button button1;
private Core.Controls.Button button2;
private Core.Controls.Label label1;
private Core.Controls.Label label2;
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
using Smobiler.Plugins;
using SmobilerTutorialsWeb.UserControls;
namespace SmobilerTutorialsWeb.Components
{
partial class demoGridView : Smobiler.Core.Controls.MobileForm
{
public demoGridView() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void demoGridView_Load(object sender, EventArgs e)
{
spinner1.Items = new string[] { "DataBind", "删除行", "清空", "新增行", "编辑" };
DataTable dt = new DataTable();
dt.Columns.Add("img");
dt.Columns.Add("id");
dt.Columns.Add("name");
dt.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = 0; i < 8; i++)
{
dt.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
//gridView2绑定数据
gridView2.TemplateControl = new demoListViewTemplate();
gridView2.DataSource = dt;
gridView2.DataBind();
//gridView3绑定数据
gridView3.TemplateControl = new demoListViewTemplate();
gridView3.DataSource = dt;
gridView3.DataBind();
//gridView4 绑定数据
DataTable dt1 = new DataTable();
dt1.Columns.Add("img");
dt1.Columns.Add("lab");
dt1.Rows.Add("CF", "item1");
dt1.Rows.Add("FZ", "item2");
dt1.Rows.Add("GL", "item3");
dt1.Rows.Add("KD", "item4");
dt1.Rows.Add("WX", "item5");
dt1.Rows.Add("XZ", "item6");
dt1.Rows.Add("YJ", "item7");
dt1.Rows.Add("ZS", "item8");
gridView4.TemplateControl = new demoGridViewTemplate();
gridView4.DataSource = dt1;
gridView4.DataBind();
}
private void spinner1_ItemSelected(object sender, SpinnerItemSelectedEventArgs e)
{
switch (spinner1.Text)
{
case "DataBind":
DataBind();
labContent.Text = "数据绑定";
break;
case "删除行":
if (gridView1.Cells.Count > 0)
{
int i = gridView1.Cells.Count;
gridView1.Cells.RemoveAt(i - 1);
labContent.Text = "gridView1.Cells.Remove ,gridView1.Cells.RemoveAt删除行。";
}
break;
case "清空":
gridView1.Cells.Clear();
labContent.Text = " gridView1.Cells.Clear清空数据。";
break;
case "新增行":
gridTable = new DataTable();
gridTable.Columns.Add("img");
gridTable.Columns.Add("id");
gridTable.Columns.Add("name");
gridTable.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = 9; i < 12; i++)
{
gridTable.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
gridView1.NewCell(gridTable, "");
labContent.Text = "gridView1.NewCell 新增行。";
break;
case "编辑":
labContent.Text = "点击行项进行编辑。";
break;
}
}
DataTable gridTable;
private void DataBind()
{
gridTable = new DataTable();
gridTable.Columns.Add("img");
gridTable.Columns.Add("id");
gridTable.Columns.Add("name");
gridTable.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = 0; i < 8; i++)
{
gridTable.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
if (gridTable.Rows.Count > 0)
{
gridView1.DataSource = gridTable;
gridView1.DataBind();
}
}
int n = 5;
private void gridView3_ReachEnd(object sender, EventArgs e)
{
if (n < 30)
{
DataTable dt = new DataTable();
dt.Columns.Add("img");
dt.Columns.Add("id");
dt.Columns.Add("name");
dt.Columns.Add("sexual");
string[] sex = new string[] { "男", "女" };
string[] pic = new string[] { "boy.png", "girl.png" };
for (int i = n; i < n + 5; i++)
{
dt.Rows.Add(pic[i%2], i, "user" + i.ToString(), sex[i % 2]);
}
gridView3.NewCell(dt, "");
n += 5;
}
}
}
}
using System;
using Smobiler.Core;
namespace SmobilerTutorialsWeb.Components
{
partial class demoGridView : 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.panel1 = new Smobiler.Core.Controls.Panel();
this.panel2 = new Smobiler.Core.Controls.Panel();
this.labContent = new Smobiler.Core.Controls.Label();
this.spinner1 = new Smobiler.Core.Controls.Spinner();
this.gridView1 = new Smobiler.Core.Controls.GridView();
this.label4 = new Smobiler.Core.Controls.Label();
this.label2 = new Smobiler.Core.Controls.Label();
this.panel3 = new Smobiler.Core.Controls.Panel();
this.label1 = new Smobiler.Core.Controls.Label();
this.label3 = new Smobiler.Core.Controls.Label();
this.gridView2 = new Smobiler.Core.Controls.GridView();
this.gridView3 = new Smobiler.Core.Controls.GridView();
this.label6 = new Smobiler.Core.Controls.Label();
this.panel4 = new Smobiler.Core.Controls.Panel();
this.label7 = new Smobiler.Core.Controls.Label();
this.gridView4 = new Smobiler.Core.Controls.GridView();
//
// 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 = "GridView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel2,
this.label4,
this.label2,
this.panel3,
this.label6,
this.panel4});
this.panel1.Flex = 1;
this.panel1.Name = "panel1";
this.panel1.Scrollable = true;
this.panel1.Size = new System.Drawing.Size(0, 100);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Border = new Smobiler.Core.Controls.Border(1F);
this.panel2.BorderColor = System.Drawing.Color.Silver;
this.panel2.BorderRadius = 5;
this.panel2.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.spinner1,
this.gridView1});
this.panel2.Location = new System.Drawing.Point(120, 57);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(427, 454);
//
// labContent
//
this.labContent.BackColor = System.Drawing.Color.White;
this.labContent.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.labContent.Location = new System.Drawing.Point(0, 92);
this.labContent.Name = "labContent";
this.labContent.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labContent.Size = new System.Drawing.Size(427, 54);
this.labContent.Text = "点击上方选项,可进行数据绑定,添加行,删除行,清空,根据数据源添加,index事件\r\n";
//
// spinner1
//
this.spinner1.Location = new System.Drawing.Point(114, 27);
this.spinner1.Name = "spinner1";
this.spinner1.Size = new System.Drawing.Size(200, 30);
this.spinner1.ItemSelected += new System.EventHandler<Smobiler.Core.Controls.SpinnerItemSelectedEventArgs>(this.spinner1_ItemSelected);
//
// gridView1
//
this.gridView1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
this.gridView1.Location = new System.Drawing.Point(64, 181);
this.gridView1.Name = "gridView1";
this.gridView1.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView1.PageSizeTextSize = 11F;
this.gridView1.Size = new System.Drawing.Size(300, 218);
this.gridView1.TemplateControlName = "demoListViewTemplate";
//
// label4
//
this.label4.BackColor = System.Drawing.Color.White;
this.label4.Bold = true;
this.label4.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.label4.BorderColor = System.Drawing.Color.White;
this.label4.FontSize = 16F;
this.label4.Location = new System.Drawing.Point(120, 30);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(427, 26);
this.label4.Text = "表格显示控件";
//
// label2
//
this.label2.BackColor = System.Drawing.Color.White;
this.label2.Bold = true;
this.label2.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.label2.BorderColor = System.Drawing.Color.White;
this.label2.FontSize = 16F;
this.label2.Location = new System.Drawing.Point(646, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(427, 26);
this.label2.Text = "实现分页";
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Border = new Smobiler.Core.Controls.Border(1F);
this.panel3.BorderColor = System.Drawing.Color.Silver;
this.panel3.BorderRadius = 5;
this.panel3.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.label1,
this.label3,
this.gridView2,
this.gridView3});
this.panel3.Location = new System.Drawing.Point(646, 57);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(427, 454);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.White;
this.label1.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.label1.Location = new System.Drawing.Point(0, 185);
this.label1.Name = "label1";
this.label1.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label1.Size = new System.Drawing.Size(427, 33);
this.label1.Text = "方法1:通过设置PageSize实现分页\r\n\r\n";
//
// label3
//
this.label3.BackColor = System.Drawing.Color.White;
this.label3.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.label3.Location = new System.Drawing.Point(0, 409);
this.label3.Name = "label3";
this.label3.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label3.Size = new System.Drawing.Size(427, 45);
this.label3.Text = "方法2:在GridView的ReachEnd通过NewCell方法实现分页 (RaiseReachEnd属性设置true时,可在gridview滑动到底部时触发R" +
"eachEnd事件)\r\n";
//
// gridView2
//
this.gridView2.Location = new System.Drawing.Point(60, 20);
this.gridView2.Name = "gridView2";
this.gridView2.PageSize = 3;
this.gridView2.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView2.PageSizeTextSize = 11F;
this.gridView2.Size = new System.Drawing.Size(300, 141);
//
// gridView3
//
this.gridView3.Location = new System.Drawing.Point(60, 242);
this.gridView3.Name = "gridView3";
this.gridView3.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView3.PageSizeTextSize = 11F;
this.gridView3.RaiseReachEnd = true;
this.gridView3.Size = new System.Drawing.Size(300, 141);
this.gridView3.ReachEnd += new System.EventHandler(this.gridView3_ReachEnd);
//
// label6
//
this.label6.BackColor = System.Drawing.Color.White;
this.label6.Bold = true;
this.label6.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.label6.BorderColor = System.Drawing.Color.White;
this.label6.FontSize = 16F;
this.label6.Location = new System.Drawing.Point(120, 541);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(427, 26);
this.label6.Text = "GridView 实现IconMenuView";
//
// panel4
//
this.panel4.BackColor = System.Drawing.Color.White;
this.panel4.Border = new Smobiler.Core.Controls.Border(1F);
this.panel4.BorderColor = System.Drawing.Color.Silver;
this.panel4.BorderRadius = 5;
this.panel4.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.label7,
this.gridView4});
this.panel4.Location = new System.Drawing.Point(120, 568);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(427, 312);
//
// label7
//
this.label7.BackColor = System.Drawing.Color.White;
this.label7.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.label7.Location = new System.Drawing.Point(0, 222);
this.label7.Name = "label7";
this.label7.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label7.Size = new System.Drawing.Size(426, 54);
this.label7.Text = "ColumnNum属性设置显示列数\r\n";
//
// gridView4
//
this.gridView4.ColumnNum = 4;
this.gridView4.Location = new System.Drawing.Point(68, 57);
this.gridView4.Name = "gridView4";
this.gridView4.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.gridView4.PageSizeTextSize = 11F;
this.gridView4.Size = new System.Drawing.Size(300, 141);
//
// demoGridView
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(1200, 800);
this.Load += new System.EventHandler(this.demoGridView_Load);
this.Name = "demoGridView";
}
#endregion
private Smobiler.Core.Controls.Title title1;
private Smobiler.Core.Controls.Panel panel1;
private Smobiler.Core.Controls.Panel panel2;
private Smobiler.Core.Controls.Label labContent;
private Smobiler.Core.Controls.Spinner spinner1;
private Smobiler.Core.Controls.Label label4;
private Smobiler.Core.Controls.GridView gridView1;
private Smobiler.Core.Controls.Label label2;
private Smobiler.Core.Controls.Panel panel3;
private Smobiler.Core.Controls.Label label1;
private Smobiler.Core.Controls.Label label3;
private Smobiler.Core.Controls.GridView gridView2;
private Smobiler.Core.Controls.GridView gridView3;
private Smobiler.Core.Controls.Label label6;
private Smobiler.Core.Controls.Panel panel4;
private Smobiler.Core.Controls.Label label7;
private Smobiler.Core.Controls.GridView gridView4;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace SmobilerTutorialsWeb.UserControls
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class demoListViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
public demoListViewTemplate() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
private void panel1_Press(object sender, EventArgs e)
{
demoListViewEditTemplate lp = new demoListViewEditTemplate(label1.BindDataValue.ToString(), label1.Text, label2.Text, image1.ResourceID);
this.Form.ShowDialog(lp, (obj, args) =>
{
if (lp.ShowResult == ShowResult.Yes)
{
label1.Text = lp.text1;
label2.Text = lp.text2;
}
});
}
}
}
using System;
using Smobiler.Core;
namespace SmobilerTutorialsWeb.UserControls
{
partial class demoListViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl 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 SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.panel1 = new Smobiler.Core.Controls.Panel();
this.image1 = new Smobiler.Core.Controls.Image();
this.label1 = new Smobiler.Core.Controls.Label();
this.label2 = new Smobiler.Core.Controls.Label();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.image1,
this.label1,
this.label2});
this.panel1.Direction = Smobiler.Core.Controls.LayoutDirection.Row;
this.panel1.Flex = 1;
this.panel1.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 100);
this.panel1.Touchable = true;
this.panel1.Press += new System.EventHandler(this.panel1_Press);
//
// image1
//
this.image1.DisplayMember = "img";
this.image1.Margin = new Smobiler.Core.Controls.Margin(20F, 10F, 10F, 10F);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(30, 30);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.White;
this.label1.DataMember = "id";
this.label1.DisplayMember = "name";
this.label1.FontSize = 14F;
this.label1.Margin = new Smobiler.Core.Controls.Margin(10F);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(96, 30);
this.label1.Text = "label1";
//
// label2
//
this.label2.DisplayMember = "sexual";
this.label2.FontSize = 14F;
this.label2.Margin = new Smobiler.Core.Controls.Margin(10F);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(93, 30);
this.label2.Text = "label2";
//
// demoListViewTemplate
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(0, 50);
this.Name = "demoListViewTemplate";
}
#endregion
private Smobiler.Core.Controls.Panel panel1;
private Smobiler.Core.Controls.Image image1;
private Smobiler.Core.Controls.Label label1;
private Smobiler.Core.Controls.Label label2;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace SmobilerTutorialsWeb.UserControls
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class demoGridViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
public demoGridViewTemplate() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
private void panel1_Press(object sender, EventArgs e)
{
Toast("当前点击项:" + label1.Text);
}
}
}
using System;
using Smobiler.Core;
namespace SmobilerTutorialsWeb.UserControls
{
partial class demoGridViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl 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 SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.panel1 = new Smobiler.Core.Controls.Panel();
this.image1 = new Smobiler.Core.Controls.Image();
this.label1 = new Smobiler.Core.Controls.Label();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.image1,
this.label1});
this.panel1.Flex = 1;
this.panel1.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 100);
this.panel1.Touchable = true;
this.panel1.Press += new System.EventHandler(this.panel1_Press);
//
// image1
//
this.image1.DisplayMember = "img";
this.image1.Flex = 5;
this.image1.Margin = new Smobiler.Core.Controls.Margin(10F, 5F, 10F, 5F);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(0, 43);
//
// label1
//
this.label1.DisplayMember = "lab";
this.label1.Flex = 2;
this.label1.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.label1.Margin = new Smobiler.Core.Controls.Margin(0F, 0F, 0F, 5F);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 27);
this.label1.Text = "label1";
//
// demoGridViewTemplate
//
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(70, 70);
this.Name = "demoGridViewTemplate";
}
#endregion
private Smobiler.Core.Controls.Panel panel1;
private Smobiler.Core.Controls.Image image1;
private Smobiler.Core.Controls.Label label1;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace SmobilerTutorialsWeb.UserControls
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class demoListViewEditTemplate : Smobiler.Core.Controls.MobileUserControl
{
public string text1 { get { return textBox1.Text; } }
public string text2 { get { return textBox2.Text; } }
public demoListViewEditTemplate() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
public demoListViewEditTemplate(string id,string name,string sexual,string img) : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
label2.Text = id;
textBox1.Text = name;
textBox2.Text = sexual;
image1.ResourceID = img;
}
private void panel1_Press(object sender, EventArgs e)
{
}
private void button1_Press(object sender, EventArgs e)
{
this.ShowResult = ShowResult.Cancel;
this.Close();
}
private void button2_Press(object sender, EventArgs e)
{
this.ShowResult = ShowResult.Yes;
this.Close();
}
}
}
using System;
using Smobiler.Core;
namespace SmobilerTutorialsWeb.UserControls
{
partial class demoListViewEditTemplate : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl 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 SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.image1 = new Smobiler.Core.Controls.Image();
this.textBox1 = new Smobiler.Core.Controls.TextBox();
this.textBox2 = new Smobiler.Core.Controls.TextBox();
this.button1 = new Smobiler.Core.Controls.Button();
this.button2 = new Smobiler.Core.Controls.Button();
this.label1 = new Smobiler.Core.Controls.Label();
this.label2 = new Smobiler.Core.Controls.Label();
//
// title1
//
this.title1.Name = "title1";
this.title1.Size = new System.Drawing.Size(0, 30);
this.title1.Text = "编辑";
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.image1,
this.textBox1,
this.textBox2,
this.button1,
this.button2,
this.label1,
this.label2});
this.panel1.Direction = Smobiler.Core.Controls.LayoutDirection.Row;
this.panel1.Flex = 1;
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 100);
this.panel1.Touchable = true;
this.panel1.Press += new System.EventHandler(this.panel1_Press);
//
// image1
//
this.image1.Location = new System.Drawing.Point(130, 56);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(81, 79);
//
// textBox1
//
this.textBox1.Border = new Smobiler.Core.Controls.Border(1F);
this.textBox1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(249)))));
this.textBox1.Location = new System.Drawing.Point(249, 76);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(120, 35);
//
// textBox2
//
this.textBox2.Border = new Smobiler.Core.Controls.Border(1F);
this.textBox2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(249)))));
this.textBox2.Location = new System.Drawing.Point(249, 129);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(120, 35);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(67)))), ((int)(((byte)(81)))));
this.button1.Location = new System.Drawing.Point(134, 189);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 30);
this.button1.Text = "取消";
this.button1.Press += new System.EventHandler(this.button1_Press);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(249)))));
this.button2.Location = new System.Drawing.Point(281, 189);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 30);
this.button2.Text = "保存";
this.button2.Press += new System.EventHandler(this.button2_Press);
//
// label1
//
this.label1.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Right;
this.label1.Location = new System.Drawing.Point(249, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 35);
this.label1.Text = "id:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(297, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 35);
this.label2.Text = "label2";
//
// demoListViewEditTemplate
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(500, 300);
this.Name = "demoListViewEditTemplate";
}
#endregion
private Smobiler.Core.Controls.Title title1;
private Smobiler.Core.Controls.Panel panel1;
private Smobiler.Core.Controls.Image image1;
private Smobiler.Core.Controls.TextBox textBox1;
private Smobiler.Core.Controls.TextBox textBox2;
private Smobiler.Core.Controls.Button button1;
private Smobiler.Core.Controls.Button button2;
private Smobiler.Core.Controls.Label label1;
private Smobiler.Core.Controls.Label label2;
}
}