Ejemplo n.º 1
0
    protected override void OnClosed(EventArgs ea)
    {
        RegistryKey regkey =
            Registry.CurrentUser.OpenSubKey(strRegKey, true);

        if (regkey == null)
        {
            regkey = Registry.CurrentUser.CreateSubKey(strRegKey);
        }

        regkey.SetValue(strFontFace, Font.Name);
        regkey.SetValue(strFontSize, Font.SizeInPoints.ToString());
        regkey.SetValue(strFontStyle, (int)Font.Style);
        regkey.SetValue(strForeColor, ForeColor.ToArgb());
        regkey.SetValue(strBackColor, BackColor.ToArgb());

        for (int i = 0; i < 16; i++)
        {
            regkey.SetValue(strCustomClr + i, clrdlg.CustomColors[i]);
        }

        regkey.Close();
    }
Ejemplo n.º 2
0
        public void SaveSettings()
        {
            XmlNode node = doc.SelectSingleNode("//appSettings");

            if (node == null)
            {
                node = doc.CreateNode(XmlNodeType.Element, "appSettings", "");
                XmlElement root = doc.DocumentElement;
                root.AppendChild(node);
            }
            string[] keys = new string[] { "BackColor",
                                           "TextColor",
                                           "TextSize",
                                           "TextFont" };
            string[] values = new string[] { BackColor.ToString(),
                     TextColor.ToString(),
                     TextSize.ToString(),
                     TextFont.ToString() };

            for (int i = 0; i < keys.Length; i++)
            {
                XmlElement element = node.SelectSingleNode(string.Format("//add[@key='{0}']", keys[i])) as XmlElement;
                if (element != null)
                {
                    element.SetAttribute("value", values[i]);
                }
                else
                {
                    element = doc.CreateElement("add");
                    element.SetAttribute("key", keys[i]);
                    element.SetAttribute("value", values[i]);
                    node.AppendChild(element);
                }
            }
            doc.Save(Assembly.GetExecutingAssembly().Location + ".config");
        }
Ejemplo n.º 3
0
        protected override int DoDefaultPaint(ref DRAWITEMSTRUCT ds)
        {
            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  = (Rectangle)ds.rcItem;
                        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);
                    }
        }
Ejemplo n.º 4
0
 protected override void DrawBackground(IRenderer gc)
 {
     if (BackColor.A != 0)
     {
         gc.fillEllipse(rect.X, rect.Y, rect.Width, rect.Height, BackColor.ToArgb());
     }
     if (BackgroundImage == null)
     {
         return;
     }
     if (cachedImage == null)
     {
         cachedImage = new Bitmap(BackgroundImage, rect.Width, rect.Height);
     }
     else
     {
         if (cachedImage.Width != rect.Width || cachedImage.Height != rect.Height)
         {
             cachedImage.Dispose();
             cachedImage = new Bitmap(BackgroundImage, rect.Width, rect.Height);
         }
     }
     gc.drawImage(cachedImage, rect.X, rect.Y, rect.Width, rect.Height);
 }
Ejemplo n.º 5
0
        private void OnPaintDesignMode(PaintEventArgs e)
        {
            Rectangle rc = ClientRectangle;
            Color     penColor;

            // Choose black or white pen, depending on the color of the control.
            if (BackColor.GetBrightness() < .5)
            {
                penColor = ControlPaint.Light(BackColor);
            }
            else
            {
                penColor = ControlPaint.Dark(BackColor);
            };

            using (Pen pen = new Pen(penColor))
            {
                pen.DashStyle = DashStyle.Dash;

                rc.Width--;
                rc.Height--;
                e.Graphics.DrawRectangle(pen, rc);
            }
        }
        private void PreferencesDialog_Load(object sender, EventArgs e)
        {
            if (TextColor.GetBrightness() <= 0.6f)
            {
                this.TextColorButton.ForeColor = Color.White;
            }

            if (BackColor.GetBrightness() <= 0.6f)
            {
                this.BackColorButton.ForeColor = Color.White;
            }

            //set button colors and font on load
            this.TextColorButton.BackColor = TextColor;
            this.BackColorButton.BackColor = BackColor;
            this.TextFontButton.Font       = Font;

            //set textbox text on load
            this.DocumentSizeWidthTextBox.Text  = DocumentSize.Width.ToString();
            this.DocumentSizeHeightTextBox.Text = DocumentSize.Height.ToString();
            this.DocumentLocationXTextBox.Text  = DocumentLocation.X.ToString();
            this.DocumentLocationYTextBox.Text  = DocumentLocation.Y.ToString();
            this.DocumentTitleTextBox.Text      = DocumentTitle;
        }
Ejemplo n.º 7
0
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            serializer.TraiteInt(ref m_nWidth);
            serializer.TraiteString(ref m_strName);
            serializer.TraiteString(ref m_strPropriete);
            serializer.TraiteString(ref m_strText);
            int nAlignement = (int)m_TextAlignment;

            serializer.TraiteInt(ref nAlignement);
            m_TextAlignment = (ContentAlignment)nAlignement;

            if (nVersion >= 1)
            {
                int nCouleur = BackColor.ToArgb();
                serializer.TraiteInt(ref nCouleur);
                BackColor = Color.FromArgb(nCouleur);

                nCouleur = ForColor.ToArgb();
                serializer.TraiteInt(ref nCouleur);
                ForColor = Color.FromArgb(nCouleur);
            }
            if (nVersion >= 2)
            {
                serializer.TraiteBool(ref m_bIsCheckColumn);
            }


            return(result);
        }
Ejemplo n.º 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);

            ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();

            resourceHandlerFactory.RegisterHandler(DummyPage);

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

            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();
            };
        }
Ejemplo n.º 9
0
        private void saveSettings()
        {
            string settingsFile = "./" + this.settingsFile;

            WritePrivateProfileString("Count", "count", buttonCount.ToString(), settingsFile);
            WritePrivateProfileString("Count", "hide", hideButtonsToolStripMenuItem.Checked.ToString(), settingsFile);
            WritePrivateProfileString("Font", "family", FontHandler.currentFont.FontFamily.Name, settingsFile);
            WritePrivateProfileString("Font", "size", FontHandler.currentFont.Size.ToString(), settingsFile);
            WritePrivateProfileString("Font", "bold", FontHandler.currentFont.Style == FontStyle.Bold ? "y":"n", settingsFile);
            WritePrivateProfileString("Stuff", "reckey", reckey.ToString(), settingsFile);
            WritePrivateProfileString("Colors", "kps", SerializeKpsColors(kpscolors, kpscolorscount), settingsFile);
            WritePrivateProfileString("Colors", "fg", frmMain.FgColor.ToArgb().ToString(), settingsFile);
            WritePrivateProfileString("Colors", "bg", BackColor.ToArgb().ToString(), settingsFile);

            for (var i = 0; i < MAX_BUTTONS; i++)
            {
                var b = btns[i];
                WritePrivateProfileString("KEY", "key" + (i + 1), b.mykey().ToString(), settingsFile);
                WritePrivateProfileString("TEXT", "text" + (i + 1), b.mystring().ToString(), settingsFile);
                WritePrivateProfileString("COLOR", "acolor" + (i + 1), b.myactivecolor().ToString(), settingsFile);
                WritePrivateProfileString("COLOR", "icolor" + (i + 1), b.myinactivecolor().ToString(), settingsFile);
            }
            settingsModified = false;
        }
Ejemplo n.º 10
0
        protected void Draw(SpriteBatch s, Point initialLocation, string text)
        {
            s.Draw(Texture, new Rectangle(Location.X + initialLocation.X, Location.Y + initialLocation.Y, Size.Width, Size.Height), BackColor.ToXnaColor());

            var drawText = text;

            if (!string.IsNullOrEmpty(Text))
            {
                if (ContainsFocus && DateTime.UtcNow.Millisecond / 500 == 0)
                {
                    drawText += "|";
                }

                s.DrawString(Font, drawText, new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColor.ToXnaColor());
            }
            else
            {
                drawText = TextPlaceholder;
                s.DrawString(Font, drawText, new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColorPlaceholder.ToXnaColor());

                if (ContainsFocus && DateTime.UtcNow.Millisecond / 500 == 0)
                {
                    s.DrawString(Font, "|", new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColor.ToXnaColor());
                }
            }
        }
Ejemplo n.º 11
0
        protected void DrawScannerTable(Vector3d center)
        {
            List <Vector3d> circT = new List <Vector3d>(360);
            List <Vector3d> circB = new List <Vector3d>(360);
            List <Vector2d> text  = new List <Vector2d>(360);
            double          h     = 5;

            for (int i = 0; i < 361; i++)
            {
                double ang = Utils.DEGREES_TO_RADIANS(i);
                double x   = -Math.Cos(ang);
                double y   = Math.Sin(ang);
                text.Add(new Vector2d(x * TableRadius / 20.0, y * TableRadius / 20.0));
                Vector3d t = new Vector3d(x * TableRadius, 0, y * TableRadius);
                Vector3d b = new Vector3d(x * TableRadius, -h, y * TableRadius);
                circT.Add(t + center);
                circB.Add(b + center);
            }

            using (new GLEnable(EnableCap.Lighting))
            {
                GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse);
                using (new GLEnable(EnableCap.ColorMaterial))
                {
                    GL.ShadeModel(Smooth ? ShadingModel.Smooth : ShadingModel.Flat);
                    GL.Color3(ForeColor.GetStepColor(BackColor, 0.5));
                    using (new GLEnable(EnableCap.CullFace))
                    {
                        GL.CullFace(CullFaceMode.Back);

                        GL.BindTexture(TextureTarget.Texture2D, this.ScannerTextureID);

                        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
                        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);

                        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
                        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

                        using (new GLEnable(EnableCap.Blend))
                        {
                            GL.BlendFunc(BlendingFactorSrc.SrcColor, BlendingFactorDest.SrcColor);

                            using (new GLEnable(EnableCap.Texture2D))
                            {
                                GL.Begin(PrimitiveType.Polygon);
                                GL.Normal3(new Vector3d(0, 1, 0));
                                for (int i = 0; i < circT.Count; i++)
                                {
                                    GL.TexCoord2(text[i]);
                                    //GL.Normal3(new Vector3d(0, 1, 0));
                                    GL.Vertex3(circT[i]);
                                }
                                GL.End();


                                double div = (TableRadius * 16 * Math.PI) / 360;
                                GL.Begin(PrimitiveType.TriangleStrip);
                                for (int i = 0; i < circT.Count; i++)
                                {
                                    GL.Normal3(circT[i].Normalized());
                                    GL.TexCoord2(new Vector2d(i / div, 0));
                                    GL.Vertex3(circT[i]);
                                    GL.TexCoord2(new Vector2d(i / div, 0.5));
                                    GL.Vertex3(circB[i]);
                                }
                                GL.End();


                                GL.Begin(PrimitiveType.Polygon);
                                GL.Normal3(new Vector3d(0, -1, 0));
                                for (int i = circT.Count - 1; i >= 0; i--)
                                {
                                    //GL.Normal3(new Vector3d(0, -1, 0));
                                    GL.TexCoord2(text[i]);
                                    GL.Vertex3(circB[i]);
                                }
                                GL.End();

                                GL.Color3(BackColor.ModifyLuminosity(0.1));
                                GL.Disable(EnableCap.Lighting);
                                GL.Disable(EnableCap.Texture2D);
                                GL.Disable(EnableCap.Blend);

                                GL.Begin(PrimitiveType.TriangleStrip);
                                for (int i = 0; i < circT.Count; i++)
                                {
                                    Vector3d v = new Vector3d(circT[i]);
                                    v.Y     += TableHeight;
                                    circB[i] = v;
                                    GL.Vertex3(circT[i]);
                                    GL.Vertex3(circB[i]);
                                }
                                GL.End();
                                GL.Begin(PrimitiveType.Polygon);
                                GL.Normal3(new Vector3d(0, -1, 0));
                                for (int i = circT.Count - 1; i >= 0; i--)
                                {
                                    GL.Vertex3(circB[i]);
                                }
                                GL.End();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Controls the actual drawing for this gradient slider control.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="clipRectangle"></param>
        protected virtual void OnDraw(Graphics g, Rectangle clipRectangle)
        {
            if (Width == 0 || Height == 0)
            {
                return;
            }
            LinearGradientBrush lgb = new LinearGradientBrush(ClientRectangle, BackColor.Lighter(.2F), BackColor.Darker(.2F), LinearGradientMode.Vertical);

            g.FillRectangle(lgb, ClientRectangle);
            lgb.Dispose();

            int l = Convert.ToInt32((Width * (_leftHandle.Position - _min)) / (_max - _min));
            int r = Convert.ToInt32((Width * (_rightHandle.Position - _min)) / (_max - _min));

            Rectangle a = new Rectangle(0, 5, l, Height - 10);
            Rectangle b = new Rectangle(l, 5, r - l, Height - 10);
            Rectangle c = new Rectangle(r, 5, Right - r, Height - 10);

            if (a.Width > 0)
            {
                SolidBrush sb = new SolidBrush(_minColor);
                g.FillRectangle(sb, a);
                sb.Dispose();
            }
            if (b.Width > 0)
            {
                LinearGradientBrush center = new LinearGradientBrush(new Point(b.X, 0), new Point(b.Right, 0), _minColor, _maxColor);
                g.FillRectangle(center, b);
                center.Dispose();
            }
            if (c.Width > 0)
            {
                SolidBrush sb = new SolidBrush(_maxColor);
                g.FillRectangle(sb, c);
                sb.Dispose();
            }
            if (Enabled)
            {
                _leftHandle.Draw(g);
                _rightHandle.Draw(g);
            }
        }
Ejemplo n.º 13
0
 /// <include file='doc\PrintPreviewControl.uex' path='docs/doc[@for="PrintPreviewControl.ShouldSerializeBackColor"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Indicates whether the <see cref='System.Windows.Forms.Control.BackColor'/> property should be
 ///       persisted.
 ///    </para>
 /// </devdoc>
 internal override bool ShouldSerializeBackColor()
 {
     return(!BackColor.Equals(SystemColors.AppWorkspace));
 }
Ejemplo n.º 14
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     return(ForeColor.GetHashCode() ^ (BackColor.GetHashCode() << 1) ^ ((Style.GetHashCode() + 1) << 2));
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Raises the <see cref="ButtonExt.Paint"/> event.
        /// </summary>
        /// <param name="pe">A <see cref="PaintEventArgs"/> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs pe)
        {
            if (FlatStyle != FlatStyle.Popup)      // popup style uses custom painting.
            {
                base.OnPaint(pe);
            }
            else
            {
                Rectangle border = ClientRectangle;
                border.Width--; border.Height--;

                Rectangle buttonarea = ClientRectangle;
                buttonarea.Inflate(-1, -1);                     // inside it.

                //System.Diagnostics.Debug.WriteLine("Paint " + this.Name + " " + ClientRectangle.ToString() + " MD " + mousedown + " MO " + mouseover);

                Color colBack   = Color.Empty;
                Color colBorder = Color.Empty;
                switch (_DrawState)
                {
                case DrawState.Disabled:
                    colBack   = BackColor.Multiply(0.5F);
                    colBorder = FlatAppearance.BorderColor.Multiply(_ButtonDisabledScaling);
                    break;

                case DrawState.Normal:
                default:
                    colBack   = BackColor;
                    colBorder = FlatAppearance.BorderColor;
                    break;

                case DrawState.Hover:
                    colBack   = FlatAppearance.MouseOverBackColor;
                    colBorder = FlatAppearance.BorderColor.Multiply(_BorderColorScaling);
                    break;

                case DrawState.Click:
                    colBack   = FlatAppearance.MouseDownBackColor;
                    colBorder = FlatAppearance.BorderColor.Multiply(_BorderColorScaling);
                    break;
                }

                using (var b = new LinearGradientBrush(buttonarea, colBack, colBack.Multiply(_ButtonColorScaling), 90))
                    pe.Graphics.FillRectangle(b, buttonarea);
                using (var p = new Pen(colBorder))
                    pe.Graphics.DrawRectangle(p, border);

                if (Image != null)
                {
                    if ((Enabled && DrawnImageAttributesEnabled != null) || (!Enabled && DrawnImageAttributesDisabled != null))
                    {
                        //System.Diagnostics.Debug.WriteLine("ButtonExt " + this.Name + " Draw image with IA");
                        pe.Graphics.DrawImage(Image, ControlHelpersStaticFunc.ImagePositionFromContentAlignment(ImageAlign, buttonarea, Image.Size),
                                              0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel, (Enabled) ? DrawnImageAttributesEnabled : DrawnImageAttributesDisabled);
                    }
                    else
                    {
                        pe.Graphics.DrawImage(Image, ControlHelpersStaticFunc.ImagePositionFromContentAlignment(ImageAlign, buttonarea, Image.Size),
                                              0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel);
                    }
                }

                if (!string.IsNullOrEmpty(Text))
                {
                    using (var fmt = ControlHelpersStaticFunc.StringFormatFromContentAlignment(RtlTranslateAlignment(TextAlign)))
                        using (Brush textb = new SolidBrush((Enabled) ? this.ForeColor : this.ForeColor.Multiply(0.5F)))
                        {
                            if (this.UseMnemonic)
                            {
                                fmt.HotkeyPrefix = this.ShowKeyboardCues ? HotkeyPrefix.Show : HotkeyPrefix.Hide;
                            }
                            if (this.AutoEllipsis)
                            {
                                fmt.Trimming = StringTrimming.EllipsisCharacter;
                            }
                            pe.Graphics.DrawString(this.Text, this.Font, textb, buttonarea, fmt);
                        }
                }

                if (Focused && ShowFocusCues)
                {
                    using (var p = new Pen(colBorder))
                    {
                        Rectangle rcFocus = border;

                        // Thicken the standard border by 1px.
                        rcFocus.Inflate(-1, -1);
                        pe.Graphics.DrawRectangle(p, rcFocus);

                        // Thicken that by an additional 1px, using something similar to ControlPaint.DrawFocusRectangle, but capable of honouring forecolour.
                        rcFocus.Inflate(-1, -1);
                        p.DashStyle   = DashStyle.Dash;
                        p.DashPattern = new[] { 1f, 1f };
                        pe.Graphics.DrawRectangle(p, rcFocus);
                    }
                }


                this.OnCustomPaint(pe);
            }
        }
Ejemplo n.º 16
0
        private void Draw(SpriteBatch s)
        {
            if (Visible && Enabled)
            {
                if (ShowTitleBar)
                {
                    s.Draw(TitleTexture, new Rectangle(Location.X, Location.Y, Size.Width, TitleBarHeight), TitleBarColor.ToXnaColor());
                    s.Draw(BackgroundTexture, new Rectangle(Location.X, Location.Y + TitleBarHeight, Size.Width, Size.Height - TitleBarHeight), BackColor.ToXnaColor());
                }
                else
                {
                    s.Draw(BackgroundTexture, new Rectangle(Location.X, Location.Y, Size.Width, Size.Height), BackColor.ToXnaColor());
                }

                foreach (var c in Controls)
                {
                    var drawableControl = c as IDrawableControl;

                    if (drawableControl == null)
                    {
                        continue;
                    }

                    if (ShowTitleBar)
                    {
                        drawableControl.Draw(s, new EFD.Point(Location.X, Location.Y + TitleBarHeight));
                    }
                    else
                    {
                        drawableControl.Draw(s, Location);
                    }
                }
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Controls the actual drawing for this gradient slider control.
        /// </summary>
        /// <param name="g">The graphics object used for drawing.</param>
        /// <param name="clipRectangle">The clip rectangle.</param>
        protected virtual void OnDraw(Graphics g, Rectangle clipRectangle)
        {
            using (GraphicsPath gp = new())
            {
                Rectangle innerRect = new(LeftHandle.Width, 3, Width - 1 - RightHandle.Width - LeftHandle.Width, Height - 1 - 6);
                gp.AddRoundedRectangle(innerRect, 2);

                if (Width == 0 || Height == 0)
                {
                    return;
                }

                // Create a rounded gradient effect as the backdrop that other colors will be drawn to
                LinearGradientBrush silver = new(ClientRectangle, BackColor.Lighter(.2F), BackColor.Darker(.6F), LinearGradientMode.Vertical);
                g.FillPath(silver, gp);
                silver.Dispose();

                using (LinearGradientBrush lgb = new(innerRect, Color.White, Color.White, LinearGradientMode.Horizontal))
                {
                    Color[] colors    = new Color[37];
                    float[] positions = new float[37];

                    for (int i = 0; i <= 36; i++)
                    {
                        int j = _inverted ? 36 - i : i;
                        colors[j]    = SymbologyGlobal.ColorFromHsl(((i * 10) + _hueShift) % 360, 1, .7).ToTransparent(.7f);
                        positions[i] = i / 36f;
                    }

                    ColorBlend cb = new()
                    {
                        Colors    = colors,
                        Positions = positions
                    };
                    lgb.InterpolationColors = cb;
                    g.FillPath(lgb, gp);
                }

                g.DrawPath(Pens.Gray, gp);
            }

            if (Enabled)
            {
                LeftHandle.Draw(g);
                RightHandle.Draw(g);
            }
        }
Ejemplo n.º 18
0
 public override string ToString()
 {
     return(ForeColor.ToString() + ", " + BackColor.ToString() + ", " + BorderColor.ToString());
 }
Ejemplo n.º 19
0
 public void Draw(SpriteBatch s, Point initialLocation)
 {
     s.Draw(Texture, new Rectangle(Location.X + initialLocation.X, Location.Y + initialLocation.Y, Size.Width, Size.Height), BackColor.ToXnaColor());
     s.DrawString(Font, Text, new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColor.ToXnaColor());
 }
Ejemplo n.º 20
0
 private void panel_DragDrop(object sender, DragEventArgs e)
 {
     ((Control)sender).BackColor = (Color)e.Data.GetData(BackColor.GetType());
 }
Ejemplo n.º 21
0
 public new string toString()
 {
     return(Name + "|" + Weight + "|" + Cost + "|" + Equipped + "|" + category + "|" + size + "|" + critRange + "|" + range + "|" + dmg + "|" + dmgType + "|" + ForeColor.ToArgb() + "|" + BackColor.ToArgb() + notesToString());
 }
Ejemplo n.º 22
0
        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            // Wire up the onkeypress event handler to the ChangeBackgroundColor() JavaScript function
            Control       c           = Page.FindControl(ControlToManage);
            StringBuilder onClickCall = new StringBuilder();

            //make sure it's the right object
            if (c != null && c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer"))
            {
                VideoPlayer vp = (VideoPlayer)c;

                //check video id
                if (VideoID.Equals(-1))
                {
                    onClickCall.Append(vp.VideoID);
                }
                else
                {
                    onClickCall.Append(VideoID);
                }
                onClickCall.Append(", ");

                //check for player id
                if (PlayerID.Equals(-1))
                {
                    onClickCall.Append(vp.PlayerID);
                }
                else
                {
                    onClickCall.Append(PlayerID);
                }

                //check for player name
                onClickCall.Append(", '" + vp.PlayerName + "', ");

                //check for auto start
                if (AutoStart.Equals(false))
                {
                    onClickCall.Append(vp.AutoStart.ToString().ToLower());
                }
                else
                {
                    onClickCall.Append(AutoStart.ToString().ToLower());
                }
                onClickCall.Append(", '");

                //check for back color
                if (BackColor.Equals("#000000"))
                {
                    onClickCall.Append(vp.BackColor);
                }
                else
                {
                    onClickCall.Append(BackColor);
                }
                onClickCall.Append("', ");

                //check for width
                if (Width.Equals(0))
                {
                    onClickCall.Append(vp.Width.ToString());
                }
                else
                {
                    onClickCall.Append(Width.ToString());
                }
                onClickCall.Append(", ");

                //check for Height
                if (Height.Equals(0))
                {
                    onClickCall.Append(vp.Height.ToString());
                }
                else
                {
                    onClickCall.Append(Height.ToString());
                }
                onClickCall.Append(", ");

                //check for IsVid
                if (IsVid.Equals(true))
                {
                    onClickCall.Append(vp.IsVid.ToString().ToLower());
                }
                else
                {
                    onClickCall.Append(IsVid.ToString().ToLower());
                }
                onClickCall.Append(", '");

                //check for WMode
                if (WMode.Equals(""))
                {
                    onClickCall.Append(vp.WMode);
                }
                else
                {
                    onClickCall.Append(WMode);
                }

                //append for ClientID
                onClickCall.Append("', '" + vp.ClientID + "', '" + PlaylistTabString + "', '" + PlaylistComboString + "', '" + VideoList.ToString() + "'");

                writer.AddAttribute("onclick", "javascript:addPlayer(" + onClickCall.ToString() + ");return false;");

                base.AddAttributesToRender(writer);
            }
            else
            {
                StringBuilder error = new StringBuilder();
                error.Append("The ControlToManage must be specified or point to a valid VideoPlayer.");

                if (c == null)
                {
                    error.Append("\n The ControlToManage was null.");
                }
                else if (!c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer"))
                {
                    error.Append("\n The ControlToManage type was " + c.GetType().ToString() + ".");
                }
                throw new ArgumentException(error.ToString());
            }
        }
Ejemplo n.º 23
0
        protected override void OnPaint(PaintEventArgs e)
        {
            var g    = e.Graphics;
            var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);

            var textColor   = UseForeColor? ForeColor : Colors.LightText;
            var borderColor = Colors.GreySelection;
            var fillColor   = _useGenericBackColor ? (_isDefault ? Colors.DarkBlueBackground : Colors.LightBackground) : BackColor.Multiply(Colors.Brightness);
            var hoverColor  = _useGenericBackColor ? (_isDefault ? Colors.BlueBackground : Colors.LighterBackground) : ControlPaint.Light(BackColor.Multiply(Colors.Brightness));

            if (Enabled)
            {
                if (Checked)
                {
                    fillColor = Colors.HighlightFill;

                    switch (ButtonState)
                    {
                    case DarkControlState.Hover:
                        borderColor = Colors.GreyHighlight;
                        break;

                    case DarkControlState.Normal:
                        borderColor = Colors.HighlightBase;
                        break;
                    }
                }
                else
                {
                    switch (ButtonStyle)
                    {
                    case DarkButtonStyle.Normal:
                        if (Focused && TabStop)
                        {
                            borderColor = Colors.BlueHighlight;
                        }

                        switch (ButtonState)
                        {
                        case DarkControlState.Hover:
                            fillColor = hoverColor;
                            break;

                        case DarkControlState.Pressed:
                            fillColor = Colors.DarkBackground;
                            break;
                        }
                        break;

                    case DarkButtonStyle.Flat:
                        switch (ButtonState)
                        {
                        case DarkControlState.Normal:
                            fillColor = Colors.GreyBackground;
                            break;

                        case DarkControlState.Hover:
                            fillColor = Colors.MediumBackground;
                            break;

                        case DarkControlState.Pressed:
                            fillColor = Colors.DarkBackground;
                            break;
                        }
                        break;
                    }
                }
            }
            else
            {
                textColor = Colors.DisabledText;
                fillColor = Colors.DarkGreySelection;
            }

            using (var b = new SolidBrush(fillColor))
            {
                g.FillRectangle(b, rect);
            }

            if (ButtonStyle == DarkButtonStyle.Normal)
            {
                using (var p = new Pen(borderColor, 1))
                {
                    var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);

                    g.DrawRectangle(p, modRect);
                }
            }

            var textOffsetX = 0;
            var textOffsetY = 0;

            if (Image != null)
            {
                var stringSize = g.MeasureString(Text, Font, rect.Size);

                var x = ClientSize.Width / 2 - Image.Size.Width / 2;
                var y = ClientSize.Height / 2 - Image.Size.Height / 2;

                switch (TextImageRelation)
                {
                case TextImageRelation.ImageAboveText:
                    textOffsetY = Image.Size.Height / 2 + ImagePadding / 2;
                    y           = y - ((int)(stringSize.Height / 2) + ImagePadding / 2);
                    break;

                case TextImageRelation.TextAboveImage:
                    textOffsetY = (Image.Size.Height / 2 + ImagePadding / 2) * -1;
                    y           = y + (int)(stringSize.Height / 2) + ImagePadding / 2;
                    break;

                case TextImageRelation.ImageBeforeText:
                    textOffsetX = Image.Size.Width + ImagePadding / 2;
                    x           = ImagePadding;
                    break;

                case TextImageRelation.TextBeforeImage:
                    x = x + (int)stringSize.Width;
                    break;
                }

                var imgRect = new Rectangle(x, y, Image.Width, Image.Height);
                g.DrawImage(Image, imgRect);

                // Dim brightness according to config
                using (var b = new SolidBrush(fillColor.MultiplyAlpha(1.0f - Colors.Brightness)))
                    g.FillRectangle(b, imgRect);
            }

            using (var b = new SolidBrush(textColor))
            {
                var modRect = new Rectangle(rect.Left + textOffsetX + Padding.Left,
                                            rect.Top + textOffsetY + Padding.Top, rect.Width - Padding.Horizontal,
                                            rect.Height - Padding.Vertical);

                if (Image != null)
                {
                    var stringFormat = new StringFormat
                    {
                        LineAlignment = StringAlignment.Center,
                        Alignment     = StringAlignment.Near,
                        Trimming      = StringTrimming.EllipsisCharacter
                    };

                    g.DrawString(Text, Font, b, modRect, stringFormat);
                }
                else
                {
                    var stringFormat = new StringFormat
                    {
                        LineAlignment = StringAlignment.Center,
                        Alignment     = StringAlignment.Center,
                        Trimming      = StringTrimming.EllipsisCharacter
                    };

                    g.DrawString(Text, Font, b, modRect, stringFormat);
                }
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            output.WriteBeginTag("table");
            output.WriteAttribute("cellpadding", "5");
            output.WriteAttribute("cellspacing", "0");
            output.WriteAttribute("border", "0");
            output.WriteAttribute("align", "center");
            output.WriteAttribute("width", Width.Value.ToString());
            output.Write(HtmlTextWriter.TagRightChar);

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("bgcolor", BackColor.ToString());
            output.Write(HtmlTextWriter.TagRightChar);

            output.WriteBeginTag("span");
            output.WriteAttribute("style", "borderWidth:0; borderColor:#ffffff; width:" + InnerWidth.ToString() + "; height:" + Height.Value.ToString() + ";\">");
            output.Write("<ilayer width=" + InnerWidth.ToString() + " height=" + Height.ToString() + " name=\"slider1\" bgcolor=\"" + BackColor.ToString() + " visibility=hide>");
            output.Write("<layer name=\"slider2\" onMouseOver=\"sspeed=0;\" onMouseOut=\"sspeed=" + scrollSpeed.ToString() + "\"></layer>");
            output.Write("</ilayer>");

            output.Write("<script language=\"JavaScript\">");
            output.Write("if (document.all){");
            output.Write("document.writeln('<marquee id=\"ieslider\" scrollAmount=" + scrollSpeed.ToString() + " width=" + InnerWidth.ToString() + " height=" + Height.ToString() + " direction=up style=\"border:0 solid grey;background-color:#ffffff\">')");
            output.Write("document.writeln(mymessage)");
            output.Write("ieslider.onmouseover=new Function(\"ieslider.scrollAmount=0\")");
            output.Write("ieslider.onmouseout=new Function(\"if (document.readyState=='complete') ieslider.scrollAmount=" + scrollSpeed.ToString() + "\")");
            output.Write("document.write('</marquee>')");
            output.Write("}");
            output.Write("if (document.getElementById&&!document.all){ ");
            output.Write("document.write('<div style=\"position:relative;overflow:hidden;width:" + InnerWidth.ToString() + ";height:" + Height.ToString() + ";clip:rect(0 302 102 0); background-color:#ffffff;border:0px solid white;\" onMouseover=\"sspeed=0;\" onMouseout=\"sspeed=" + scrollSpeed.ToString() + "\">')");
            output.Write("document.write('<div id=\"slider\" style=\"position:relative;width:&{swidth};\">')");
            output.Write("document.write('</div></div>')");
            output.Write("}");
            output.Write("</script>");

            output.WriteEndTag("span");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");
            output.WriteEndTag("table");
        }
Ejemplo n.º 25
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (firstpaint)
            {
                System.ComponentModel.IContainer ic = this.GetParentContainerComponents();

                ic?.CopyToolTips(this, new Control[] { this, _cbsystem });

                firstpaint = false;
            }

            base.OnPaint(e);

            if (this.FlatStyle != FlatStyle.System)
            {
                int extraborder     = 1;
                int texthorzspacing = 1;

                textBoxBackArea = new Rectangle(ClientRectangle.X + extraborder, ClientRectangle.Y + extraborder,
                                                ClientRectangle.Width - 2 * extraborder, ClientRectangle.Height - 2 * extraborder);

                topBoxTextArea = new Rectangle(ClientRectangle.X + extraborder + texthorzspacing, ClientRectangle.Y + extraborder,
                                               ClientRectangle.Width - 2 * extraborder - 2 * texthorzspacing - ScrollBarWidth, ClientRectangle.Height - 2 * extraborder);

                arrowRectangleArea = new Rectangle(ClientRectangle.Width - ScrollBarWidth - extraborder, ClientRectangle.Y + extraborder,
                                                   ScrollBarWidth, ClientRectangle.Height - 2 * extraborder);

                topBoxOutline = new Rectangle(ClientRectangle.X, ClientRectangle.Y,
                                              ClientRectangle.Width - 1, ClientRectangle.Height - 1);


                int hoffset = arrowRectangleArea.Width / 3;
                int voffset = arrowRectangleArea.Height / 3;
                arrowpt1 = new Point(arrowRectangleArea.X + hoffset, arrowRectangleArea.Y + voffset);
                arrowpt2 = new Point(arrowRectangleArea.X + arrowRectangleArea.Width / 2, arrowRectangleArea.Y + arrowRectangleArea.Height - voffset);
                arrowpt3 = new Point(arrowRectangleArea.X + arrowRectangleArea.Width - hoffset, arrowpt1.Y);

                arrowpt1c = new Point(arrowpt1.X, arrowpt2.Y);
                arrowpt2c = new Point(arrowpt2.X, arrowpt1.Y);
                arrowpt3c = new Point(arrowpt3.X, arrowpt2.Y);

                Brush textb;
                Pen   p, p2;

                bool todraw = Enabled && Items.Count > 0;

                if (todraw)
                {
                    textb    = new SolidBrush(this.ForeColor);
                    p        = new Pen(BorderColor);
                    p2       = new Pen(ForeColor);
                    p2.Width = ArrowWidth;
                }
                else
                {
                    textb = new SolidBrush(ForeColor.Multiply(0.5F));
                    p     = new Pen(BorderColor.Multiply(0.5F));
                    p2    = null;
                }

                e.Graphics.DrawRectangle(p, topBoxOutline);

                Color bck;

                if (todraw)
                {
                    bck = (mouseover) ? MouseOverBackgroundColor : BackColor;
                }
                else
                {
                    bck = DisableBackgroundDisabledShadingGradient ? BackColor : BackColor.Multiply(0.5F);
                }

                Brush bbck;

                if (FlatStyle == FlatStyle.Popup && !DisableBackgroundDisabledShadingGradient)
                {
                    bbck = new System.Drawing.Drawing2D.LinearGradientBrush(textBoxBackArea, bck, bck.Multiply(ButtonColorScaling), 90);
                }
                else
                {
                    bbck = new SolidBrush(bck);
                }

                e.Graphics.FillRectangle(bbck, textBoxBackArea);

                //using (Brush test = new SolidBrush(Color.Red)) e.Graphics.FillRectangle(test, topBoxTextArea); // used to check alignment

                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                if (p2 != null)
                {
                    if (isActivated)
                    {
                        e.Graphics.DrawLine(p2, arrowpt1c, arrowpt2c);            // the arrow!
                        e.Graphics.DrawLine(p2, arrowpt2c, arrowpt3c);
                    }
                    else
                    {
                        e.Graphics.DrawLine(p2, arrowpt1, arrowpt2);            // the arrow!
                        e.Graphics.DrawLine(p2, arrowpt2, arrowpt3);
                    }
                }

                using (var fmt = ControlHelpersStaticFunc.StringFormatFromContentAlignment(RtlTranslateAlignment(TextAlign)))
                {
                    fmt.FormatFlags = StringFormatFlags.NoWrap;
                    e.Graphics.DrawString(this.Text, this.Font, textb, topBoxTextArea, fmt);
                }

                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;

                bbck.Dispose();

                textb.Dispose();
                p.Dispose();

                if (p2 != null)
                {
                    p2.Dispose();
                }
            }
        }
Ejemplo n.º 26
0
        private void PaintCompass()
        {
            compass?.Dispose();     // ensure we are clean
            compass = null;

            pixelsperdegree = (double)this.Width / (double)WidthDegrees;

            int bitmapwidth  = (int)(360 * pixelsperdegree);       // size of bitmap
            int bitmapheight = Height * CompassHeightPercentage / 100;

            //System.Diagnostics.Debug.WriteLine("Compass width " + this.Width + " deg width " + WidthDegrees + " pix/deg " + pixelsperdegree);

            if (!DesignMode)        // for some reason, FromImage craps it out
            {
                compass = new Bitmap(bitmapwidth, bitmapheight);

                using (Graphics g = Graphics.FromImage(compass))
                {
                    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;

                    if (!BackColor.IsFullyTransparent())
                    {
                        using (Brush b = new SolidBrush(BackColor))
                            g.FillRectangle(b, new Rectangle(0, 0, compass.Width, compass.Height));

                        textsmoothingmode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                    }
                    else
                    {
                        textsmoothingmode = System.Drawing.Drawing2D.SmoothingMode.None;
                    }

                    int yline = 0;

                    SizeF sz = g.MeasureString("360", Font);
                    fontline = bitmapheight - (int)(sz.Height + 1);
                    int bigtickdepth   = bitmapheight * TickHeightPercentage / 100;
                    int smalltickdepth = bigtickdepth / 2;

                    int stmajor = stencilmajortickat;
                    int stminor = stencilminortickat;

                    if (autosetstencilticks)
                    {
                        double minmajorticks = sz.Width / pixelsperdegree;
                        // System.Diagnostics.Debug.WriteLine("Major min ticks at {0} = {1}", sz.Width, minmajorticks);
                        if (minmajorticks >= 40)
                        {
                            stmajor = 80; stminor = 20;
                        }
                        else if (minmajorticks >= 20)
                        {
                            stmajor = 40; stminor = 10;
                        }
                        else if (minmajorticks >= 10)
                        {
                            stmajor = 20; stminor = 5;
                        }
                        else
                        {
                            stmajor = 10; stminor = 2;
                        }
                    }

                    Color sc    = Enabled ? StencilColor : StencilColor.Multiply(0.5F);
                    Pen   p1    = new Pen(sc, 1);
                    Pen   p2    = new Pen(sc, 2);
                    Brush textb = new SolidBrush(Enabled ? this.ForeColor : this.ForeColor.Multiply(0.5F));
                    var   fmt   = ControlHelpersStaticFunc.StringFormatFromContentAlignment(ContentAlignment.MiddleCenter);

                    for (int d = pixelstart; d < 360 + pixelstart; d++)
                    {
                        int x = (int)((d - pixelstart) * pixelsperdegree);

                        bool majortick = d % stmajor == 0;
                        bool minortick = (d % stminor == 0) && !majortick;

                        if (majortick)
                        {
                            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
                            g.DrawLine(p2, new Point(x, yline), new Point(x, yline + bigtickdepth));
                            g.SmoothingMode = textsmoothingmode;
                            g.DrawString(ToVisual(d).ToStringInvariant(), this.Font, textb, new Rectangle(x - 30, fontline, 60, compass.Height - fontline), fmt);

                            //DEBUG g.DrawLine(p1, x - sz.Width / 2, fontline, x + sz.Width / 2, fontline);
                        }

                        if (minortick)
                        {
                            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
                            g.DrawLine(p1, new Point(x, yline), new Point(x, yline + smalltickdepth));
                        }
                    }

                    p1.Dispose();
                    p2.Dispose();
                    textb.Dispose();
                    fmt.Dispose();
                }
            }
            else
            {           // FromImage above crashes the designer..
                emergencydesignlabel          = new Label();
                emergencydesignlabel.Location = new Point(10, 10);
                emergencydesignlabel.AutoSize = true;
                emergencydesignlabel.Text     = "Compass.. FromImage crashes designer";
                this.BackColor = Color.LightBlue;
                Controls.Add(emergencydesignlabel);
            }
        }
Ejemplo n.º 27
0
        private void DrawColorSemicircle(Graphics g)
        {
            Rectangle bounds = GetSemicircleBounds();

            if (bounds.Width <= 0 || bounds.Height <= 0)
            {
                return;
            }

            GraphicsPath gp = new GraphicsPath();

            gp.AddPie(new Rectangle(-bounds.Width, bounds.Y, bounds.Width * 2, bounds.Height), -90, 180);
            Rectangle           roundBounds = new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height);
            LinearGradientBrush lgb         = new LinearGradientBrush(roundBounds, BackColor.Lighter(.5F), BackColor.Darker(.5F), LinearGradientMode.ForwardDiagonal);

            g.FillPath(lgb, gp);
            lgb.Dispose();
            gp.Dispose();

            gp = new GraphicsPath();

            Rectangle innerRound = GetInnerSemicircleBounds();

            if (innerRound.Width <= 0 || innerRound.Height <= 0)
            {
                return;
            }
            gp.AddPie(new Rectangle(innerRound.X - innerRound.Width, innerRound.Y, innerRound.Width * 2, innerRound.Height), -90, 180);
            PointF     center = new PointF(innerRound.X + innerRound.Width / 2, innerRound.Y + innerRound.Height / 2);
            float      x      = center.X - innerRound.Width;
            float      y      = center.Y - innerRound.Height;
            float      w      = innerRound.Width * 2;
            float      h      = innerRound.Height * 2;
            RectangleF circum = new RectangleF(x, y, w, h);

            GraphicsPath coloring = new GraphicsPath();

            coloring.AddEllipse(circum);
            PathGradientBrush pgb = new PathGradientBrush(coloring);

            pgb.CenterColor    = _color.Lighter(.2F);
            pgb.SurroundColors = new[] { _color.Darker(.2F) };
            pgb.CenterPoint    = new PointF(innerRound.X + 3, innerRound.Y + innerRound.Height / 3);
            g.FillPath(pgb, gp);
            lgb.Dispose();
            gp.Dispose();
        }
Ejemplo n.º 28
0
 public bool Equals(HeaderFooterTemplateItem other)
 {
     return(base.Equals(other) &&
            (WantDivider == other.WantDivider) &&
            (BackColor.ToArgb() == other.BackColor.ToArgb()));
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Controls the actual drawing for this gradient slider control.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="clipRectangle"></param>
        protected virtual void OnDraw(Graphics g, Rectangle clipRectangle)
        {
            GraphicsPath gp        = new GraphicsPath();
            Rectangle    innerRect = new Rectangle(_leftHandle.Width, 3, Width - 1 - _rightHandle.Width - _leftHandle.Width,
                                                   Height - 1 - 6);

            gp.AddRoundedRectangle(innerRect, 2);

            if (Width == 0 || Height == 0)
            {
                return;
            }
            // Create a rounded gradient effect as the backdrop that other colors will be drawn to
            LinearGradientBrush silver = new LinearGradientBrush(ClientRectangle, BackColor.Lighter(.2F), BackColor.Darker(.6F), LinearGradientMode.Vertical);

            g.FillPath(silver, gp);
            silver.Dispose();

            LinearGradientBrush lgb = new LinearGradientBrush(innerRect, MinimumColor, MaximumColor, LinearGradientMode.Horizontal);

            g.FillPath(lgb, gp);
            lgb.Dispose();

            g.DrawPath(Pens.Gray, gp);
            gp.Dispose();

            if (Enabled)
            {
                _leftHandle.Draw(g);
                _rightHandle.Draw(g);
            }
        }
Ejemplo n.º 30
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (firstpaint)
            {
                System.ComponentModel.IContainer ic = this.GetParentContainerComponents();

                if (ic != null)    // yes we have a container object
                {
                    ic.CopyToolTips(this, new Control[] { this, _cbsystem });
                }

                firstpaint = true;
            }

            base.OnPaint(e);

            if (this.FlatStyle != FlatStyle.System)
            {
                int extraborder = 1;

                topBoxTextArea = new Rectangle(ClientRectangle.X + extraborder, ClientRectangle.Y + extraborder,
                                               ClientRectangle.Width - 2 * extraborder - ScrollBarWidth, ClientRectangle.Height - 2 * extraborder);

                arrowRectangleArea = new Rectangle(ClientRectangle.Width - ScrollBarWidth - extraborder, ClientRectangle.Y + extraborder,
                                                   ScrollBarWidth, ClientRectangle.Height - 2 * extraborder);

                topBoxOutline = new Rectangle(ClientRectangle.X, ClientRectangle.Y,
                                              ClientRectangle.Width - 1, ClientRectangle.Height - 1);

                topBoxTextTotalArea = new Rectangle(ClientRectangle.X + extraborder, ClientRectangle.Y + extraborder,
                                                    ClientRectangle.Width - 2 * extraborder, ClientRectangle.Height - 2 * extraborder);

                int hoffset = arrowRectangleArea.Width / 3;
                int voffset = arrowRectangleArea.Height / 3;
                arrowpt1 = new Point(arrowRectangleArea.X + hoffset, arrowRectangleArea.Y + voffset);
                arrowpt2 = new Point(arrowRectangleArea.X + arrowRectangleArea.Width / 2, arrowRectangleArea.Y + arrowRectangleArea.Height - voffset);
                arrowpt3 = new Point(arrowRectangleArea.X + arrowRectangleArea.Width - hoffset, arrowpt1.Y);

                arrowpt1c = new Point(arrowpt1.X, arrowpt2.Y);
                arrowpt2c = new Point(arrowpt2.X, arrowpt1.Y);
                arrowpt3c = new Point(arrowpt3.X, arrowpt2.Y);

                SizeF sz = e.Graphics.MeasureString("Represent THIS", this.Font);
                topBoxTextArea.Y += (topBoxTextArea.Height - (int)sz.Height) / 2;

                Brush textb;
                Pen   p, p2;

                bool todraw = Enabled && Items.Count > 0;

                if (todraw)
                {
                    textb    = new SolidBrush(this.ForeColor);
                    p        = new Pen(BorderColor);
                    p2       = new Pen(ForeColor);
                    p2.Width = ArrowWidth;
                }
                else
                {
                    textb = new SolidBrush(ForeColor.Multiply(0.5F));
                    p     = new Pen(BorderColor.Multiply(0.5F));
                    p2    = null;
                }

                e.Graphics.DrawRectangle(p, topBoxOutline);

                Color bck;

                if (todraw)
                {
                    bck = (mouseover) ? MouseOverBackgroundColor : BackColor;
                }
                else
                {
                    bck = BackColor.Multiply(0.5F);
                }

                Brush bbck;

                if (FlatStyle == FlatStyle.Popup)
                {
                    bbck = new System.Drawing.Drawing2D.LinearGradientBrush(topBoxTextTotalArea, bck, bck.Multiply(ButtonColorScaling), 90);
                }
                else
                {
                    bbck = new SolidBrush(bck);
                }

                e.Graphics.FillRectangle(bbck, topBoxTextTotalArea);

                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                if (p2 != null)
                {
                    if (isActivated)
                    {
                        e.Graphics.DrawLine(p2, arrowpt1c, arrowpt2c);            // the arrow!
                        e.Graphics.DrawLine(p2, arrowpt2c, arrowpt3c);
                    }
                    else
                    {
                        e.Graphics.DrawLine(p2, arrowpt1, arrowpt2);            // the arrow!
                        e.Graphics.DrawLine(p2, arrowpt2, arrowpt3);
                    }
                }

                using (StringFormat f = new StringFormat()
                {
                    Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Near, FormatFlags = StringFormatFlags.NoWrap
                })
                    e.Graphics.DrawString(this.Text, this.Font, textb, topBoxTextArea, f);

                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;

                bbck.Dispose();

                textb.Dispose();
                p.Dispose();

                if (p2 != null)
                {
                    p2.Dispose();
                }
            }
        }