예제 #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);
     }
 }
예제 #2
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);
        }
예제 #3
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);
            }
        }
예제 #4
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;
        }