CommonFunction.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. 
  2. namespace UFIDA.U9.Cust.Kusi.Plugin.UI
  3. {
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. using System.Collections.Specialized;
  8. using UFSoft.UBF.UI.ControlModel;
  9. using UFSoft.UBF.UI.WebControlAdapter;
  10. using UFSoft.UBF.UI.WebControls.ClientCallBack;
  11. using UFSoft.UBF.UI.WebControls.Association;
  12. using System.Web.UI.WebControls.WebParts;
  13. using UFSoft.UBF.UI.IView;
  14. using System.Web.UI;
  15. using System.Web.UI.WebControls;
  16. using UFSoft.UBF.UI.Controls;
  17. using UFSoft.UBF.UI.WebControls;
  18. public partial class TemplateClass
  19. {
  20. public class CommonFunction
  21. {
  22. public static void Layout(IContainer container, IUFControl ctrl, uint x, uint y)
  23. {
  24. Layout(container, ctrl, x, y, 1, 1, Unit.Pixel(0), Unit.Pixel(0), true);
  25. }
  26. public static void Layout(IContainer container, IUFControl ctrl, uint x, uint y, int width, int height)
  27. {
  28. Layout(container, ctrl, x, y, 1, 1, Unit.Pixel(width), Unit.Pixel(height), false);
  29. }
  30. public static void Layout(IContainer container, IUFControl ctrl, uint x, uint y, int xspan, int yspan,
  31. Unit width, Unit height, bool isAutoSize)
  32. {
  33. IGridLayout gl = container.Layout as IGridLayout;
  34. if (gl == null) return;
  35. GridLayoutInfo glInfo = new GridLayoutInfo((uint)x, (uint)y, (uint)xspan, (uint)yspan, width, height);
  36. glInfo.AutoSize = isAutoSize;
  37. gl.Controls.Add((Control)ctrl, glInfo);
  38. }
  39. public static IUFControl FindControl(IPart part,string parentControl, string control)
  40. {
  41. IUFCard card = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, parentControl);
  42. if (card == null)
  43. return null;
  44. foreach (IUFControl ctrl in card.Controls)
  45. {
  46. if (ctrl.ID.Equals(control, StringComparison.OrdinalIgnoreCase))
  47. {
  48. return ctrl;
  49. }
  50. }
  51. return null;
  52. }
  53. }
  54. }
  55. }