Пример #1
0
        void IReflectorPersistance.Save(System.Xml.XmlWriter w)
        {
            w.WriteStartElement("TextLabel");
            w.WriteAttributeString("Color", Convert.ToString(_textcolor.ToArgb()));
            w.WriteAttributeString("BackColor", Convert.ToString(BackColor.ToArgb()));
            if (font != null)
            {
                w.WriteAttributeString("Font", font.Name);
            }
            w.WriteAttributeString("Text", text);
            if (centered)
            {
                w.WriteAttributeString("Align", "Center");
            }
            else if (right_just)
            {
                w.WriteAttributeString("Align", "Right");
            }
            else
            {
                w.WriteAttributeString("Align", "Left");
            }

            w.WriteEndElement();
            w.WriteRaw("\r\n");
            //throw new Exception( "The method or operation is not implemented." );
        }
Пример #2
0
        private SQLiteParameter[] GetSqlParameters()
        {
            List <SQLiteParameter> SqlParmColl = new List <SQLiteParameter>();

            try
            {
                SqlParmColl.Add(CommonDB.AddSqlParm("@ID", ID, DbType.Int64));
                SqlParmColl.Add(CommonDB.AddSqlParm("@DisplayID", DisplayID, DbType.Int64));
                SqlParmColl.Add(CommonDB.AddSqlParm("@oIndex", oIndex, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Left", Left, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Right", Right, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Top", Top, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Bottom", Bottom, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@ButtonText", ButtonText, DbType.String));
                SqlParmColl.Add(CommonDB.AddSqlParm("@BackColor", BackColor.ToArgb(), DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Font", Font, DbType.String));
                SqlParmColl.Add(CommonDB.AddSqlParm("@FontColor", FontColor.ToArgb(), DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@NavigateTo", NavigateTo, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@IsTransparent", IsTransparent, DbType.Boolean));
                SqlParmColl.Add(CommonDB.AddSqlParm("@LastRev", LastRev, DbType.Boolean));
                SqlParmColl.Add(CommonDB.AddSqlParm("@CompiledExp", CompiledExp, DbType.Binary));
                return(SqlParmColl.ToArray());
            }
            catch (SQLiteException Exc)
            {
                throw Exc;
            }
        }
Пример #3
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("BackColor", BackColor.ToArgb().ToString());
            info.AddValue("Clip", Clip);
            info.AddValue("GradientMode", Convert.ToInt32(GradientMode).ToString());
            info.AddValue("GradientColor", GradientColor.ToArgb().ToString());
            info.AddValue("DrawGradient", DrawGradient);
            info.AddValue("DrawBorder", DrawBorder);
            info.AddValue("DrawBackground", DrawBackground);
            info.AddValue("Location", Serialize.AddPointF(Location));
            info.AddValue("InternalRectangle", Serialize.AddRectangleF(InternalRectangle));

            if (Label != null)
            {
                info.AddValue("Label", Label);
            }
            if (Image != null)
            {
                info.AddValue("Image", Image);
            }
            if (StencilItem != null)
            {
                info.AddValue("StencilItem", StencilItem);
            }
            if (Rotation != 0)
            {
                info.AddValue("Rotation", Rotation);
            }

            base.GetObjectData(info, context);
        }
Пример #4
0
        //----------------------------------------
        protected override CResultAErreur MySerialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            result = base.MySerialize(serializer);
            if (!result)
            {
                return(result);
            }

            int nCol = BackColor.ToArgb();

            serializer.TraiteInt(ref nCol);
            m_backColor = Color.FromArgb(nCol);

            nCol = ForeColor.ToArgb();
            serializer.TraiteInt(ref nCol);
            m_foreColor = Color.FromArgb(nCol);

            int nBorder = (int)BorderStyle;

            serializer.TraiteInt(ref nBorder);
            BorderStyle = (EBorderStyle)nBorder;

            result = serializer.TraiteListe <I2iObjetGraphique>(m_listeChilds);

            return(result);
        }
Пример #5
0
        private FormGuide(string url, Form owner)
        {
            InitializeComponent();

            Text = Program.BrandName + " Guide";

            if (owner != null)
            {
                Size            = new Size(owner.Size.Width * 3 / 4, owner.Size.Height * 3 / 4);
                VisibleChanged += (sender, args) => this.MoveToCenter(owner);
            }

            this.browser = new ChromiumWebBrowser(url)
            {
                MenuHandler     = new ContextMenuGuide(),
                JsDialogHandler = new JavaScriptDialogHandler(),
                LifeSpanHandler = new LifeSpanHandler(),
                RequestHandler  = new RequestHandlerBrowser()
            };

            browser.LoadingStateChanged += browser_LoadingStateChanged;
            browser.FrameLoadStart      += browser_FrameLoadStart;

            browser.BrowserSettings.BackgroundColor = (uint)BackColor.ToArgb();
            browser.Dock     = DockStyle.None;
            browser.Location = ControlExtensions.InvisibleLocation;
            Controls.Add(browser);

            Disposed += (sender, args) => {
                Program.UserConfig.ZoomLevelChanged -= Config_ZoomLevelChanged;
                browser.Dispose();
            };

            Program.UserConfig.ZoomLevelChanged += Config_ZoomLevelChanged;
        }
Пример #6
0
        private SQLiteParameter[] GetSqlParameters()
        {
            List <SQLiteParameter> SqlParmColl = new List <SQLiteParameter>();

            try
            {
                SqlParmColl.Add(CommonDB.AddSqlParm("@ID", ID, DbType.Int64));
                SqlParmColl.Add(CommonDB.AddSqlParm("@DisplayID", DisplayID, DbType.Int64));
                SqlParmColl.Add(CommonDB.AddSqlParm("@oIndex", oIndex, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@DlgType", DlgType, DbType.Byte));
                SqlParmColl.Add(CommonDB.AddSqlParm("@DlgIndex", DlgIndex, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Left", Left, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Right", Right, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Top", Top, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Bottom", Bottom, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@ScanTime", ScanTime, DbType.Int16));
                SqlParmColl.Add(CommonDB.AddSqlParm("@ViewLable", ViewLable, DbType.Boolean));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Index", Index, DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@BackColor", BackColor.ToArgb(), DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@TrendColor", TrendColor.ToArgb(), DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@TrendWidth", TrendWidth, DbType.Int16));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Fill", Fill, DbType.Boolean));
                SqlParmColl.Add(CommonDB.AddSqlParm("@Font", Font, DbType.String));
                SqlParmColl.Add(CommonDB.AddSqlParm("@FontColor", FontColor.ToArgb(), DbType.Int32));
                SqlParmColl.Add(CommonDB.AddSqlParm("@LastRev", LastRev, DbType.Boolean));
                SqlParmColl.Add(CommonDB.AddSqlParm("@CompiledExp", CompiledExp, DbType.Binary));
                SqlParmColl.Add(CommonDB.AddSqlParm("@validexpression", validexpression, DbType.Boolean));
                return(SqlParmColl.ToArray());
            }
            catch (SQLiteException Exc)
            {
                throw Exc;
            }
        }
 public bool Equals(HeaderFooterTemplateItem other)
 {
     return(base.Equals(other) &&
            (WantDivider == other.WantDivider) &&
            (PixelHeight == other.PixelHeight) &&
            (BackColor.ToArgb() == other.BackColor.ToArgb()));
 }
Пример #8
0
        private FormGuide(string url, FormBrowser owner)
        {
            InitializeComponent();

            Text            = Program.BrandName + " Guide";
            Size            = new Size(owner.Size.Width * 3 / 4, owner.Size.Height * 3 / 4);
            VisibleChanged += (sender, args) => this.MoveToCenter(owner);

            var resourceRequestHandler = new ResourceRequestHandlerBase();

            resourceRequestHandler.ResourceHandlers.Register(DummyPage);

            this.browser = new ChromiumWebBrowser(url)
            {
                MenuHandler     = new ContextMenuGuide(owner),
                JsDialogHandler = new JavaScriptDialogHandler(),
                KeyboardHandler = new KeyboardHandlerBase(),
                LifeSpanHandler = new LifeSpanHandler(),
                RequestHandler  = new RequestHandlerBase(true),
                ResourceRequestHandlerFactory = resourceRequestHandler.SelfFactory
            };

            browser.LoadingStateChanged += browser_LoadingStateChanged;
            browser.FrameLoadEnd        += browser_FrameLoadEnd;

            browser.BrowserSettings.BackgroundColor = (uint)BackColor.ToArgb();
            browser.Dock     = DockStyle.None;
            browser.Location = ControlExtensions.InvisibleLocation;
            browser.SetupZoomEvents();

            Controls.Add(browser);
            Disposed += (sender, args) => browser.Dispose();
        }
Пример #9
0
        protected override int DoDefaultPaint(ref DRAWITEMSTRUCT ds)
        {
            //Default paint

            using (Graphics g = Graphics.FromHdc(ds.hDC))
                using (Pen p = new Pen((ds.itemState & ODS.SELECTED) != 0 ? ColorInv(ForeColor) : ForeColor))
                    using (SolidBrush br = new SolidBrush((ds.itemState & ODS.SELECTED) != 0 ? ColorInv(ForeColor) : ForeColor))
                    {
                        if ((ds.itemState & ODS.SELECTED) != 0)
                        {
                            g.Clear(Color.FromArgb(BackColor.ToArgb() ^ 0xffffff));
                        }
                        else
                        {
                            g.Clear(BackColor);
                        }
                        Rectangle    rc  = new Rectangle(ds.rcItem.left, ds.rcItem.top, ds.rcItem.right - ds.rcItem.left, ds.rcItem.bottom - ds.rcItem.top);
                        StringFormat fmt = new StringFormat();
                        fmt.Alignment = fmt.LineAlignment = System.Drawing.StringAlignment.Center;
                        g.DrawString(Text, Font, br, rc, fmt);

                        rc.Inflate(-1, -1);
                        g.DrawRectangle(p, rc);
                        return(-1);
                    }
        }
Пример #10
0
            protected override void WriteData(BinaryWriter w)
            {
                Ragdoll.Write(w);
                w.Write(Holders.Count);
                for (int i = 0; i < Holders.Count; i++)
                {
                    Holders[i].Write(w);
                }
                w.Write(Triggers.Count);
                for (int i = 0; i < Triggers.Count; i++)
                {
                    Triggers[i].Write(w);
                }

                w.Write(MaxHealth);
                w.Write(MaxEnergy);
                w.Write(Mass);
                w.Write(GravityAcceleration);
                w.Write(JumpVelocity);
                w.Write(DragX);
                w.Write(DragY);
                w.Write(SqrDragX);
                w.Write(SqrDragY);
                w.Write(MoveForceX);
                w.Write(MoveForceY);

                w.Write(BackColor.ToArgb());
                w.Write(PointBounds);
                w.Write(GridEnabled);
                w.Write(Transparency);
            }
Пример #11
0
        protected override CResultAErreur MySerialize(C2iSerializer serializer)
        {
            //return CResultAErreur.True;
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }

            result = base.MySerialize(serializer);
            if (!result)
            {
                return(result);
            }

            int nColor = BackColor.ToArgb();

            serializer.TraiteInt(ref nColor);
            BackColor = Color.FromArgb(nColor);

            nColor = ForeColor.ToArgb();
            serializer.TraiteInt(ref nColor);
            ForeColor = Color.FromArgb(nColor);
            return(result);
        }
Пример #12
0
        /// <summary>
        /// Begin compact serialization MobiusDataType
        /// </summary>
        /// <returns></returns>

        public StringBuilder BeginSerialize(string type)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<");
            sb.Append(type);
            sb.Append(",");
            if (BackColor != DefaultBackColor)
            {
                sb.Append(BackColor.ToArgb().ToString());
            }
            sb.Append(",");

            if (ForeColor != DefaultAttrValues.ForeColor)
            {
                sb.Append(ForeColor.ToArgb().ToString());
            }
            sb.Append(",");

            if (!Lex.IsNullOrEmpty(DbLink))
            {
                sb.Append(NormalizeForSerialize(DbLink));
            }
            sb.Append(",");

            if (!Lex.IsNullOrEmpty(Hyperlink))
            {
                sb.Append(NormalizeForSerialize(Hyperlink));
            }
            sb.Append(",");

            return(sb);
        }
Пример #13
0
        public string GetSerializableFmt()
        {
            Dictionary <string, object> serial = new Dictionary <string, object>();

            serial.Add("MaxWidth", MaximumSize.Width);
            serial.Add("MaxHeight", MaximumSize.Height);
            serial.Add("MinWidth", MinimumSize.Width);
            serial.Add("MinHeight", MinimumSize.Height);
            serial.Add("SizeWidth", Size.Width);
            serial.Add("SizeHeight", Size.Height);

            serial.Add("BackColor", BackColor.ToArgb());
            //serial.Add("BackColor2", BackColor2.ToArgb());
            serial.Add("BorderStyle", BorderStyle);
            //serial.Add("GradientMode", GradientMode);
            serial.Add("DesignEventSerialFmt", DesignEventSerialFmt);

            serial.Add("CustomDesignFmt", CustomDesignFmt);
            serial.Add("RClickMenuDesignFmt", RClickMenuDesignFmt);
            serial.Add("ForeColor", ForeColor.ToArgb());
            serial.Add("ImeMode", ImeMode);

            serial.Add("TabIndex", TabIndex);

            return(DictionaryJsonHelper.SerializeDictionaryToJsonString <string, object>(serial));
        }
Пример #14
0
        private Image InvertImage(string imageListCacheKey, IVsUIShell5 shell5,
            Image i, Color transparentColor, uint backgroundColor)
#endif
        {
            if (i == null)
            {
                return null;
            }
            if (ImageCache.ContainsKey(imageListCacheKey) == false)
            {
                // new image, so cache it
                ImageCache.Add(imageListCacheKey, i);
            }
            else
            {
                // get the origonal image out of the cache
                i = ImageCache[imageListCacheKey];
            }
#if VS2015
            Bitmap ii = GetInvertedBitmap((Bitmap)i, (uint)BackColor.ToArgb());
#else
            Bitmap ii = GetInvertedBitmap(shell5, (Bitmap)i, Color.Transparent, backgroundColor);
#endif
            return ii;
        }
Пример #15
0
        private FormGuide(string url, Form owner)
        {
            InitializeComponent();

            Text            = Program.BrandName + " Guide";
            Size            = new Size(owner.Size.Width * 3 / 4, owner.Size.Height * 3 / 4);
            VisibleChanged += (sender, args) => this.MoveToCenter(owner);

            browser = new ChromiumWebBrowser(url)
            {
                KeyboardHandler = new CustomKeyboardHandler(null)
            };

            browser.BrowserSettings.BackgroundColor = (uint)BackColor.ToArgb();

            var browserComponent = new CefBrowserComponent(browser);
            var browserImpl      = new BaseBrowser(browserComponent);

            BrowserUtils.SetupDockOnLoad(browserComponent, browser);

            Controls.Add(browser);

            Disposed += (sender, args) => {
                browserImpl.Dispose();
                browser.Dispose();
            };
        }
Пример #16
0
        void UpdateDocument()
        {
            string strText = this.Text;

            if (!string.IsNullOrEmpty(strText))
            {
                MatchCollection colUrls = TAG_MATCHER.Matches(strText);
                if (colUrls.Count == 0)
                {
                    //this appears to be plain text - so convert to html
                    strText = strText.Replace("\r\n", "<br/>").Replace("\r", "<br/>").Replace("\n", "<br/>").Replace("\t", "    ");
                }
                if (DetectUrls)
                {
                    Dictionary <string, string> dicProtectedUrls = new Dictionary <string, string> ();
                    for (Int32 i = colUrls.Count - 1; i >= 0; i--)
                    {
                        string strShieldText = "<SHIELD" + i + ">";
                        strText = strText.Replace(colUrls [i].Value, strShieldText);
                        dicProtectedUrls [strShieldText] = colUrls [i].Value;
                    }
                    colUrls = OPTIMIZED_MATCHER.Matches(strText);
                    if (colUrls.Count > 0)
                    {
                        int colUrlCount = colUrls.Count;
                        for (int i = colUrlCount - 1; i >= 0; i--)
                        {
                            strText = strText.Remove(colUrls[i].Index, colUrls[i].Length);
                            strText = strText.Insert(colUrls[i].Index, String.Format("<a href=\"{0}\">{0}</a>", colUrls[i].Value));
                        }
                    }
                    foreach (string strKey in dicProtectedUrls.Keys)
                    {
                        strText = strText.Replace(strKey, dicProtectedUrls [strKey]);
                    }
                }
                string strStyle = String.Format(@"<style>
                                                    body {{{{
                                                        padding:3;
                                                        margin:0;
                                                        background-color:#{0:x6};
                                                        font-family:{1};
                                                        font-size:{2}pt;
                                                        color:#{3:x6};
                                                    }}}}
                                                </style>", BackColor.ToArgb() & 0x00ffffff, Font.FontFamily.Name, Font.SizeInPoints, ForeColor.ToArgb() & 0x00ffffff);
                string strHtml  = String.Format("<html><head></head><body style=\"{0}\">{1}{2}{{0}}</body></html>", string.Format("{0};overflow: auto;", AllowSelection ? "" : "cursor:default"), strStyle, AllowSelection ? "" : "<script>document.onselectstart=new Function (\"return false\")</script>");

                if (m_browser.Document != null)
                {
                    var doc = m_browser.Document.OpenNew(false);
                    if (doc != null)
                    {
                        doc.Write(String.Format(strHtml, strText));
                    }
                }
            }
        }
Пример #17
0
 private void LoadDefaultSettings()
 {
     s.BkColor   = BackColor.ToArgb();
     s.ResetHKey = (int)Keys.NumPad3;
     s.StarHKey  = (int)Keys.NumPad0;
     s.StopHKey  = (int)Keys.Decimal;
     s.TColor    = label1.ForeColor.ToArgb();
     s.Save("settings.def");
 }
Пример #18
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (BitmapStorage == null)
            {
                return;
            }
            if (Zoom == 0)
            {
                return;
            }

            float cw = ClientSize.Width;
            float ch = ClientSize.Height;

            e.Graphics.SmoothingMode     = SmoothingMode.HighQuality;
            e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
            e.Graphics.PixelOffsetMode   = PixelOffsetMode.HighQuality;

            // Bitmap rendering //
            var   o  = AdjustOffset();
            float x1 = Math.Max(0f, o.X);
            float y1 = Math.Max(0f, o.Y);
            float x2 = Math.Min(cw, o.X + BitmapStorage.Width * BaseZoom * Zoom);
            float y2 = Math.Min(ch, o.Y + BitmapStorage.Height * BaseZoom * Zoom);

            float x = x1;
            float y = y1;
            float w = x2 - x1;
            float h = y2 - y1;

            float srcx = (x - o.X) / (BaseZoom * Zoom);
            float srcy = (y - o.Y) / (BaseZoom * Zoom);
            float srcw = w / (BaseZoom * Zoom);
            float srch = h / (BaseZoom * Zoom);

            RectangleF Imgbox = new RectangleF(x, y, w, h);
            RectangleF Srcbox = new RectangleF(srcx, srcy, srcw, srch);

            if (Imgbox.Width > 0 && Imgbox.Height > 0 && Srcbox.Width > 0 && Srcbox.Height > 0)
            {
                e.Graphics.DrawImage(BitmapStorage, Imgbox, Srcbox, GraphicsUnit.Pixel);
            }
            // //////////////// //

            // Properties rendering //
            if (PropertiesText != null)
            {
                using (var brush = new SolidBrush(Color.FromArgb(BackColor.ToArgb() ^ 0xffffff)))
                {
                    e.Graphics.DrawString(PropertiesText, Font,
                                          brush, 0, ch - 2 - Font.Height);
                }
            }
            // //////////////////// //

            base.OnPaint(e);
        }
Пример #19
0
 private void RefreshName()
 {
     if (!Updating && !DisableAutoColorName)
     {
         Updating = true;
         Text     = "#" + BackColor.ToArgb().ToString("X").Substring(2, 6);
         Updating = false;
     }
 }
Пример #20
0
            public CResultAErreur Serialize(C2iSerializer serializer)
            {
                int            nVersion = GetNumVersion();
                CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

                if (!result)
                {
                    return(result);
                }
                if (nVersion <= 0)
                {
                    string strProp = "";
                    serializer.TraiteString(ref strProp);
                }
                serializer.TraiteString(ref m_strTitle);
                serializer.TraiteInt(ref m_nWidth);
                if (nVersion >= 1)
                {
                    I2iSerializable tmp = m_expression;
                    serializer.TraiteObject(ref tmp);
                    if (tmp is C2iExpression)
                    {
                        m_expression = (C2iExpression)tmp;
                    }

                    tmp = m_actionLink;
                    serializer.TraiteObject(ref tmp);
                    if (tmp is CActionSur2iLink)
                    {
                        m_actionLink = (CActionSur2iLink)tmp;
                    }
                    serializer.TraiteBool(ref m_bGrouper);
                }
                if (nVersion >= 2)
                {
                    int nVal = BackColor.ToArgb();
                    serializer.TraiteInt(ref nVal);
                    BackColor = Color.FromArgb(nVal);

                    nVal = TextColor.ToArgb();
                    serializer.TraiteInt(ref nVal);
                    TextColor = Color.FromArgb(nVal);

                    nVal = (int)this.OperationAgregation;
                    serializer.TraiteInt(ref nVal);
                    this.OperationAgregation = (OperationsAgregation)nVal;
                }
                if (nVersion >= 3)
                {
                    result = C2iWnd.SerializeFont(serializer, ref m_font);
                }
                if (nVersion >= 4)
                {
                    serializer.TraiteString(ref m_strLibelleTotal);
                }
                return(result);
            }
Пример #21
0
        private void Save_Click(object sender, EventArgs e)
        {
            RegistryKey rk     = Registry.CurrentUser;
            RegistryKey reskey = rk.OpenSubKey("LabKey", true);

            reskey.SetValue("Color", BackColor.ToArgb());
            reskey.SetValue("Text", TEXT.Text);
            reskey.SetValue("WeightForm", Size.Width);
            reskey.SetValue("HeightForm", Size.Height);
            reskey.Close();
        }
Пример #22
0
        private void saveValue_Click(object sender, EventArgs e)
        {
            RegistryKey rk     = Registry.CurrentUser; // Создание регистрационного ключа
            RegistryKey reskey = rk.OpenSubKey("SaveFormKey", true);

            reskey.SetValue("Color", BackColor.ToArgb());
            reskey.SetValue("Text", textBox1.Text);
            reskey.SetValue("WeightForm", Size.Width);
            reskey.SetValue("HeightForm", Size.Height);

            reskey.Close();
        }
Пример #23
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("Width", Width);
            info.AddValue("Height", Height);
            info.AddValue("BackColor", BackColor.ToArgb().ToString());
            info.AddValue("DrawBackground", DrawBackground);
            info.AddValue("Centered", Centered);
            info.AddValue("Label", Label);
            info.AddValue("Image", Image);

            base.GetObjectData(info, context);
        }
Пример #24
0
 protected override void OnPaintBackground(PaintEventArgs e)
 {
     base.OnPaintBackground(e);
     if (Color.Transparent.ToArgb() == BackColor.ToArgb())
     {
         textBox.BackColor = Color.White;
     }
     else
     {
         textBox.BackColor = BackColor;
     }
     textBox.ForeColor = ForeColor;
 }
Пример #25
0
 protected override void OnPaintBackground(PaintEventArgs pevent)
 {
     pevent.Graphics.Clear(Parent.BackColor);
     if (Color.Transparent.ToArgb() == BackColor.ToArgb())
     {
         textBox.BackColor = Color.White;
     }
     else
     {
         textBox.BackColor = BackColor;
     }
     textBox.ForeColor = ForeColor;
 }
Пример #26
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (DockBackColor.ToArgb() == BackColor.ToArgb())
            {
                return;
            }

            Graphics   g       = e.Graphics;
            SolidBrush bgBrush = new SolidBrush(DockBackColor);

            g.FillRectangle(bgBrush, ClientRectangle);
        }
Пример #27
0
 private void TrySaveBackColor()
 {
     if (Name == "左侧工具条")
     {
         try
         {
             string fname = AppDomain.CurrentDomain.BaseDirectory + "ToolStrip.BackColor";
             File.WriteAllLines(fname, new string[] { BackColor.ToArgb().ToString() }, Encoding.Default);
         }
         catch
         {
         }
     }
 }
Пример #28
0
        /// <summary>
        /// Gets the key the identifies the button with its current properties and is unique.
        /// </summary>
        /// <returns>A string that represents the key.</returns>
        private string GetKey()
        {
            Size   size   = GetButtonSize();
            string imgKey = Image != null?Image.GetHashCode().ToString() : string.Empty;

            return(string.Format("{0},{1},{2},{3},{4},{5}{6}_{7}_{8}{9}",
                                 size.Width, size.Height,
                                 BackColor.ToArgb(),
                                 (int)shape, Text,
                                 IsDown ? 1 : 0,
                                 (int)corners,
                                 GetType().Name,
                                 Enabled ? "" : "0",
                                 imgKey));
        }
Пример #29
0
        private void Overlay_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.T)
            {
                int colorOption = 0;
                if (BackColor.ToArgb() == Color.Black.ToArgb())
                {
                    colorOption = 5;
                    BackColor   = Color.Green;
                }
                else if (BackColor.ToArgb() == Color.Green.ToArgb())
                {
                    colorOption = 0;
                    BackColor   = Color.Magenta;
                }
                else if (BackColor.ToArgb() == Color.Magenta.ToArgb())
                {
                    colorOption = 1;
                    BackColor   = Color.Blue;
                }
                else if (BackColor.ToArgb() == Color.Blue.ToArgb())
                {
                    colorOption = 2;
                    BackColor   = Color.Red;
                }
                else if (BackColor.ToArgb() == Color.Red.ToArgb())
                {
                    colorOption = 3;
                    BackColor   = Color.FromArgb(224, 224, 224);
                }
                else if (BackColor.ToArgb() == Color.FromArgb(224, 224, 224).ToArgb())
                {
                    colorOption = 4;
                    BackColor   = Color.Black;
                }

                StatsForm.CurrentSettings.OverlayColor = colorOption;
                StatsForm.SaveUserSettings();
            }
            else if (e.KeyCode == Keys.F)
            {
                FlipDisplay(!flippedImage);
                BackgroundImage = RecreateBackground();

                StatsForm.CurrentSettings.FlippedDisplay = flippedImage;
                StatsForm.SaveUserSettings();
            }
        }
Пример #30
0
        /// <summary>
        /// Serialize base of Mobius Data Type
        /// </summary>
        /// <param name="br"></param>

        public virtual void SerializeBinary(BinaryWriter bw)
        {
            if (IsNonExistant)             // write nonexistant if nonexistant value is set
            {
                bw.Write(NonExistantValueFlag);
            }

            if (BackColor != DefaultBackColor)
            {
                bw.Write(true);
                bw.Write(BackColor.ToArgb());
            }
            else
            {
                bw.Write(false);
            }

            if (ForeColor != DefaultAttrValues.ForeColor)
            {
                bw.Write(true);
                bw.Write(ForeColor.ToArgb());
            }
            else
            {
                bw.Write(false);
            }

            if (DbLink != "")
            {
                bw.Write(true);
                bw.Write(Lex.S(DbLink));
            }
            else
            {
                bw.Write(false);
            }

            if (Hyperlink != "")
            {
                bw.Write(true);
                bw.Write(Lex.S(Hyperlink));
            }
            else
            {
                bw.Write(false);
            }
        }