| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029 |
- using System;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Drawing;
- using System.Drawing.Design;
- using System.Drawing.Printing;
- using System.Reflection;
- using System.Windows.Forms;
- using Microsoft.VisualBasic;
- using Microsoft.VisualBasic.CompilerServices;
- namespace Dongke.IBOSS.PRD.Framework.Controls
- {
- [DesignerGenerated]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [ToolboxItem(false)]
- [Browsable(false)]
- public class U_Text : UserControl, ICustomTypeDescriptor, IControl
- {
- private class XpropDescriptor : PropertyDescriptor
- {
- private string theProp;
- private U_Text mycc;
- public override Type ComponentType => GetType();
- public override bool IsReadOnly => false;
- public override Type PropertyType
- {
- get
- {
- switch (theProp.ToLower())
- {
- case "isprint":
- return mycc.IsPrint.GetType();
- case "x":
- return mycc.X.GetType();
- case "y":
- return mycc.Y.GetType();
- case "ewidth":
- return mycc.EWidth.GetType();
- case "eheight":
- return mycc.EHeight.GetType();
- case "linewidth":
- return mycc.LineWidth.GetType();
- case "linecolor":
- return mycc.LineColor.GetType();
- case "filledcolor":
- return mycc.FilledColor.GetType();
- case "textalign":
- return mycc.TextAlign.GetType();
- case "textvalue":
- return mycc.TextValue.GetType();
- case "textfont":
- return mycc.TextFont.GetType();
- case "textcolor":
- return mycc.TextColor.GetType();
- case "cols":
- return mycc.Cols.GetType();
- case "mulline":
- return mycc.Mulline.GetType();
- case "leftborder":
- return mycc.LeftBorder.GetType();
- case "rightborder":
- return mycc.RightBorder.GetType();
- case "topborder":
- return mycc.TopBorder.GetType();
- case "bottomborder":
- return mycc.BottomBorder.GetType();
- case "margins":
- return mycc.Margins.GetType();
- case "direction":
- return mycc.Direction.GetType();
- case "istdborder":
- return mycc.IsTdBorder.GetType();
- case "istdbackcolor":
- return mycc.IsTdBackColor.GetType();
- default:
- Interaction.MsgBox("Property过程编程错误,属性名称[" + theProp + "]未找到");
- return null;
- }
- }
- }
- public XpropDescriptor(U_Text cc, string prop, Attribute[] attrs)
- : base(prop, attrs)
- {
- theProp = cc.GetPropertyEnglishName(prop);
- mycc = cc;
- }
- public override bool CanResetValue(object component)
- {
- return false;
- }
- public override object GetValue(object component)
- {
- switch (theProp.ToLower())
- {
- case "isprint":
- return mycc.IsPrint;
- case "x":
- return mycc.X;
- case "y":
- return mycc.Y;
- case "ewidth":
- return mycc.EWidth;
- case "eheight":
- return mycc.EHeight;
- case "linewidth":
- return mycc.LineWidth;
- case "linecolor":
- return mycc.LineColor;
- case "filledcolor":
- return mycc.FilledColor;
- case "textalign":
- return mycc.TextAlign;
- case "textvalue":
- return mycc.TextValue;
- case "textfont":
- return mycc.TextFont;
- case "textcolor":
- return mycc.TextColor;
- case "cols":
- return mycc.Cols;
- case "mulline":
- return mycc.Mulline;
- case "leftborder":
- return mycc.LeftBorder;
- case "rightborder":
- return mycc.RightBorder;
- case "topborder":
- return mycc.TopBorder;
- case "bottomborder":
- return mycc.BottomBorder;
- case "margins":
- return mycc.Margins;
- case "direction":
- return mycc.Direction;
- case "istdborder":
- return mycc.IsTdBorder;
- case "istdbackcolor":
- return mycc.IsTdBackColor;
- default:
- Interaction.MsgBox("GetValue过程编程错误,属性名称[" + theProp + "]未找到");
- return null;
- }
- }
- public override void ResetValue(object component)
- {
- }
- public override void SetValue(object component, object value)
- {
- switch (theProp.ToLower())
- {
- case "isprint":
- mycc.IsPrint = Conversions.ToBoolean(value);
- break;
- case "x":
- mycc.X = Conversions.ToSingle(value);
- break;
- case "y":
- mycc.Y = Conversions.ToSingle(value);
- break;
- case "ewidth":
- mycc.EWidth = Conversions.ToSingle(value);
- break;
- case "eheight":
- mycc.EHeight = Conversions.ToSingle(value);
- break;
- case "linewidth":
- mycc.LineWidth = Conversions.ToSingle(value);
- break;
- case "linecolor":
- {
- Color black3 = Color.Black;
- mycc.LineColor = ((value != null) ? ((Color)value) : black3);
- break;
- }
- case "filledcolor":
- {
- Color black2 = Color.Black;
- mycc.FilledColor = ((value != null) ? ((Color)value) : black2);
- break;
- }
- case "textalign":
- mycc.TextAlign = (ContentAlignment)Conversions.ToInteger(value);
- break;
- case "textvalue":
- mycc.TextValue = Conversions.ToString(value);
- break;
- case "textfont":
- mycc.TextFont = (Font)value;
- break;
- case "textcolor":
- {
- Color black = Color.Black;
- mycc.TextColor = ((value != null) ? ((Color)value) : black);
- break;
- }
- case "cols":
- mycc.Cols = Conversions.ToInteger(value);
- break;
- case "mulline":
- mycc.Mulline = Conversions.ToBoolean(value);
- break;
- case "leftborder":
- mycc.LeftBorder = Conversions.ToBoolean(value);
- break;
- case "rightborder":
- mycc.RightBorder = Conversions.ToBoolean(value);
- break;
- case "topborder":
- mycc.TopBorder = Conversions.ToBoolean(value);
- break;
- case "bottomborder":
- mycc.BottomBorder = Conversions.ToBoolean(value);
- break;
- case "margins":
- mycc.Margins = (Margins)value;
- break;
- case "direction":
- mycc.Direction = Conversions.ToBoolean(value);
- break;
- case "istdborder":
- mycc.IsTdBorder = Conversions.ToBoolean(value);
- break;
- case "istdbackcolor":
- mycc.IsTdBackColor = Conversions.ToBoolean(value);
- break;
- default:
- Interaction.MsgBox("SetValue过程编程错误,属性名称[" + theProp + "]未找到");
- break;
- }
- }
- public override bool ShouldSerializeValue(object component)
- {
- return false;
- }
- }
- private IContainer components;
- private float MYX;
- private float MYY;
- private bool theisprint;
- private float thelinewidth;
- private Color thelinecolor;
- private Color thefilledcolor;
- private ContentAlignment thetextalign;
- private string thetext;
- private Font thetextfont;
- private Color thetextcolor;
- private int thecols;
- private bool themulline;
- private bool theleftborder;
- private bool thetopborder;
- private bool therightborder;
- private bool thebottomborder;
- private Margins themargins;
- private bool thedirection;
- private bool theistdborder;
- private bool theistdbackcolor;
- public string[,] DefineProperty;
- [Description("以套打模式打印或预览时,是否打印该控件的背景颜色(填充颜色)")]
- [Category("行为")]
- public bool IsTdBackColor
- {
- get
- {
- return theistdbackcolor;
- }
- set
- {
- theistdbackcolor = value;
- }
- }
- [Description("以套打模式打印或预览时,是否打印该控件的边框(如果设置为显示边框的话)")]
- [Category("行为")]
- public bool IsTdBorder
- {
- get
- {
- return theistdborder;
- }
- set
- {
- theistdborder = value;
- }
- }
- [Description("以套打模式打印或预览时,是否打印该控件的内容")]
- [Category("行为")]
- public bool IsPrint
- {
- get
- {
- return theisprint;
- }
- set
- {
- theisprint = value;
- }
- }
- [Description("控件所处的X位置,以毫米为计量单位")]
- [Category("布局")]
- public float X
- {
- get
- {
- return ConvertToMM(base.Left, isX: true);
- }
- set
- {
- base.Left = checked((int)Math.Round(ConvertFromMM(value, isx: true)));
- }
- }
- [Category("布局")]
- [Description("控件所处的Y位置,以毫米为计量单位")]
- public float Y
- {
- get
- {
- return ConvertToMM(base.Top, isX: false);
- }
- set
- {
- base.Top = checked((int)Math.Round(ConvertFromMM(value, isx: false)));
- }
- }
- [Description("控件的宽度,以毫米为计量单位")]
- [Category("布局")]
- public float EWidth
- {
- get
- {
- return ConvertToMM(base.Width, isX: true);
- }
- set
- {
- base.Width = checked((int)Math.Round(ConvertFromMM(value, isx: true)));
- }
- }
- [Category("布局")]
- [Description("控件的高度,以毫米为计量单位")]
- public float EHeight
- {
- get
- {
- return ConvertToMM(base.Height, isX: false);
- }
- set
- {
- base.Height = checked((int)Math.Round(ConvertFromMM(value, isx: false)));
- }
- }
- [Category("外观")]
- [Description("边线宽度,不是直线的长度,以毫米为计量单位, 必须大于等于0")]
- public float LineWidth
- {
- get
- {
- return thelinewidth;
- }
- set
- {
- if (value < 0f)
- {
- value = 0f;
- }
- thelinewidth = value;
- Invalidate();
- }
- }
- [Description("线条颜色")]
- [Category("外观")]
- public Color LineColor
- {
- get
- {
- return thelinecolor;
- }
- set
- {
- thelinecolor = value;
- Invalidate();
- }
- }
- [Category("外观")]
- [Description("文本背景颜色")]
- public Color FilledColor
- {
- get
- {
- return thefilledcolor;
- }
- set
- {
- thefilledcolor = value;
- Invalidate();
- }
- }
- [Description("文本对齐方式")]
- [Category("外观")]
- public ContentAlignment TextAlign
- {
- get
- {
- return thetextalign;
- }
- set
- {
- thetextalign = value;
- Invalidate();
- }
- }
- [Category("外观")]
- [Description("要打印的文本内容,可以包含纯文本、系统变量、自定义变量和字段变量的组合")]
- [Editor(typeof(U_Editor), typeof(UITypeEditor))]
- public string TextValue
- {
- get
- {
- return thetext;
- }
- set
- {
- thetext = value;
- Invalidate();
- }
- }
- [Description("文本字体")]
- [Category("外观")]
- public Font TextFont
- {
- get
- {
- return thetextfont;
- }
- set
- {
- if (value != null)
- {
- thetextfont = (Font)value.Clone();
- Invalidate();
- }
- }
- }
- [Description("文本前景颜色")]
- [Category("外观")]
- public Color TextColor
- {
- get
- {
- return thetextcolor;
- }
- set
- {
- thetextcolor = value;
- Invalidate();
- }
- }
- [Description("分散打印的列数(为1表示普通打印)")]
- [Category("外观")]
- public int Cols
- {
- get
- {
- return thecols;
- }
- set
- {
- if (value <= 0)
- {
- value = 1;
- }
- thecols = value;
- Invalidate();
- }
- }
- [Category("外观")]
- [Description("文本是否允许自动换行打印)")]
- public bool Mulline
- {
- get
- {
- return themulline;
- }
- set
- {
- themulline = value;
- Invalidate();
- }
- }
- [Description("是否显示左边框")]
- [Category("边框")]
- public bool LeftBorder
- {
- get
- {
- return theleftborder;
- }
- set
- {
- theleftborder = value;
- Invalidate();
- }
- }
- [Description("是否显示右边框")]
- [Category("边框")]
- public bool RightBorder
- {
- get
- {
- return therightborder;
- }
- set
- {
- therightborder = value;
- Invalidate();
- }
- }
- [Category("边框")]
- [Description("是否显示上边框")]
- public bool TopBorder
- {
- get
- {
- return thetopborder;
- }
- set
- {
- thetopborder = value;
- Invalidate();
- }
- }
- [Description("是否显示下边框")]
- [Category("边框")]
- public bool BottomBorder
- {
- get
- {
- return thebottomborder;
- }
- set
- {
- thebottomborder = value;
- Invalidate();
- }
- }
- [Description("单元格文本与边框的间距,计量单位为毫米,且必须是整数")]
- [Category("外观")]
- public Margins Margins
- {
- get
- {
- return themargins;
- }
- set
- {
- themargins = value;
- Invalidate();
- }
- }
- [Description("文本的打印方向,为False表示是从左至右的方向,为True表示从上至下的打印方向")]
- [Category("外观")]
- public bool Direction
- {
- get
- {
- return thedirection;
- }
- set
- {
- thedirection = value;
- Invalidate();
- }
- }
- [DebuggerNonUserCode]
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing && components != null)
- {
- components.Dispose();
- if (thetextfont != null)
- {
- thetextfont.Dispose();
- }
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
- [System.Diagnostics.DebuggerStepThrough]
- private void InitializeComponent()
- {
- base.SuspendLayout();
- System.Drawing.SizeF sizeF = new System.Drawing.SizeF(6f, 12f);
- base.AutoScaleDimensions = sizeF;
- base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.Transparent;
- System.Windows.Forms.Padding margin = new System.Windows.Forms.Padding(0);
- base.Margin = margin;
- base.Name = "U_Text";
- System.Drawing.Size size = new System.Drawing.Size(169, 37);
- base.Size = size;
- base.ResumeLayout(false);
- }
- public float ConvertToMM(float tt, bool isX)
- {
- if (isX)
- {
- return (float)Math.Round((double)(tt / MYX) * 2.54 * 10.0, 2);
- }
- return (float)Math.Round((double)(tt / MYY) * 2.54 * 10.0, 2);
- }
- public float ConvertFromMM(float tt, bool isx)
- {
- if (isx)
- {
- return (float)((double)(tt * MYX) / 2.54 / 10.0);
- }
- return (float)((double)(tt * MYY) / 2.54 / 10.0);
- }
- public string GetPropertyEnglishName(string cname)
- {
- bool flag = false;
- int num = 0;
- checked
- {
- int num2 = DefineProperty.GetLength(0) - 1;
- int i;
- for (i = num; i <= num2; i++)
- {
- if (Operators.CompareString(DefineProperty[i, 1].ToUpper(), cname.ToUpper(), TextCompare: false) == 0)
- {
- flag = true;
- break;
- }
- }
- if (flag)
- {
- return DefineProperty[i, 0];
- }
- return cname;
- }
- }
- public string GetPropertyChineseName(string ename)
- {
- bool flag = false;
- int num = 0;
- checked
- {
- int num2 = DefineProperty.GetLength(0) - 1;
- int i;
- for (i = num; i <= num2; i++)
- {
- if (Operators.CompareString(DefineProperty[i, 0].ToUpper(), ename.ToUpper(), TextCompare: false) == 0)
- {
- flag = true;
- break;
- }
- }
- if (flag)
- {
- return DefineProperty[i, 1];
- }
- return ename;
- }
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- float num = ConvertFromMM(LineWidth, isx: true);
- Pen pen = new Pen(LineColor, num);
- e.Graphics.FillRectangle(new SolidBrush(FilledColor), 0, 0, base.Width, base.Height);
- if (LeftBorder)
- {
- e.Graphics.DrawLine(pen, num / 2f, num / 2f, num / 2f, (float)base.Height - num);
- }
- if (RightBorder)
- {
- e.Graphics.DrawLine(pen, (float)base.Width - num, num / 2f, (float)base.Width - num, (float)base.Height - num / 2f);
- }
- if (TopBorder)
- {
- e.Graphics.DrawLine(pen, num / 2f, num / 2f, (float)base.Width - num, num / 2f);
- }
- if (BottomBorder)
- {
- e.Graphics.DrawLine(pen, num / 2f, (float)base.Height - num, (float)base.Width - num, (float)base.Height - num);
- }
- StringFormat stringFormat = new StringFormat(StringFormat.GenericTypographic);
- StringFormatFlags formatFlags = stringFormat.FormatFlags;
- formatFlags = (Mulline ? (formatFlags & ~StringFormatFlags.NoWrap) : (formatFlags | StringFormatFlags.NoWrap));
- formatFlags |= StringFormatFlags.NoClip;
- formatFlags = ((!Direction) ? (formatFlags & ~StringFormatFlags.DirectionVertical) : (formatFlags | StringFormatFlags.DirectionVertical));
- stringFormat.FormatFlags = formatFlags;
- stringFormat.Alignment = mbsjmodule.GetHalign(TextAlign);
- stringFormat.LineAlignment = mbsjmodule.GetValign(TextAlign);
- Graphics graphics = e.Graphics;
- string textValue = TextValue;
- Font textFont = TextFont;
- Brush brush = new SolidBrush(TextColor);
- checked
- {
- RectangleF layoutRectangle = new RectangleF(ConvertFromMM(Margins.Left, isx: true), ConvertFromMM(Margins.Top, isx: false), (float)base.Width - ConvertFromMM(Margins.Left + Margins.Right, isx: true), (float)base.Height - ConvertFromMM(Margins.Top + Margins.Bottom, isx: false));
- graphics.DrawString(textValue, textFont, brush, layoutRectangle, stringFormat);
- float num2 = (float)((double)base.Width / (double)Cols);
- float num3 = (float)((double)base.Height / (double)Cols);
- if (Direction)
- {
- int num4 = 1;
- int num5 = Cols - 1;
- for (int i = num4; i <= num5; i++)
- {
- float num6 = num3 * (float)i;
- e.Graphics.DrawLine(pen, num / 2f, num6 + num / 2f, base.Width, num6 + num / 2f);
- }
- }
- else
- {
- int num7 = 1;
- int num8 = Cols - 1;
- for (int j = num7; j <= num8; j++)
- {
- float num9 = num2 * (float)j;
- e.Graphics.DrawLine(pen, num9 + num / 2f, 0f, num9 + num / 2f, base.Height);
- }
- }
- }
- }
- protected override void OnResize(EventArgs e)
- {
- base.OnResize(e);
- Invalidate();
- }
- public U_Text()
- {
- base.Disposed += U_Text_Disposed;
- theisprint = true;
- thelinewidth = 0.2f;
- thelinecolor = Color.Black;
- thefilledcolor = Color.Transparent;
- thetextalign = ContentAlignment.MiddleLeft;
- thetext = "文本控件";
- thetextfont = new Font("宋体", 9f);
- thetextcolor = Color.Black;
- thecols = 1;
- themulline = true;
- theleftborder = false;
- thetopborder = false;
- therightborder = false;
- thebottomborder = false;
- themargins = new Margins(1, 1, 0, 0);
- thedirection = false;
- theistdborder = false;
- theistdbackcolor = false;
- DefineProperty = new string[3, 2];
- InitializeComponent();
- MYX = CreateGraphics().DpiX;
- MYY = CreateGraphics().DpiY;
- DefineProperty = new string[22, 2];
- DefineProperty[0, 0] = "IsPrint";
- DefineProperty[0, 1] = "是否套打";
- DefineProperty[1, 0] = "X";
- DefineProperty[1, 1] = "X位置";
- DefineProperty[2, 0] = "Y";
- DefineProperty[2, 1] = "Y位置";
- DefineProperty[3, 0] = "EWidth";
- DefineProperty[3, 1] = "宽度";
- DefineProperty[4, 0] = "LineWidth";
- DefineProperty[4, 1] = "线宽";
- DefineProperty[5, 0] = "LineColor";
- DefineProperty[5, 1] = "线条颜色";
- DefineProperty[6, 0] = "EHeight";
- DefineProperty[6, 1] = "高度";
- DefineProperty[7, 0] = "FilledColor";
- DefineProperty[7, 1] = "填充颜色";
- DefineProperty[8, 0] = "TextAlign";
- DefineProperty[8, 1] = "文本对齐方式";
- DefineProperty[9, 0] = "TextValue";
- DefineProperty[9, 1] = "文本";
- DefineProperty[10, 0] = "TextFont";
- DefineProperty[10, 1] = "字体";
- DefineProperty[11, 0] = "TextColor";
- DefineProperty[11, 1] = "文本颜色";
- DefineProperty[12, 0] = "Cols";
- DefineProperty[12, 1] = "分列打印";
- DefineProperty[13, 0] = "Mulline";
- DefineProperty[13, 1] = "自动换行";
- DefineProperty[14, 0] = "LeftBorder";
- DefineProperty[14, 1] = "左边框";
- DefineProperty[15, 0] = "RightBorder";
- DefineProperty[15, 1] = "右边框";
- DefineProperty[16, 0] = "TopBorder";
- DefineProperty[16, 1] = "上边框";
- DefineProperty[17, 0] = "BottomBorder";
- DefineProperty[17, 1] = "下边框";
- DefineProperty[18, 0] = "Margins";
- DefineProperty[18, 1] = "边距";
- DefineProperty[19, 0] = "Direction";
- DefineProperty[19, 1] = "文本方向";
- DefineProperty[20, 0] = "IsTdBorder";
- DefineProperty[20, 1] = "套打边框";
- DefineProperty[21, 0] = "IsTdBackColor";
- DefineProperty[21, 1] = "套打背景颜色";
- }
- public AttributeCollection GetAttributes()
- {
- return TypeDescriptor.GetAttributes(this, noCustomTypeDesc: true);
- }
- public string GetClassName()
- {
- return TypeDescriptor.GetClassName(this, noCustomTypeDesc: true);
- }
- public string GetComponentName()
- {
- return TypeDescriptor.GetClassName(this, noCustomTypeDesc: true);
- }
- public TypeConverter GetConverter()
- {
- return TypeDescriptor.GetConverter(this, noCustomTypeDesc: true);
- }
- public EventDescriptor GetDefaultEvent()
- {
- return TypeDescriptor.GetDefaultEvent(this, noCustomTypeDesc: true);
- }
- public PropertyDescriptor GetDefaultProperty()
- {
- return TypeDescriptor.GetDefaultProperty(this, noCustomTypeDesc: true);
- }
- public object GetEditor(Type editorBaseType)
- {
- return TypeDescriptor.GetEditor(this, editorBaseType, noCustomTypeDesc: true);
- }
- public EventDescriptorCollection GetEvents()
- {
- return TypeDescriptor.GetEvents(this, noCustomTypeDesc: true);
- }
- public EventDescriptorCollection GetEvents(Attribute[] attributes)
- {
- return TypeDescriptor.GetEvents(this, attributes, noCustomTypeDesc: true);
- }
- public PropertyDescriptorCollection GetProperties()
- {
- return TypeDescriptor.GetProperties(this, noCustomTypeDesc: true);
- }
- public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
- {
- checked
- {
- PropertyDescriptor[] array = new PropertyDescriptor[DefineProperty.GetLength(0) - 1 + 1];
- int num = 0;
- int num2 = array.Length - 1;
- for (int i = num; i <= num2; i++)
- {
- Type type = GetType();
- PropertyInfo[] properties = type.GetProperties();
- PropertyInfo[] array2 = properties;
- foreach (PropertyInfo propertyInfo in array2)
- {
- if (Operators.CompareString(propertyInfo.Name.ToUpper(), DefineProperty[i, 0].ToUpper(), TextCompare: false) == 0)
- {
- attributes = Attribute.GetCustomAttributes(propertyInfo);
- break;
- }
- }
- array[i] = new XpropDescriptor(this, DefineProperty[i, 1], attributes);
- }
- return new PropertyDescriptorCollection(array);
- }
- }
- public object GetPropertyOwner(PropertyDescriptor pd)
- {
- return this;
- }
- private void U_Text_Disposed(object sender, EventArgs e)
- {
- try
- {
- DefineProperty = null;
- thetextfont = null;
- }
- catch (Exception projectError)
- {
- ProjectData.SetProjectError(projectError);
- ProjectData.ClearProjectError();
- }
- }
- public void RestoreFromString(string ss)
- {
- string[] array = Strings.Split(ss, mbsjmodule.G_MB_Spetator_Proper);
- if (Operators.CompareString(array[0], "1", TextCompare: false) == 0)
- {
- IsPrint = true;
- }
- else
- {
- IsPrint = false;
- }
- X = Conversions.ToSingle(array[1]);
- Y = Conversions.ToSingle(array[2]);
- EWidth = Conversions.ToSingle(array[3]);
- LineWidth = Conversions.ToSingle(array[4]);
- LineColor = Module1.ConvertStringToColor(array[5]);
- EHeight = Conversions.ToSingle(array[6]);
- LeftBorder = Conversions.ToBoolean(array[7]);
- RightBorder = Conversions.ToBoolean(array[8]);
- TopBorder = Conversions.ToBoolean(array[9]);
- BottomBorder = Conversions.ToBoolean(array[10]);
- FilledColor = Module1.ConvertStringToColor(array[11]);
- TextAlign = (ContentAlignment)Conversions.ToInteger(array[12]);
- TextFont = Module1.ConvertStringToFont(array[13]);
- TextColor = Module1.ConvertStringToColor(array[14]);
- Cols = Conversions.ToInteger(array[15]);
- Mulline = Conversions.ToBoolean(array[16]);
- Margins = new Margins(Conversions.ToInteger(array[17]), Conversions.ToInteger(array[18]), Conversions.ToInteger(array[19]), Conversions.ToInteger(array[20]));
- TextValue = array[21];
- Direction = Conversions.ToBoolean(array[22]);
- IsTdBorder = Conversions.ToBoolean(array[23]);
- IsTdBackColor = Conversions.ToBoolean(array[24]);
- }
- public string SaveAsString()
- {
- string text = ((!IsPrint) ? "0" : "1");
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(X);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Y);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(EWidth);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(LineWidth);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertColorToString(LineColor);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(EHeight);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(LeftBorder, "1", "0"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(RightBorder, "1", "0"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(TopBorder, "1", "0"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(BottomBorder, "1", "0"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertColorToString(FilledColor);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString((int)TextAlign);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertFontToString(TextFont);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Module1.ConvertColorToString(TextColor);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Cols);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(Mulline, "1", "0"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Margins.Left);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Margins.Right);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Margins.Top);
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Margins.Bottom);
- text = text + mbsjmodule.G_MB_Spetator_Proper + TextValue;
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(Direction, "1", "0"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(IsTdBorder, "1", "0"));
- return text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(IsTdBackColor, "1", "0"));
- }
- }
- }
|