U_QC.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. using System;
  2. using System.ComponentModel;
  3. using System.Diagnostics;
  4. using System.Drawing;
  5. using System.Drawing.Design;
  6. using System.Reflection;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Microsoft.VisualBasic;
  10. using Microsoft.VisualBasic.CompilerServices;
  11. namespace Dongke.IBOSS.PRD.Framework.Controls
  12. {
  13. [DesignerGenerated]
  14. [EditorBrowsable(EditorBrowsableState.Never)]
  15. [ToolboxItem(false)]
  16. [Browsable(false)]
  17. public class U_QC : UserControl, ICustomTypeDescriptor, IControl
  18. {
  19. public enum BarcodeFormat
  20. {
  21. AZTEC = 1,
  22. CODABAR = 2,
  23. CODE_39 = 4,
  24. CODE_93 = 8,
  25. CODE_128 = 16,
  26. CODE_128B = 17,
  27. DATA_MATRIX = 32,
  28. EAN_8 = 64,
  29. EAN_13 = 128,
  30. ITF = 256,
  31. MAXICODE = 512,
  32. PDF_417 = 1024,
  33. QR_CODE = 2048
  34. }
  35. private class XpropDescriptor : PropertyDescriptor
  36. {
  37. private string theProp;
  38. private U_QC mycc;
  39. public override Type ComponentType => GetType();
  40. public override bool IsReadOnly => false;
  41. public override Type PropertyType
  42. {
  43. get
  44. {
  45. switch (theProp.ToLower())
  46. {
  47. case "isprint":
  48. return mycc.IsPrint.GetType();
  49. case "x":
  50. return mycc.X.GetType();
  51. case "y":
  52. return mycc.Y.GetType();
  53. case "ewidth":
  54. return mycc.EWidth.GetType();
  55. case "eheight":
  56. return mycc.EHeight.GetType();
  57. case "linewidth":
  58. return mycc.LineWidth.GetType();
  59. case "linecolor":
  60. return mycc.LineColor.GetType();
  61. case "filledcolor":
  62. return mycc.FilledColor.GetType();
  63. case "textvalue":
  64. return mycc.TextValue.GetType();
  65. case "chartype":
  66. return mycc.CharType.GetType();
  67. case "leftborder":
  68. return mycc.LeftBorder.GetType();
  69. case "rightborder":
  70. return mycc.RightBorder.GetType();
  71. case "topborder":
  72. return mycc.TopBorder.GetType();
  73. case "bottomborder":
  74. return mycc.BottomBorder.GetType();
  75. case "textfont":
  76. return mycc.TextFont.GetType();
  77. case "textcolor":
  78. return mycc.TextColor.GetType();
  79. case "margins":
  80. return mycc.Margins.GetType();
  81. case "bartype":
  82. return mycc.BarType.GetType();
  83. default:
  84. Interaction.MsgBox("Property过程编程错误,属性名称[" + theProp + "]未找到", MsgBoxStyle.OkOnly, "提示信息");
  85. return null;
  86. }
  87. }
  88. }
  89. public XpropDescriptor(U_QC cc, string prop, Attribute[] attrs)
  90. : base(prop, attrs)
  91. {
  92. theProp = cc.GetPropertyEnglishName(prop);
  93. mycc = cc;
  94. }
  95. public override bool CanResetValue(object component)
  96. {
  97. return false;
  98. }
  99. public override object GetValue(object component)
  100. {
  101. switch (theProp.ToLower())
  102. {
  103. case "isprint":
  104. return mycc.IsPrint;
  105. case "x":
  106. return mycc.X;
  107. case "y":
  108. return mycc.Y;
  109. case "ewidth":
  110. return mycc.EWidth;
  111. case "eheight":
  112. return mycc.EHeight;
  113. case "linewidth":
  114. return mycc.LineWidth;
  115. case "linecolor":
  116. return mycc.LineColor;
  117. case "filledcolor":
  118. return mycc.FilledColor;
  119. case "textvalue":
  120. return mycc.TextValue;
  121. case "chartype":
  122. return mycc.CharType;
  123. case "leftborder":
  124. return mycc.LeftBorder;
  125. case "rightborder":
  126. return mycc.RightBorder;
  127. case "topborder":
  128. return mycc.TopBorder;
  129. case "bottomborder":
  130. return mycc.BottomBorder;
  131. case "textfont":
  132. return mycc.TextFont;
  133. case "textcolor":
  134. return mycc.TextColor;
  135. case "margins":
  136. return mycc.Margins;
  137. case "bartype":
  138. return mycc.BarType;
  139. default:
  140. Interaction.MsgBox("GetValue过程编程错误,属性名称[" + theProp + "]未找到", MsgBoxStyle.OkOnly, "提示信息");
  141. return null;
  142. }
  143. }
  144. public override void ResetValue(object component)
  145. {
  146. }
  147. public override void SetValue(object component, object value)
  148. {
  149. switch (theProp.ToLower())
  150. {
  151. case "isprint":
  152. mycc.IsPrint = Conversions.ToBoolean(value);
  153. break;
  154. case "x":
  155. mycc.X = Conversions.ToSingle(value);
  156. break;
  157. case "y":
  158. mycc.Y = Conversions.ToSingle(value);
  159. break;
  160. case "ewidth":
  161. mycc.EWidth = Conversions.ToSingle(value);
  162. break;
  163. case "eheight":
  164. mycc.EHeight = Conversions.ToSingle(value);
  165. break;
  166. case "linewidth":
  167. mycc.LineWidth = Conversions.ToSingle(value);
  168. break;
  169. case "linecolor":
  170. {
  171. Color black3 = Color.Black;
  172. mycc.LineColor = ((value != null) ? ((Color)value) : black3);
  173. break;
  174. }
  175. case "filledcolor":
  176. {
  177. Color black2 = Color.Black;
  178. mycc.FilledColor = ((value != null) ? ((Color)value) : black2);
  179. break;
  180. }
  181. case "textvalue":
  182. mycc.TextValue = Conversions.ToString(value);
  183. break;
  184. case "chartype":
  185. mycc.CharType = Conversions.ToString(value);
  186. break;
  187. case "leftborder":
  188. mycc.LeftBorder = Conversions.ToBoolean(value);
  189. break;
  190. case "rightborder":
  191. mycc.RightBorder = Conversions.ToBoolean(value);
  192. break;
  193. case "topborder":
  194. mycc.TopBorder = Conversions.ToBoolean(value);
  195. break;
  196. case "bottomborder":
  197. mycc.BottomBorder = Conversions.ToBoolean(value);
  198. break;
  199. case "textfont":
  200. mycc.TextFont = (Font)value;
  201. break;
  202. case "textcolor":
  203. {
  204. Color black = Color.Black;
  205. mycc.TextColor = ((value != null) ? ((Color)value) : black);
  206. break;
  207. }
  208. case "margins":
  209. mycc.Margins = Conversions.ToInteger(value);
  210. break;
  211. case "bartype":
  212. mycc.BarType = (BarcodeFormat)Conversions.ToInteger(value);
  213. break;
  214. default:
  215. Interaction.MsgBox("SetValue过程编程错误,属性名称[" + theProp + "]未找到", MsgBoxStyle.OkOnly, "提示信息");
  216. break;
  217. }
  218. }
  219. public override bool ShouldSerializeValue(object component)
  220. {
  221. return false;
  222. }
  223. }
  224. private IContainer components;
  225. private float MYX;
  226. private float MYY;
  227. private bool theisprint;
  228. private float thelinewidth;
  229. private Color thelinecolor;
  230. private Color thefilledcolor;
  231. private Font thetextfont;
  232. private Color thetextcolor;
  233. private string thetext;
  234. private bool theleftborder;
  235. private bool thetopborder;
  236. private bool therightborder;
  237. private bool thebottomborder;
  238. private string mychartype;
  239. private int mymargins;
  240. private BarcodeFormat mybartype;
  241. public string[,] DefineProperty;
  242. [Category("外观")]
  243. [Description("二维码周围的空白大小,以像素为计量单位,必须大于等于0")]
  244. public int Margins
  245. {
  246. get
  247. {
  248. return mymargins;
  249. }
  250. set
  251. {
  252. if (value >= 0)
  253. {
  254. mymargins = value;
  255. }
  256. }
  257. }
  258. [Description("要打印的条码类型)")]
  259. [Category("外观")]
  260. public BarcodeFormat BarType
  261. {
  262. get
  263. {
  264. return mybartype;
  265. }
  266. set
  267. {
  268. mybartype = value;
  269. }
  270. }
  271. [Description("以套打模式打印或预览时,是否打印该控件的内容")]
  272. [Category("行为")]
  273. public bool IsPrint
  274. {
  275. get
  276. {
  277. return theisprint;
  278. }
  279. set
  280. {
  281. theisprint = value;
  282. }
  283. }
  284. [Description("控件所处的X位置,以毫米为计量单位")]
  285. [Category("布局")]
  286. public float X
  287. {
  288. get
  289. {
  290. return ConvertToMM(base.Left, isX: true);
  291. }
  292. set
  293. {
  294. base.Left = checked((int)Math.Round(ConvertFromMM(value, isx: true)));
  295. }
  296. }
  297. [Category("布局")]
  298. [Description("控件所处的Y位置,以毫米为计量单位")]
  299. public float Y
  300. {
  301. get
  302. {
  303. return ConvertToMM(base.Top, isX: false);
  304. }
  305. set
  306. {
  307. base.Top = checked((int)Math.Round(ConvertFromMM(value, isx: false)));
  308. }
  309. }
  310. [Category("布局")]
  311. [Description("控件的宽度,以毫米为计量单位")]
  312. public float EWidth
  313. {
  314. get
  315. {
  316. return ConvertToMM(base.Width, isX: true);
  317. }
  318. set
  319. {
  320. base.Width = checked((int)Math.Round(ConvertFromMM(value, isx: true)));
  321. }
  322. }
  323. [Description("控件的高度,以毫米为计量单位")]
  324. [Category("布局")]
  325. public float EHeight
  326. {
  327. get
  328. {
  329. return ConvertToMM(base.Height, isX: false);
  330. }
  331. set
  332. {
  333. base.Height = checked((int)Math.Round(ConvertFromMM(value, isx: false)));
  334. }
  335. }
  336. [Description("边框线宽度,不是条形码线条的宽度,以毫米为计量单位, 必须大于等于0")]
  337. [Category("外观")]
  338. public float LineWidth
  339. {
  340. get
  341. {
  342. return thelinewidth;
  343. }
  344. set
  345. {
  346. if (value < 0f)
  347. {
  348. value = 0f;
  349. }
  350. thelinewidth = value;
  351. Invalidate();
  352. }
  353. }
  354. [Category("外观")]
  355. [Description("边框线条颜色")]
  356. public Color LineColor
  357. {
  358. get
  359. {
  360. return thelinecolor;
  361. }
  362. set
  363. {
  364. thelinecolor = value;
  365. Invalidate();
  366. }
  367. }
  368. [Description("条形码文字及线条颜色")]
  369. [Category("外观")]
  370. public Color TextColor
  371. {
  372. get
  373. {
  374. return thetextcolor;
  375. }
  376. set
  377. {
  378. thetextcolor = value;
  379. Invalidate();
  380. }
  381. }
  382. [Description("条码填充背景颜色")]
  383. [Category("外观")]
  384. public Color FilledColor
  385. {
  386. get
  387. {
  388. return thefilledcolor;
  389. }
  390. set
  391. {
  392. thefilledcolor = value;
  393. Invalidate();
  394. }
  395. }
  396. [Description("条码字体,指打印在条码下方的条码文本的字体")]
  397. [Browsable(false)]
  398. [Category("外观")]
  399. public Font TextFont
  400. {
  401. get
  402. {
  403. return thetextfont;
  404. }
  405. set
  406. {
  407. if (value != null)
  408. {
  409. thetextfont = (Font)value.Clone();
  410. Invalidate();
  411. }
  412. }
  413. }
  414. [Editor(typeof(U_Editor), typeof(UITypeEditor))]
  415. [Description("要打印的条码内容,可以包含纯文本、系统变量、自定义变量和字段变量的组合。但是,不同的条码是有字符范围限制的,如果字符超出条码范围,则该条码不会被打印")]
  416. [Category("外观")]
  417. public string TextValue
  418. {
  419. get
  420. {
  421. return thetext;
  422. }
  423. set
  424. {
  425. thetext = value;
  426. Invalidate();
  427. }
  428. }
  429. [Description("要打印的二维码的字符编码,比如UTF-8,可以为空,表示默认)")]
  430. [Category("外观")]
  431. public string CharType
  432. {
  433. get
  434. {
  435. return mychartype;
  436. }
  437. set
  438. {
  439. mychartype = value;
  440. }
  441. }
  442. [Description("是否显示左边框")]
  443. [Category("边框")]
  444. public bool LeftBorder
  445. {
  446. get
  447. {
  448. return theleftborder;
  449. }
  450. set
  451. {
  452. theleftborder = value;
  453. Invalidate();
  454. }
  455. }
  456. [Description("是否显示右边框")]
  457. [Category("边框")]
  458. public bool RightBorder
  459. {
  460. get
  461. {
  462. return therightborder;
  463. }
  464. set
  465. {
  466. therightborder = value;
  467. Invalidate();
  468. }
  469. }
  470. [Category("边框")]
  471. [Description("是否显示上边框")]
  472. public bool TopBorder
  473. {
  474. get
  475. {
  476. return thetopborder;
  477. }
  478. set
  479. {
  480. thetopborder = value;
  481. Invalidate();
  482. }
  483. }
  484. [Description("是否显示下边框")]
  485. [Category("边框")]
  486. public bool BottomBorder
  487. {
  488. get
  489. {
  490. return thebottomborder;
  491. }
  492. set
  493. {
  494. thebottomborder = value;
  495. Invalidate();
  496. }
  497. }
  498. [DebuggerNonUserCode]
  499. protected override void Dispose(bool disposing)
  500. {
  501. try
  502. {
  503. if (disposing && components != null)
  504. {
  505. components.Dispose();
  506. if (thetextfont != null)
  507. {
  508. thetextfont.Dispose();
  509. }
  510. }
  511. }
  512. finally
  513. {
  514. base.Dispose(disposing);
  515. }
  516. }
  517. [System.Diagnostics.DebuggerStepThrough]
  518. private void InitializeComponent()
  519. {
  520. base.SuspendLayout();
  521. System.Drawing.SizeF sizeF = new System.Drawing.SizeF(6f, 12f);
  522. base.AutoScaleDimensions = sizeF;
  523. base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  524. this.BackColor = System.Drawing.Color.Transparent;
  525. this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
  526. System.Windows.Forms.Padding margin = new System.Windows.Forms.Padding(0);
  527. base.Margin = margin;
  528. base.Name = "U_QC";
  529. System.Drawing.Size size = new System.Drawing.Size(82, 49);
  530. base.Size = size;
  531. base.ResumeLayout(false);
  532. }
  533. public float ConvertToMM(float tt, bool isX)
  534. {
  535. if (isX)
  536. {
  537. return (float)Math.Round((double)(tt / MYX) * 2.54 * 10.0, 2);
  538. }
  539. return (float)Math.Round((double)(tt / MYY) * 2.54 * 10.0, 2);
  540. }
  541. public float ConvertFromMM(float tt, bool isx)
  542. {
  543. if (isx)
  544. {
  545. return (float)((double)(tt * MYX) / 2.54 / 10.0);
  546. }
  547. return (float)((double)(tt * MYY) / 2.54 / 10.0);
  548. }
  549. public string GetPropertyEnglishName(string cname)
  550. {
  551. bool flag = false;
  552. int num = 0;
  553. checked
  554. {
  555. int num2 = DefineProperty.GetLength(0) - 1;
  556. int i;
  557. for (i = num; i <= num2; i++)
  558. {
  559. if (Operators.CompareString(DefineProperty[i, 1].ToUpper(), cname.ToUpper(), TextCompare: false) == 0)
  560. {
  561. flag = true;
  562. break;
  563. }
  564. }
  565. if (flag)
  566. {
  567. return DefineProperty[i, 0];
  568. }
  569. return cname;
  570. }
  571. }
  572. public string GetPropertyChineseName(string ename)
  573. {
  574. bool flag = false;
  575. int num = 0;
  576. checked
  577. {
  578. int num2 = DefineProperty.GetLength(0) - 1;
  579. int i;
  580. for (i = num; i <= num2; i++)
  581. {
  582. if (Operators.CompareString(DefineProperty[i, 0].ToUpper(), ename.ToUpper(), TextCompare: false) == 0)
  583. {
  584. flag = true;
  585. break;
  586. }
  587. }
  588. if (flag)
  589. {
  590. return DefineProperty[i, 1];
  591. }
  592. return ename;
  593. }
  594. }
  595. protected override void OnPaint(PaintEventArgs e)
  596. {
  597. base.OnPaint(e);
  598. float num = ConvertFromMM(LineWidth, isx: true);
  599. Pen pen = new Pen(LineColor, num);
  600. BackColor = FilledColor;
  601. if (LeftBorder)
  602. {
  603. e.Graphics.DrawLine(pen, num / 2f, num / 2f, num / 2f, (float)base.Height - num - 1f);
  604. }
  605. if (RightBorder)
  606. {
  607. e.Graphics.DrawLine(pen, (float)base.Width - num - 1f, num / 2f, (float)base.Width - num - 1f, (float)base.Height - num - 1f);
  608. }
  609. if (TopBorder)
  610. {
  611. e.Graphics.DrawLine(pen, num / 2f, num / 2f, (float)base.Width - num - 1f, num / 2f);
  612. }
  613. if (BottomBorder)
  614. {
  615. e.Graphics.DrawLine(pen, num / 2f, (float)base.Height - num - 1f, (float)base.Width - num - 1f, (float)base.Height - num - 1f);
  616. }
  617. StringFormat stringFormat = new StringFormat(StringFormat.GenericTypographic);
  618. StringFormatFlags formatFlags = stringFormat.FormatFlags;
  619. formatFlags |= StringFormatFlags.NoWrap;
  620. formatFlags |= StringFormatFlags.NoClip;
  621. formatFlags &= ~StringFormatFlags.DirectionVertical;
  622. stringFormat.FormatFlags = formatFlags;
  623. stringFormat.Alignment = StringAlignment.Near;
  624. stringFormat.LineAlignment = StringAlignment.Near;
  625. Graphics graphics = e.Graphics;
  626. string textValue = TextValue;
  627. Font textFont = TextFont;
  628. Brush brush = new SolidBrush(TextColor);
  629. RectangleF layoutRectangle = new RectangleF(0f, 0f, base.Width, base.Height);
  630. graphics.DrawString(textValue, textFont, brush, layoutRectangle, stringFormat);
  631. }
  632. protected override void OnResize(EventArgs e)
  633. {
  634. base.OnResize(e);
  635. Invalidate();
  636. }
  637. public U_QC()
  638. {
  639. base.Disposed += U_QC_Disposed;
  640. theisprint = true;
  641. thelinewidth = 0f;
  642. thelinecolor = Color.Black;
  643. thefilledcolor = Color.Transparent;
  644. thetextfont = new Font("宋体", 9f);
  645. thetextcolor = Color.Black;
  646. thetext = "二维码";
  647. theleftborder = false;
  648. thetopborder = false;
  649. therightborder = false;
  650. thebottomborder = false;
  651. mychartype = "";
  652. mymargins = 4;
  653. mybartype = BarcodeFormat.QR_CODE;
  654. DefineProperty = new string[3, 2];
  655. InitializeComponent();
  656. MYX = CreateGraphics().DpiX;
  657. MYY = CreateGraphics().DpiY;
  658. DefineProperty = new string[18, 2];
  659. DefineProperty[0, 0] = "IsPrint";
  660. DefineProperty[0, 1] = "是否套打";
  661. DefineProperty[1, 0] = "X";
  662. DefineProperty[1, 1] = "X位置";
  663. DefineProperty[2, 0] = "Y";
  664. DefineProperty[2, 1] = "Y位置";
  665. DefineProperty[3, 0] = "EWidth";
  666. DefineProperty[3, 1] = "宽度";
  667. DefineProperty[4, 0] = "LineWidth";
  668. DefineProperty[4, 1] = "线宽";
  669. DefineProperty[5, 0] = "LineColor";
  670. DefineProperty[5, 1] = "线条颜色";
  671. DefineProperty[6, 0] = "EHeight";
  672. DefineProperty[6, 1] = "高度";
  673. DefineProperty[7, 0] = "FilledColor";
  674. DefineProperty[7, 1] = "填充颜色";
  675. DefineProperty[8, 0] = "TextValue";
  676. DefineProperty[8, 1] = "条码文本";
  677. DefineProperty[9, 0] = "CharType";
  678. DefineProperty[9, 1] = "字符编码";
  679. DefineProperty[10, 0] = "LeftBorder";
  680. DefineProperty[10, 1] = "左边框";
  681. DefineProperty[11, 0] = "RightBorder";
  682. DefineProperty[11, 1] = "右边框";
  683. DefineProperty[12, 0] = "TopBorder";
  684. DefineProperty[12, 1] = "上边框";
  685. DefineProperty[13, 0] = "BottomBorder";
  686. DefineProperty[13, 1] = "下边框";
  687. DefineProperty[14, 0] = "Margins";
  688. DefineProperty[14, 1] = "边界空白";
  689. DefineProperty[15, 0] = "TextFont";
  690. DefineProperty[15, 1] = "字体";
  691. DefineProperty[16, 0] = "TextColor";
  692. DefineProperty[16, 1] = "前景颜色";
  693. DefineProperty[17, 0] = "BarType";
  694. DefineProperty[17, 1] = "条码类型";
  695. }
  696. public AttributeCollection GetAttributes()
  697. {
  698. return TypeDescriptor.GetAttributes(this, noCustomTypeDesc: true);
  699. }
  700. public string GetClassName()
  701. {
  702. return TypeDescriptor.GetClassName(this, noCustomTypeDesc: true);
  703. }
  704. public string GetComponentName()
  705. {
  706. return TypeDescriptor.GetClassName(this, noCustomTypeDesc: true);
  707. }
  708. public TypeConverter GetConverter()
  709. {
  710. return TypeDescriptor.GetConverter(this, noCustomTypeDesc: true);
  711. }
  712. public EventDescriptor GetDefaultEvent()
  713. {
  714. return TypeDescriptor.GetDefaultEvent(this, noCustomTypeDesc: true);
  715. }
  716. public PropertyDescriptor GetDefaultProperty()
  717. {
  718. return TypeDescriptor.GetDefaultProperty(this, noCustomTypeDesc: true);
  719. }
  720. public object GetEditor(Type editorBaseType)
  721. {
  722. return TypeDescriptor.GetEditor(this, editorBaseType, noCustomTypeDesc: true);
  723. }
  724. public EventDescriptorCollection GetEvents()
  725. {
  726. return TypeDescriptor.GetEvents(this, noCustomTypeDesc: true);
  727. }
  728. public EventDescriptorCollection GetEvents(Attribute[] attributes)
  729. {
  730. return TypeDescriptor.GetEvents(this, attributes, noCustomTypeDesc: true);
  731. }
  732. public PropertyDescriptorCollection GetProperties()
  733. {
  734. return TypeDescriptor.GetProperties(this, noCustomTypeDesc: true);
  735. }
  736. public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
  737. {
  738. checked
  739. {
  740. PropertyDescriptor[] array = new PropertyDescriptor[DefineProperty.GetLength(0) - 1 + 1];
  741. int num = 0;
  742. int num2 = array.Length - 1;
  743. for (int i = num; i <= num2; i++)
  744. {
  745. Type type = GetType();
  746. PropertyInfo[] properties = type.GetProperties();
  747. PropertyInfo[] array2 = properties;
  748. foreach (PropertyInfo propertyInfo in array2)
  749. {
  750. if (Operators.CompareString(propertyInfo.Name.ToUpper(), DefineProperty[i, 0].ToUpper(), TextCompare: false) == 0)
  751. {
  752. attributes = Attribute.GetCustomAttributes(propertyInfo);
  753. break;
  754. }
  755. }
  756. array[i] = new XpropDescriptor(this, DefineProperty[i, 1], attributes);
  757. }
  758. return new PropertyDescriptorCollection(array);
  759. }
  760. }
  761. public object GetPropertyOwner(PropertyDescriptor pd)
  762. {
  763. return this;
  764. }
  765. private void U_QC_Disposed(object sender, EventArgs e)
  766. {
  767. try
  768. {
  769. DefineProperty = null;
  770. thetextfont = null;
  771. }
  772. catch (Exception projectError)
  773. {
  774. ProjectData.SetProjectError(projectError);
  775. ProjectData.ClearProjectError();
  776. }
  777. }
  778. public void RestoreFromString(string ss)
  779. {
  780. string[] array = Strings.Split(ss, mbsjmodule.G_MB_Spetator_Proper);
  781. Encoding.GetEncodings();
  782. if (Operators.CompareString(array[0], "1", TextCompare: false) == 0)
  783. {
  784. IsPrint = true;
  785. }
  786. else
  787. {
  788. IsPrint = false;
  789. }
  790. X = Conversions.ToSingle(array[1]);
  791. Y = Conversions.ToSingle(array[2]);
  792. EWidth = Conversions.ToSingle(array[3]);
  793. LineWidth = Conversions.ToSingle(array[4]);
  794. LineColor = Module1.ConvertStringToColor(array[5]);
  795. EHeight = Conversions.ToSingle(array[6]);
  796. LeftBorder = Conversions.ToBoolean(array[7]);
  797. RightBorder = Conversions.ToBoolean(array[8]);
  798. TopBorder = Conversions.ToBoolean(array[9]);
  799. BottomBorder = Conversions.ToBoolean(array[10]);
  800. FilledColor = Module1.ConvertStringToColor(array[11]);
  801. CharType = array[12];
  802. TextFont = Module1.ConvertStringToFont(array[13]);
  803. TextValue = array[14];
  804. TextColor = Module1.ConvertStringToColor(array[15]);
  805. Margins = Conversions.ToInteger(array[16]);
  806. BarType = (BarcodeFormat)Conversions.ToInteger(array[17]);
  807. }
  808. public string SaveAsString()
  809. {
  810. string text = ((!IsPrint) ? "0" : "1");
  811. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(X);
  812. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Y);
  813. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(EWidth);
  814. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(LineWidth);
  815. text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertColorToString(LineColor);
  816. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(EHeight);
  817. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(LeftBorder, "1", "0"));
  818. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(RightBorder, "1", "0"));
  819. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(TopBorder, "1", "0"));
  820. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(BottomBorder, "1", "0"));
  821. text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertColorToString(FilledColor);
  822. text = text + mbsjmodule.G_MB_Spetator_Proper + CharType;
  823. text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertFontToString(TextFont);
  824. text = text + mbsjmodule.G_MB_Spetator_Proper + TextValue;
  825. text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertColorToString(TextColor);
  826. text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Margins);
  827. return text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString((int)BarType);
  828. }
  829. }
  830. }