最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便
一、目标样式
我们要实现上图中的效果,需要如下的操作:
1.从工具栏上的”Smobiler Components”拖动一个GridView控件到窗体界面上
2.修改GridView控件的属性
a.load事件代码
VB:
Private Sub TestGridView2_Load(senderAs Object, e As EventArgs)Handles MyBase.Load
Dim matTable As New DataTable
matTable.Columns.Add("MAT_DESC1", GetType(String))
matTable.Columns.Add("MAT_DESC2", GetType(String))
matTable.Columns.Add("MAT_DESC3", GetType(String))
matTable.Rows.Add()
matTable.Rows(0)("MAT_DESC1") = "Vicky的请假"
matTable.Rows(0)("MAT_DESC2") = "待审批"
matTable.Rows(0)("MAT_DESC3") = "上午11:51"
matTable.Rows.Add()
matTable.Rows(1)("MAT_DESC1") = "Vicky的请假"
matTable.Rows(1)("MAT_DESC2") = "待审批"
matTable.Rows(1)("MAT_DESC3") = "2015.09.09"
Me.GridView1.DataSource = matTable
Me.GridView1.DataBind()
End Sub
C#:
private void TestGridView2_Load(object sender, EventArgs e)
{
DataTable matTable = new DataTable();
matTable.Columns.Add("MAT_DESC1", typeof(string));
matTable.Columns.Add("MAT_DESC2", typeof(string));
matTable.Columns.Add("MAT_DESC3", typeof(string));
matTable.Rows.Add();
matTable.Rows[0]["MAT_DESC1"] = "Vicky的请假";
matTable.Rows[0]["MAT_DESC2"] = "待审批";
matTable.Rows[0]["MAT_DESC3"] = "上午11:51";
matTable.Rows.Add();
matTable.Rows[1]["MAT_DESC1"] = "Vicky的请假";
matTable.Rows[1]["MAT_DESC2"] = "待审批";
matTable.Rows[1]["MAT_DESC3"] = "2015.09.09";
this.GridView1.DataSource = matTable;
this.GridView1.DataBind();
}
b.Layout属性
新建MobileForm项,命名为MessageShow2,并拖入一个Image控件和三个Label控件,如图1
三个Label控件的DisplayMember属性分别绑定需要显示的列,如图2
GridView的Layout属性,绑定新建的窗体MessageShow2,如图3
图1 | 图2 | 图3 |