mbsjmodule.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Runtime.CompilerServices;
  6. using System.Windows.Forms;
  7. using Microsoft.VisualBasic;
  8. using Microsoft.VisualBasic.CompilerServices;
  9. namespace Dongke.IBOSS.PRD.Framework.Controls
  10. {
  11. [StandardModule]
  12. internal sealed class mbsjmodule
  13. {
  14. public class StrChoice2 : StringConverter
  15. {
  16. private StandardValuesCollection thevalues;
  17. private StandardValuesCollection values
  18. {
  19. get
  20. {
  21. if (thevalues == null)
  22. {
  23. thevalues = new StandardValuesCollection(FieldsString);
  24. }
  25. return thevalues;
  26. }
  27. }
  28. public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
  29. {
  30. return true;
  31. }
  32. public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
  33. {
  34. return false;
  35. }
  36. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
  37. {
  38. return values;
  39. }
  40. }
  41. public class StrChoice : StringConverter
  42. {
  43. private StandardValuesCollection thevalues;
  44. private StandardValuesCollection values
  45. {
  46. get
  47. {
  48. checked
  49. {
  50. if (thevalues == null)
  51. {
  52. if (FieldsString == null)
  53. {
  54. return null;
  55. }
  56. int num = FieldsString.Length;
  57. string[] array = new string[num - 1 + 1];
  58. int num2 = 0;
  59. int num3 = FieldsString.Length - 1;
  60. for (int i = num2; i <= num3; i++)
  61. {
  62. array[i] = FieldsString[i];
  63. }
  64. thevalues = new StandardValuesCollection(array);
  65. }
  66. return thevalues;
  67. }
  68. }
  69. }
  70. public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
  71. {
  72. return true;
  73. }
  74. public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
  75. {
  76. return false;
  77. }
  78. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
  79. {
  80. return values;
  81. }
  82. }
  83. public class StrChoice3 : StringConverter
  84. {
  85. private StandardValuesCollection thevalues;
  86. private StandardValuesCollection values
  87. {
  88. get
  89. {
  90. if (thevalues == null)
  91. {
  92. thevalues = new StandardValuesCollection(new string[3] { "", "数字", "日期时间" });
  93. }
  94. return thevalues;
  95. }
  96. }
  97. public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
  98. {
  99. return true;
  100. }
  101. public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
  102. {
  103. return false;
  104. }
  105. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
  106. {
  107. return values;
  108. }
  109. }
  110. public static string[] FieldsString;
  111. public static string[,] FieldsString2 = new string[1, 2];
  112. public static string G_MB_Spetator_Band = "\u0001\u0003";
  113. public static string G_MB_Spetator_Line = "\u0002\u0004";
  114. public static string G_MB_Spetator_Proper = "\u0005\a";
  115. public static string G_MB_Spetator_control = "\u0006\b";
  116. public static string G_MB_Spetator_BandContent = "\n\v";
  117. public static float G_MB_Default_Width = 170f;
  118. public static mywait G_WaitWindow;
  119. public static string[,] ParaseVar(Hashtable myvar)
  120. {
  121. if (myvar == null)
  122. {
  123. return null;
  124. }
  125. int count = myvar.Count;
  126. if (count <= 0)
  127. {
  128. return null;
  129. }
  130. checked
  131. {
  132. string[,] array = new string[count - 1 + 1, 2];
  133. int num = 0;
  134. IDictionaryEnumerator enumerator = myvar.GetEnumerator();
  135. while (enumerator.MoveNext())
  136. {
  137. object current = enumerator.Current;
  138. DictionaryEntry dictionaryEntry = default(DictionaryEntry);
  139. DictionaryEntry dictionaryEntry2 = ((current != null) ? ((DictionaryEntry)current) : dictionaryEntry);
  140. array[num, 0] = Conversions.ToString(dictionaryEntry2.Key);
  141. array[num, 1] = Conversions.ToString(dictionaryEntry2.Value);
  142. num++;
  143. }
  144. return array;
  145. }
  146. }
  147. public static void ShowWaitWindow()
  148. {
  149. if (G_WaitWindow != null)
  150. {
  151. try
  152. {
  153. G_WaitWindow.Close();
  154. G_WaitWindow.Dispose();
  155. G_WaitWindow = null;
  156. }
  157. catch (Exception projectError)
  158. {
  159. ProjectData.SetProjectError(projectError);
  160. ProjectData.ClearProjectError();
  161. }
  162. }
  163. G_WaitWindow = new mywait();
  164. Application.DoEvents();
  165. G_WaitWindow.Show();
  166. Application.DoEvents();
  167. }
  168. public static void CloseWaitWindow()
  169. {
  170. if (G_WaitWindow != null)
  171. {
  172. try
  173. {
  174. G_WaitWindow.Close();
  175. G_WaitWindow.Dispose();
  176. G_WaitWindow = null;
  177. }
  178. catch (Exception projectError)
  179. {
  180. ProjectData.SetProjectError(projectError);
  181. ProjectData.ClearProjectError();
  182. }
  183. }
  184. }
  185. [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  186. public static void MyShowHelp(string tt)
  187. {
  188. if (Operators.CompareString(tt, "", TextCompare: false) == 0)
  189. {
  190. tt = "start.htm";
  191. }
  192. }
  193. public static StringAlignment GetValign(ContentAlignment alg)
  194. {
  195. switch (alg)
  196. {
  197. default:
  198. return StringAlignment.Center;
  199. case ContentAlignment.TopLeft:
  200. case ContentAlignment.TopCenter:
  201. case ContentAlignment.TopRight:
  202. return StringAlignment.Near;
  203. case ContentAlignment.MiddleLeft:
  204. case ContentAlignment.MiddleCenter:
  205. case ContentAlignment.MiddleRight:
  206. return StringAlignment.Center;
  207. case ContentAlignment.BottomLeft:
  208. case ContentAlignment.BottomCenter:
  209. case ContentAlignment.BottomRight:
  210. return StringAlignment.Far;
  211. }
  212. }
  213. public static StringAlignment GetHalign(ContentAlignment alg)
  214. {
  215. switch (alg)
  216. {
  217. default:
  218. return StringAlignment.Near;
  219. case ContentAlignment.TopRight:
  220. case ContentAlignment.MiddleRight:
  221. case ContentAlignment.BottomRight:
  222. return StringAlignment.Far;
  223. case ContentAlignment.TopLeft:
  224. case ContentAlignment.MiddleLeft:
  225. case ContentAlignment.BottomLeft:
  226. return StringAlignment.Near;
  227. case ContentAlignment.TopCenter:
  228. case ContentAlignment.MiddleCenter:
  229. case ContentAlignment.BottomCenter:
  230. return StringAlignment.Center;
  231. }
  232. }
  233. public static string SaveControl(Control cc)
  234. {
  235. string result = "";
  236. if (cc is U_Field)
  237. {
  238. result = ((U_Field)cc).SaveAsString();
  239. result = "字段" + G_MB_Spetator_control + result;
  240. }
  241. else if (cc is U_Text)
  242. {
  243. result = ((U_Text)cc).SaveAsString();
  244. result = "文本" + G_MB_Spetator_control + result;
  245. }
  246. else if (cc is U_Comput)
  247. {
  248. result = ((U_Comput)cc).SaveAsString();
  249. result = "计算" + G_MB_Spetator_control + result;
  250. }
  251. else if (cc is U_Image)
  252. {
  253. result = ((U_Image)cc).SaveAsString();
  254. result = "图片" + G_MB_Spetator_control + result;
  255. }
  256. else if (cc is U_Rect)
  257. {
  258. result = ((U_Rect)cc).SaveAsString();
  259. result = "矩形" + G_MB_Spetator_control + result;
  260. }
  261. else if (cc is U_HLine)
  262. {
  263. result = ((U_HLine)cc).SaveAsString();
  264. result = "水平" + G_MB_Spetator_control + result;
  265. }
  266. else if (cc is U_VLine)
  267. {
  268. result = ((U_VLine)cc).SaveAsString();
  269. result = "垂直" + G_MB_Spetator_control + result;
  270. }
  271. else if (cc is U_Bar)
  272. {
  273. result = ((U_Bar)cc).SaveAsString();
  274. result = "条码" + G_MB_Spetator_control + result;
  275. }
  276. else if (cc is U_Bias)
  277. {
  278. result = ((U_Bias)cc).SaveAsString();
  279. result = "斜线" + G_MB_Spetator_control + result;
  280. }
  281. else if (cc is U_Express)
  282. {
  283. result = ((U_Express)cc).SaveAsString();
  284. result = "表达式" + G_MB_Spetator_control + result;
  285. }
  286. else if (cc is U_Ellipse)
  287. {
  288. result = ((U_Ellipse)cc).SaveAsString();
  289. result = "椭圆" + G_MB_Spetator_control + result;
  290. }
  291. else if (cc is U_fBias)
  292. {
  293. result = ((U_fBias)cc).SaveAsString();
  294. result = "反斜线" + G_MB_Spetator_control + result;
  295. }
  296. else if (cc is U_QC)
  297. {
  298. result = ((U_QC)cc).SaveAsString();
  299. result = "二维码" + G_MB_Spetator_control + result;
  300. }
  301. return result;
  302. }
  303. public static Control RestoreControl(string ss)
  304. {
  305. string[] array = Strings.Split(ss, G_MB_Spetator_control);
  306. Control result = null;
  307. switch (array[0])
  308. {
  309. case "字段":
  310. {
  311. U_Field u_Field = new U_Field();
  312. u_Field.RestoreFromString(array[1]);
  313. return u_Field;
  314. }
  315. case "文本":
  316. {
  317. U_Text u_Text = new U_Text();
  318. u_Text.RestoreFromString(array[1]);
  319. return u_Text;
  320. }
  321. case "计算":
  322. {
  323. U_Comput u_Comput = new U_Comput();
  324. u_Comput.RestoreFromString(array[1]);
  325. return u_Comput;
  326. }
  327. case "图片":
  328. {
  329. U_Image u_Image = new U_Image();
  330. u_Image.RestoreFromString(array[1]);
  331. return u_Image;
  332. }
  333. case "矩形":
  334. {
  335. U_Rect u_Rect = new U_Rect();
  336. u_Rect.RestoreFromString(array[1]);
  337. return u_Rect;
  338. }
  339. case "水平":
  340. {
  341. U_HLine u_HLine = new U_HLine();
  342. u_HLine.RestoreFromString(array[1]);
  343. return u_HLine;
  344. }
  345. case "垂直":
  346. {
  347. U_VLine u_VLine = new U_VLine();
  348. u_VLine.RestoreFromString(array[1]);
  349. return u_VLine;
  350. }
  351. case "条码":
  352. {
  353. U_Bar u_Bar = new U_Bar();
  354. u_Bar.RestoreFromString(array[1]);
  355. return u_Bar;
  356. }
  357. case "斜线":
  358. {
  359. U_Bias u_Bias = new U_Bias();
  360. u_Bias.RestoreFromString(array[1]);
  361. return u_Bias;
  362. }
  363. case "表达式":
  364. {
  365. U_Express u_Express = new U_Express();
  366. u_Express.RestoreFromString(array[1]);
  367. return u_Express;
  368. }
  369. case "椭圆":
  370. {
  371. U_Ellipse u_Ellipse = new U_Ellipse();
  372. u_Ellipse.RestoreFromString(array[1]);
  373. return u_Ellipse;
  374. }
  375. case "反斜线":
  376. {
  377. U_fBias u_fBias = new U_fBias();
  378. u_fBias.RestoreFromString(array[1]);
  379. return u_fBias;
  380. }
  381. case "二维码":
  382. {
  383. U_QC u_QC = new U_QC();
  384. u_QC.RestoreFromString(array[1]);
  385. return u_QC;
  386. }
  387. default:
  388. return result;
  389. }
  390. }
  391. }
  392. }