| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097 |
- 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
- {
- [ToolboxItem(false)]
- [Browsable(false)]
- [DesignerGenerated]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class U_Express : UserControl, ICustomTypeDescriptor, IControl
- {
- private class XpropDescriptor : PropertyDescriptor
- {
- private string theProp;
- private U_Express 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();
- case "format":
- return mycc.Format.GetType();
- case "columntype":
- return mycc.ColumnType.GetType();
- default:
- Interaction.MsgBox("Property过程编程错误,属性名称[" + theProp + "]未找到");
- return null;
- }
- }
- }
- public XpropDescriptor(U_Express 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;
- case "columntype":
- return mycc.ColumnType;
- case "format":
- return mycc.Format;
- 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;
- case "format":
- mycc.Format = Conversions.ToString(value);
- break;
- case "columntype":
- mycc.ColumnType = Conversions.ToString(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;
- private string thecolumntype;
- private string theformat;
- private string[,] DefineProperty;
- [Category("行为")]
- [Description("以套打模式打印或预览时,是否打印该控件的背景颜色(填充颜色)")]
- 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)));
- }
- }
- [Category("布局")]
- [Description("控件的宽度,以毫米为计量单位")]
- 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)));
- }
- }
- [Description("边线宽度,不是直线的长度,以毫米为计量单位, 必须大于等于0")]
- [Category("外观")]
- public float LineWidth
- {
- get
- {
- return thelinewidth;
- }
- set
- {
- if (value < 0f)
- {
- value = 0f;
- }
- thelinewidth = value;
- Invalidate();
- }
- }
- [Category("外观")]
- [Description("线条颜色")]
- 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();
- }
- }
- [Editor(typeof(U_Editor_express), typeof(UITypeEditor))]
- [Description("要打印的文本内容,可以包含纯文本、系统变量、自定义变量和字段变量的组合,并可对表达式进行计算")]
- [Category("外观")]
- 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();
- }
- }
- [Category("外观")]
- [Description("分散打印的列数(为1表示普通打印)")]
- public int Cols
- {
- get
- {
- return thecols;
- }
- set
- {
- if (value <= 0)
- {
- value = 1;
- }
- thecols = value;
- Invalidate();
- }
- }
- [Description("文本是否允许自动换行打印)")]
- [Category("外观")]
- public bool Mulline
- {
- get
- {
- return themulline;
- }
- set
- {
- themulline = value;
- Invalidate();
- }
- }
- [Category("边框")]
- [Description("是否显示左边框")]
- 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();
- }
- }
- [Category("外观")]
- [Description("单元格文本与边框的间距,计量单位为毫米,且必须是整数")]
- public Margins Margins
- {
- get
- {
- return themargins;
- }
- set
- {
- themargins = value;
- Invalidate();
- }
- }
- [Category("外观")]
- [Description("文本的打印方向,为False表示是从左至右的方向,为True表示从上至下的打印方向")]
- public bool Direction
- {
- get
- {
- return thedirection;
- }
- set
- {
- thedirection = value;
- Invalidate();
- }
- }
- [Description("表达式结果的显示格式,设计时不应用,打印或预览时才应用格式,仅对日期和数字两种数据格式有效")]
- [Category("格式")]
- public string Format
- {
- get
- {
- return theformat;
- }
- set
- {
- theformat = value;
- }
- }
- [Category("格式")]
- [Description("表达式结果的数据类型,该属性用于 显示格式 属性。")]
- [TypeConverter(typeof(mbsjmodule.StrChoice3))]
- public string ColumnType
- {
- get
- {
- return thecolumntype;
- }
- set
- {
- thecolumntype = value;
- }
- }
- [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_Express";
- 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_Express()
- {
- base.Disposed += U_Express_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;
- thecolumntype = "";
- theformat = "";
- DefineProperty = new string[3, 2];
- InitializeComponent();
- MYX = CreateGraphics().DpiX;
- MYY = CreateGraphics().DpiY;
- DefineProperty = new string[24, 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] = "套打背景颜色";
- DefineProperty[22, 0] = "Format";
- DefineProperty[22, 1] = "显示格式";
- DefineProperty[23, 0] = "ColumnType";
- DefineProperty[23, 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_Express_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(Interaction.IIf(Operators.CompareString(array[7], "1", TextCompare: false) == 0, true, false));
- RightBorder = Conversions.ToBoolean(Interaction.IIf(Operators.CompareString(array[8], "1", TextCompare: false) == 0, true, false));
- TopBorder = Conversions.ToBoolean(Interaction.IIf(Operators.CompareString(array[9], "1", TextCompare: false) == 0, true, false));
- BottomBorder = Conversions.ToBoolean(Interaction.IIf(Operators.CompareString(array[10], "1", TextCompare: false) == 0, true, false));
- 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(Interaction.IIf(Operators.CompareString(array[16], "1", TextCompare: false) == 0, true, false));
- 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(Interaction.IIf(Operators.CompareString(array[22], "1", TextCompare: false) == 0, true, false));
- IsTdBorder = Conversions.ToBoolean(Interaction.IIf(Operators.CompareString(array[23], "1", TextCompare: false) == 0, true, false));
- IsTdBackColor = Conversions.ToBoolean(Interaction.IIf(Operators.CompareString(array[24], "1", TextCompare: false) == 0, true, false));
- try
- {
- if (array.Length == 27)
- {
- Format = array[25];
- ColumnType = array[26];
- }
- }
- catch (Exception projectError)
- {
- ProjectData.SetProjectError(projectError);
- ProjectData.ClearProjectError();
- }
- }
- 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"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Conversions.ToString(Interaction.IIf(IsTdBackColor, "1", "0"));
- text = text + mbsjmodule.G_MB_Spetator_Proper + Format;
- return text + mbsjmodule.G_MB_Spetator_Proper + ColumnType;
- }
- }
- }
|