Esempio n. 1
0
 protected DrawText(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     try
     {
         _shapeoutline           = new ShapeOutline(this);
         _shapefill              = new ShapeFill(this);
         this.ShapeType          = STATIC_OBJ_TYPE.ID_TEXT;
         TextValue               = info.GetString("TextValue");
         font                    = FontXmlConverter.ConvertToFont(info.GetString("font"));
         Orientation             = (TextOrientation)info.GetInt32("Orientation");
         TextBlinking            = info.GetBoolean("TextBlinking");
         textAlignment           = (TextAlignment)info.GetInt32("textAlignment");
         IsFix                   = info.GetBoolean("IsFix");
         TextColor               = (Color)info.GetValue("TextColor", TextColor.GetType());
         _shapefill.FillColor    = info.GetString("ShapeFill");
         _shapeoutline.LineStyle = info.GetString("shapeoutline");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 2
0
 protected override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     base.GetObjectData(info, context);
     info.AddValue("TextValue", TextValue);
     info.AddValue("font", FontXmlConverter.ConvertToString(font));
     info.AddValue("Orientation", (int)Orientation);
     info.AddValue("TextBlinking", TextBlinking);
     info.AddValue("textAlignment", (int)textAlignment);
     info.AddValue("IsFix", IsFix);
     info.AddValue("TextColor", TextColor);
     info.AddValue("ShapeFill", _shapefill.FillColor);
     info.AddValue("shapeoutline", _shapeoutline.LineStyle);
 }
Esempio n. 3
0
        //public void init(tblADText sqltable)
        public override bool Load(object obj)
        {
            bool ret = true;

            Dirty     = false;
            sqltable  = (tblADText)obj;
            SQLID     = sqltable.ID;
            oIndex    = sqltable.oIndex;
            NewObject = false;

            //this.Rectangle = new Rectangle(sqltable.Left, sqltable.Top, sqltable.Right - sqltable.Left, sqltable.Bottom - sqltable.Top);
            this.rectangle = GetNormalizedRectangle(sqltable.Left, sqltable.Top, sqltable.Right, sqltable.Bottom);
            this.Format    = (TextFormat)sqltable.Format;
            //this.Alignment = (TextAlignment) sqltable.Alignment;
            this.TextValue              = sqltable.TextValue;
            this.TextColor              = sqltable.TextColor;
            this.TextBlinking           = sqltable.TextBlinking;
            this.shapefill.FillColor    = sqltable.FillColor;
            this.shapeoutline.LineStyle = sqltable.LineStyle;
            this.Orientation            = (TextOrientation)sqltable.Orientation;

            //System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(typeof(Font));

            //this.font = (Font)converter.ConvertFromString(sqltable.Font);
            this.font = FontXmlConverter.ConvertToFont(sqltable.Font);


            this.TextValue    = sqltable.TextValue;
            this.TextColor    = sqltable.TextColor;
            this.TextBlinking = sqltable.TextBlinking;

            this.isfix = sqltable.isfix;

            this.LastRev = sqltable.LastRev;
#if EWSAPP
            drawexpressionCollection.DisplayObjectParametersstr       = sqltable.Argument;
            drawexpressionCollection.DisplayObjectDynamicPropertysstr = sqltable.Expression;
            drawexpressionCollection.DisplayObjectEventHandlersstr    = sqltable.Action;
#endif
#if OWSAPP
            if (sqltable.validexpression)
            {
                loadDrawExpressionCollection(sqltable.CompiledExp);
                UpdateHasExpression();
            }
#endif

            return(ret);
        }
Esempio n. 4
0
        private void DrawButton(objectsCommand btn, Graphics g)
        {
            var loc = btn.location.Split(',');
            var sz  = btn.size.Split('x');
            var x   = Convert.ToInt32(loc[0]);
            var y   = Convert.ToInt32(loc[1]);
            var w   = Convert.ToInt32(sz[0]);
            var h   = Convert.ToInt32(sz[1]);

            using (var b = new SolidBrush(btn.backcolor.ToColor()))
            {
                g.FillRectangle(b, x, y, w, h);
            }

            var p = btn == _flashButton ? new Pen(Color.Red, 2) : new Pen(Color.DarkGray);

            g.DrawRectangle(p, x, y, w, h);
            p.Dispose();

            var f = FontXmlConverter.ConvertToFont(btn.font);
            var n = btn.name;

            if (n.StartsWith("cmd_"))
            {
                n = LocRm.GetString(n);
            }
            var ts = g.MeasureString(n, f);
            var fx = Convert.ToInt32(w / 2d - ts.Width / 2);
            var fy = Convert.ToInt32(h / 2d - ts.Height / 2);

            using (var b = new SolidBrush(btn.color.ToColor()))
            {
                g.DrawString(n, f, b, x + fx, y + fy);
            }
            if (_editing == btn)
            {
                g.FillEllipse(Brushes.Blue, x + w - 10, y + h - 10, 20, 20);
            }
        }
Esempio n. 5
0
        private void EditCommandButton_Load(object sender, EventArgs e)
        {
            CustomFont = FontXmlConverter.ConvertToFont(CMD.font);
            color      = CMD.color.ToColor();
            backColor  = CMD.backcolor.ToColor();
            var s = CMD.size.Split('x');

            numW.Value = Convert.ToInt32(s[0]);
            numH.Value = Convert.ToInt32(s[1]);
            var l = CMD.location.Split(',');

            locX.Value = Convert.ToInt32(l[0]);
            locY.Value = Convert.ToInt32(l[1]);

            var n = CMD.name;

            if (n.StartsWith("cmd_"))
            {
                n = LocRm.GetString(n);
            }
            lblCommand.Text = n;
        }
Esempio n. 6
0
        public override bool Save(long _id, int _no)
        {
            try
            {
#if EWSAPP
                sqltable.oIndex    = _no;
                sqltable.DisplayID = _id;
                sqltable.Layer     = (int)Layer;
                sqltable.Left      = rectangle.Left;
                sqltable.Right     = rectangle.Right;
                sqltable.Top       = rectangle.Top;
                sqltable.Bottom    = rectangle.Bottom;

                sqltable.Format       = (int)this.Format;
                sqltable.Alignment    = (byte)this.textAlignment;
                sqltable.TextValue    = this.TextValue;
                sqltable.TextColor    = this.TextColor;
                sqltable.TextBlinking = this.TextBlinking;
                sqltable.FillColor    = this.shapefill.FillColor;
                sqltable.LineStyle    = this.shapeoutline.LineStyle;
                //FontConverter cvt = new FontConverter();
                //sqltable.Font = cvt.ConvertToString(this.font);
                sqltable.Font     = FontXmlConverter.ConvertToString(this.font);
                sqltable.UnitShow = this.UnitShow;
                //cvt = new FontConverter();
                //sqltable.UnitFont = cvt.ConvertToString(this.UnitFont);
                //sqltable.UnitColor = this.UnitColor;

                sqltable.TextValue    = this.TextValue;
                sqltable.TextColor    = this.TextColor;
                sqltable.TextBlinking = this.TextBlinking;
                sqltable.isfix        = this.isfix;
                sqltable.Orientation  = (int)this.Orientation;
                sqltable.LastRev      = this.LastRev;
                sqltable.Argument     = drawexpressionCollection.DisplayObjectParametersstr;
                sqltable.Expression   = drawexpressionCollection.DisplayObjectDynamicPropertysstr;
                sqltable.Action       = drawexpressionCollection.DisplayObjectEventHandlersstr;
                if (drawexpressionCollection.CompileGraphicDispalyExpressions(((TabDisplayPageControl)Parentpagelist.Parenttabgraphicpagecontrol).tbldisplay))
                {
                    sqltable.validexpression = true;
                    sqltable.CompiledExp     = drawexpressionCollection.SaveCompiledExpressions();
                }
                else
                {
                    sqltable.validexpression = false;
                }
                if (sqltable.ID == -1)
                {
                    sqltable.Insert();
                    SQLID = sqltable.ID;
                }
                else
                {
                    sqltable.Update();
                }
                Dirty = false;
#endif
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }