-
Notifications
You must be signed in to change notification settings - Fork 204
/
Code32.cs
68 lines (58 loc) · 2.45 KB
/
Code32.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using Android.Content;
using Android.Views;
using Android.Widget;
using Android.Graphics;
using Com.Syncfusion.Barcode;
using Com.Syncfusion.Barcode.Enums;
namespace SampleBrowser
{
public class Code32 : SamplePage
{
SfBarcode barcode;
public override View GetSampleContent (Context con)
{
LinearLayout linear = new LinearLayout(con);
linear.SetBackgroundColor(Color.White);
linear.Orientation = Orientation.Vertical;
linear.SetPadding(10, 10, 10, 10);
TextView text1 = new TextView(con);
text1.TextSize = 16;
text1.SetTextColor(Color.ParseColor("#262626"));
text1.Typeface = Typeface.DefaultBold;
text1.Text = "Allowed Characters";
text1.SetPadding(5, 10, 10, 5);
linear.AddView(text1);
TextView text2 = new TextView(con);
text2.TextSize = 14;
text2.SetTextColor(Color.ParseColor("#3F3F3F"));
text2.Text = "1 2 3 4 5 6 7 8 9 0\nText length should be 8!!!";
text2.SetPadding(5, 5, 5, 5);
LinearLayout text2Layout = new LinearLayout(con);
LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
text2Layout.LayoutParameters = parms;
text2Layout.AddView(text2);
linear.AddView(text2Layout);
LinearLayout barcodeLayout = new LinearLayout(con);
barcodeLayout.SetPadding(0, 10, 0, 5);
LinearLayout.LayoutParams parms1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
barcodeLayout.LayoutParameters = parms1;
barcode = new SfBarcode(con);
barcode.Text = "87654321";
Typeface fontFamily = Typeface.Create("helvetica", TypefaceStyle.Bold);
barcode.TextFont = fontFamily;
barcode.SetBackgroundColor(Color.ParseColor("#F2F2F2"));
barcode.Symbology = BarcodeSymbolType.Code32;
barcode.TextSize = 20;
Code32Settings setting = new Code32Settings();
setting.BarHeight = 120;
setting.NarrowBarWidth = 3;
barcode.SymbologySettings = setting;
barcodeLayout.AddView(barcode);
linear.AddView(barcodeLayout);
return linear;
}
}
}