预览
代码
手机端效果
demoSignatureView.cs
demoSignatureView.Designer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Plugins
{
partial class demoSignatureView : Smobiler.Core.Controls.MobileForm
{
public demoSignatureView()
: base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private Random rd = new Random();
private void btnColor_Press(object sender, EventArgs e)
{
signatureView1.StrokeColor = GetRandomColor();
}
private System.Drawing.Color GetRandomColor()
{
return System.Drawing.Color.FromArgb(rd.Next(0, 256), rd.Next(0, 256), rd.Next(0, 256));
}
private void btnWidth_Press(object sender, EventArgs e)
{
signatureView1.StrokeWidth = rd.Next(1, 15);
btnWidth.Text = "Width" + signatureView1.StrokeWidth.ToString();
}
private void btnSave_Press(object sender, EventArgs e)
{
signatureView1.Save();
}
private void btnClear_Press(object sender, EventArgs e)
{
signatureView1.Clear();
}
private void signatureView1_OnSignatureImageSave(object sender, BinaryResultArgs e)
{
e.SaveFile();
image1.ResourcePath = MobileResourceManager.DefaultUploadPath;
image1.ResourceID = e.ResourceID;
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Plugins
{
partial class demoSignatureView : 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.signatureView1 = new Smobiler.Plugins.SignatureView();
this.panel2 = new Smobiler.Core.Controls.Panel();
this.label5 = new Smobiler.Core.Controls.Label();
this.label6 = new Smobiler.Core.Controls.Label();
this.btnWidth = new Smobiler.Core.Controls.Button();
this.btnColor = new Smobiler.Core.Controls.Button();
this.panel3 = new Smobiler.Core.Controls.Panel();
this.label1 = new Smobiler.Core.Controls.Label();
this.label2 = new Smobiler.Core.Controls.Label();
this.btnClear = new Smobiler.Core.Controls.Button();
this.btnSave = new Smobiler.Core.Controls.Button();
this.panel4 = new Smobiler.Core.Controls.Panel();
this.label3 = new Smobiler.Core.Controls.Label();
this.label4 = new Smobiler.Core.Controls.Label();
this.image1 = new Smobiler.Core.Controls.Image();
this.label7 = new Smobiler.Core.Controls.Label();
//
// 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 = "SignatureView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel10
//
this.panel10.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1,
this.panel2,
this.panel3,
this.panel4});
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.signatureView1});
this.panel1.Location = new System.Drawing.Point(5, 9);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(290, 391);
//
// 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 = "签字组件,";
//
// 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 = "SignatureView组件";
//
// signatureView1
//
this.signatureView1.Location = new System.Drawing.Point(0, 89);
this.signatureView1.Name = "signatureView1";
this.signatureView1.Size = new System.Drawing.Size(290, 300);
this.signatureView1.OnSignatureImageSave += new Smobiler.Core.Controls.BinaryResultCallBackHandler(this.signatureView1_OnSignatureImageSave);
//
// 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.label5,
this.label6,
this.btnWidth,
this.btnColor});
this.panel2.Location = new System.Drawing.Point(5, 411);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(290, 128);
//
// label5
//
this.label5.BackColor = System.Drawing.Color.WhiteSmoke;
this.label5.FontSize = 14F;
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, 54);
this.label5.Text = "StrokeColor(线条颜色)、StrokeWidth(线条粗细)来改变画笔";
//
// 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 = "签字组件画笔样式";
//
// btnWidth
//
this.btnWidth.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(192)))), ((int)(((byte)(80)))));
this.btnWidth.Location = new System.Drawing.Point(159, 89);
this.btnWidth.Name = "btnWidth";
this.btnWidth.Size = new System.Drawing.Size(100, 30);
this.btnWidth.Text = "Width";
this.btnWidth.Press += new System.EventHandler(this.btnWidth_Press);
//
// btnColor
//
this.btnColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(67)))), ((int)(((byte)(81)))));
this.btnColor.Location = new System.Drawing.Point(23, 89);
this.btnColor.Name = "btnColor";
this.btnColor.Size = new System.Drawing.Size(100, 30);
this.btnColor.Text = "Color";
this.btnColor.Press += new System.EventHandler(this.btnColor_Press);
//
// 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.btnClear,
this.btnSave});
this.panel3.Location = new System.Drawing.Point(5, 553);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(290, 131);
//
// 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, 54);
this.label1.Text = "Save保存签字板、Clear清除签字板";
//
// 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 = "签字组件方法";
//
// btnClear
//
this.btnClear.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(229)))), ((int)(((byte)(100)))));
this.btnClear.Location = new System.Drawing.Point(159, 91);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(100, 30);
this.btnClear.Text = "Clear";
this.btnClear.Press += new System.EventHandler(this.btnClear_Press);
//
// btnSave
//
this.btnSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(176)))), ((int)(((byte)(250)))));
this.btnSave.Location = new System.Drawing.Point(23, 91);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(100, 30);
this.btnSave.Text = "Save";
this.btnSave.Press += new System.EventHandler(this.btnSave_Press);
//
// 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.label3,
this.label4,
this.image1,
this.label7});
this.panel4.Location = new System.Drawing.Point(5, 697);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(290, 273);
//
// label3
//
this.label3.BackColor = System.Drawing.Color.WhiteSmoke;
this.label3.FontSize = 14F;
this.label3.Location = new System.Drawing.Point(0, 26);
this.label3.Name = "label3";
this.label3.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label3.Size = new System.Drawing.Size(290, 54);
this.label3.Text = "OnSignatureImageSave在客户端返回签字数据时发生";
//
// label4
//
this.label4.BackColor = System.Drawing.Color.WhiteSmoke;
this.label4.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.label4.BorderColor = System.Drawing.Color.DarkSeaGreen;
this.label4.FontSize = 16F;
this.label4.Name = "label4";
this.label4.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label4.Size = new System.Drawing.Size(290, 26);
this.label4.Text = "签字组件事件";
//
// image1
//
this.image1.Location = new System.Drawing.Point(0, 115);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(290, 158);
//
// label7
//
this.label7.FontSize = 14F;
this.label7.Location = new System.Drawing.Point(0, 80);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(290, 35);
this.label7.Text = "在事件中保存签字,显示如下:";
//
// demoSignatureView
//
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel10});
this.Size = new System.Drawing.Size(300, 1000);
this.Name = "demoSignatureView";
}
#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.Panel panel2;
private Core.Controls.Label label5;
private Core.Controls.Label label6;
private Smobiler.Plugins.SignatureView signatureView1;
private Core.Controls.Button btnWidth;
private Core.Controls.Button btnColor;
private Core.Controls.Panel panel3;
private Core.Controls.Label label1;
private Core.Controls.Label label2;
private Core.Controls.Button btnClear;
private Core.Controls.Button btnSave;
private Core.Controls.Panel panel4;
private Core.Controls.Label label3;
private Core.Controls.Label label4;
private Core.Controls.Image image1;
private Core.Controls.Label label7;
}
}