protected override void OnDrawItem(DrawItemEventArgs e)
            {
                if (e.Index != -1)
                {
                    ParentCategoryComboItem comboItem = Items[e.Index] as ParentCategoryComboItem;

                    e.DrawBackground();

                    // don't indent for main display of category
                    string text = comboItem != null?comboItem.ToString() : "";

                    if (e.Bounds.Width < Width)
                    {
                        text = text.Trim();
                    }

                    Color textColor = ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                                          ? SystemColors.HighlightText
                                          : comboItem.TextColor;

                    BidiGraphics bg = new BidiGraphics(e.Graphics, e.Bounds);
                    bg.DrawText(text, e.Font, e.Bounds, textColor, TextFormatFlags.NoPrefix);

                    e.DrawFocusRectangle();
                }
            }
Beispiel #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, _controlRect);

            //draw the splitter line
            GraphicsHelper.TileFillScaledImageHorizontally(g, extendedEntrySeparatorTileImage, _lineRect);

            //draw the More... box
            Color backgroundColor = Color.FromArgb(128, 128, 128);
            SizeF moreTextSize    = g.MeasureText(_moreText, font);
            int   morePadding     = 0;
            int   moreRightOffset = 1;

            Size      moreRectSize     = new Size(Convert.ToInt32(moreTextSize.Width) + morePadding * 2, Convert.ToInt32(moreTextSize.Height) + morePadding * 2);
            Point     moreRectLocation = new Point(_controlRect.Right - moreRectSize.Width - moreRightOffset, _lineRect.Bottom);
            Rectangle moreRect         = new Rectangle(moreRectLocation, moreRectSize);

            // It's necessary to double-buffer the text drawing, because GDI
            // text drawing doesn't work well in these behavior controls.
            using (Bitmap bitmap = new Bitmap(moreRect.Width, moreRect.Height))
            {
                using (Graphics moreG = Graphics.FromImage(bitmap))
                {
                    using (SolidBrush b = new SolidBrush(backgroundColor))
                        moreG.FillRectangle(b, 0, 0, moreRect.Width, moreRect.Height);
                    new BidiGraphics(moreG, moreRect.Size).DrawText(_moreText, font, new Rectangle(Point.Empty, moreRect.Size), Color.White, backgroundColor, TextFormatFlags.Default);
                }

                g.DrawImage(false, bitmap, moreRect);
            }
        }
        /// <summary>
        /// When publishing a video, this will create the image that put in the placeholder spot for the video.
        /// </summary>
        /// <param name="message">A message that will be drawn on the image</param>
        /// <returns></returns>
        private Bitmap CreateMockPlayer(string message)
        {
            // Draw the status on the image
            Bitmap img = ImageHelper2.CreateResizedBitmap(ResourceHelper.LoadAssemblyResourceBitmap("Video.Images.MockPlayer.png"),
                                                          HtmlSize.Width,
                                                          HtmlSize.Height,
                                                          ImageFormat.Png);

            try
            {
                using (Graphics g = Graphics.FromImage(img))
                {
                    BidiGraphics bidiGraphics = new BidiGraphics(g, img.Size);
                    if (VideoHasError())
                    {
                        DrawErrorMockPlayer(img, bidiGraphics, message);
                    }
                    else
                    {
                        DrawStatusMockPlayer(img, bidiGraphics, message);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Error while creating a placeholder for a video: " + ex);
                return(null);
            }

            return(img);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            //get the rectangle representing the text in the label
            Rectangle textRectangle = GetMeasuredTextRectangle();

            //paint the line bevels to the left and right of the text
            if (textRectangle.Left != 0)
            {
                Rectangle leftRectangle = new Rectangle(0,
                                                        (Utility.Center(bevel.Height, textRectangle.Height) + textRectangle.Top + BEVEL_TEXT_MIDDLE_OFFSET),
                                                        textRectangle.X,
                                                        bevel.Height
                                                        );
                GraphicsHelper.TileFillScaledImageHorizontally(g, bevel, leftRectangle);
            }
            if (textRectangle.Right != ClientRectangle.Right)
            {
                int       startX         = textRectangle.Right + 3;
                Rectangle rightRectangle = new Rectangle(startX,
                                                         Utility.Center(bevel.Height, textRectangle.Height) + textRectangle.Top + BEVEL_TEXT_MIDDLE_OFFSET,
                                                         ClientRectangle.Width - startX,
                                                         bevel.Height
                                                         );
                GraphicsHelper.TileFillScaledImageHorizontally(g, bevel, rightRectangle);
            }
        }
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">A PaintEventArgs that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            //	Call the base class's method so that registered delegates receive the event.
            base.OnPaint(e);

            Graphics g = e.Graphics;

            //	Obtain the bitmap to draw and, if there is one, draw it.
            Bitmap bitmap = BitmapToDraw;

            if (bitmap != null)
            {
                //	Fill the offscreen graphics context with the background color.
                if (UseVirtualTransparency)
                {
                    VirtualTransparency.VirtualPaint(this, new PaintEventArgs(g, ClientRectangle));
                }
                else
                {
                    using (SolidBrush solidBrush = new SolidBrush(BackColor))
                        g.FillRectangle(solidBrush, ClientRectangle);
                }

                BidiGraphics bg     = new BidiGraphics(g, ClientRectangle, RightToLeft);
                Rectangle    bounds = new Rectangle(Point.Empty, bitmap.Size);
                bg.DrawImage(true, bitmap, bounds);
            }
        }
Beispiel #6
0
            public void Paint(BidiGraphics g, Rectangle bounds)
            {
                using (g.Container(bounds.X, bounds.Y))
                {
                    g.Graphics.CompositingMode    = CompositingMode.SourceOver;
                    g.Graphics.CompositingQuality = CompositingQuality.HighQuality;


                    using (Font boldFont = new Font(_font, FontStyle.Bold))
                    {
                        Rectangle providerNameRect = new Rectangle(_providerNameLeft, 4, _providerNameWidth, _providerNameHeight);

                        if (_image != null)
                        {
                            g.DrawImage(false, _image, (int)(providerNameRect.Left - _image.Width - IMAGE_PADDING_RIGHT), (int)(providerNameRect.Top - 1));
                        }

                        g.DrawText(_providerName, boldFont, providerNameRect, Color.White, _textFormatFlags);
                    }

                    g.DrawText(_blogName, _font, new Rectangle(PADDING_LEFT, 23, _blogNameWidth, _providerNameHeight), Color.White, _textFormatFlags);
                }

                // This is down here because DrawIcon has a bug (at least with .NET 1.1) where it
                // doesn't respect any translation transforms that have been applied to the Graphics
                // object in GDI+.
                if (_image == null && _icon != null)
                {
                    g.DrawIcon(false, _icon, new Rectangle(bounds.Left + _imageLeft, bounds.Top + 3, IconWidth, IconHeight));
                }
            }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            int textX = 0;

            if (ShowIcon)
            {
                g.DrawImage(false, _tipIcon, new Point(0, (Height / 2) - (_tipIcon.Height / 2)));
                textX = _tipIcon.Width + 2;
            }

            if (TipText != null)
            {
                TextFormatFlags flags = TextFormatFlags.WordBreak | TextFormatFlags.EndEllipsis;

                // setup text rect
                Rectangle textRectangle = new Rectangle(textX, 0, Width - textX - 3, Height);

                // draw string
                g.DrawText(TipText, Font, textRectangle, Color.FromArgb(GraphicsHelper.Opacity(TextOpacityPct), ForeColor), flags);
            }
        }
Beispiel #8
0
        protected override void OnPaint(PaintEventArgs e)
        {
            BidiGraphics g = new BidiGraphics(e.Graphics, _controlRectangle);

            Color backgroundColor = ColorizedResources.Instance.SidebarGradientBottomColor;

            using (Brush brush = new SolidBrush(backgroundColor))
                g.FillRectangle(brush, _controlRectangle);

            if (!(_image == null && (Text == null || Text == string.Empty)))
            {
                // draw the border
                using (Pen pen = new Pen(ColorizedResources.Instance.BorderLightColor))
                {
                    g.DrawLine(pen, _controlRectangle.Left, _controlRectangle.Top, _controlRectangle.Width, _controlRectangle.Top);
                    g.DrawLine(pen, _controlRectangle.Left, _controlRectangle.Bottom, _controlRectangle.Width, _controlRectangle.Bottom);
                }

                // draw the image
                if (_image != null)
                {
                    g.DrawImage(true, _image, new Rectangle(_imageRectangle.Left, _imageRectangle.Top, _image.Width, _image.Height));
                }

                // draw the text
                g.DrawText(Text, ApplicationManager.ApplicationStyle.NormalApplicationFont,
                           new Rectangle(_textRectangle.X, _textRectangle.Y, _textRectangle.Width, _textRectangle.Height),
                           ApplicationManager.ApplicationStyle.PrimaryWorkspaceCommandBarTextColor,
                           _stringFormat);
            }
        }
Beispiel #9
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, e.ClipRectangle);

            int shadowHeight = _dropShadowTop.Height;

            Rectangle r = VirtualClientRectangle;

            r.Y      = 0;
            r.Height = shadowHeight;

            GraphicsHelper.TileFillScaledImageHorizontally(g, _dropShadowTop, r);


            shadowHeight = ColorizedResources.Instance.DropShadowBitmap.Height;

            r        = VirtualClientRectangle;
            r.Y      = VirtualHeight - shadowHeight;
            r.Height = shadowHeight;
            e.Graphics.FillRectangle(Brushes.White, r);

            GraphicsHelper.TileFillScaledImageHorizontally(g, ColorizedResources.Instance.DropShadowBitmap, r);

            if (_drawVerticalLine && _verticalLineX > -1)
            {
                using (Pen p = new Pen(ColorizedResources.Instance.BorderDarkColor))
                    e.Graphics.DrawLine(p, _verticalLineX, r.Y, _verticalLineX, VirtualClientRectangle.Bottom);
            }
        }
Beispiel #10
0
        private void DrawTabContents(BidiGraphics g, Color textColor)
        {
            Rectangle logicalClientRect = ClientRectangle;

            if (!Selected)
            {
                logicalClientRect.Height -= 2;
            }

            // Make up for the top "border" being just off the top of the control
            logicalClientRect.Y      -= 1;
            logicalClientRect.Height += 1;

            if (clipLeftBorder)
            {
                logicalClientRect.X     -= 1;
                logicalClientRect.Width += 1;
            }

            if (clipRightBorder)
            {
                logicalClientRect.Width += 1;
            }

            g.DrawText(Text, Font, logicalClientRect, textColor, Color.Transparent, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);

//            if (Focused)
//            {
//                Rectangle rect = logicalClientRect;
//                rect.Inflate(-2, -2);
//                g.DrawFocusRectangle(rect);
//            }
        }
Beispiel #11
0
        protected override void OnPaint(PaintEventArgs args)
        {
            base.OnPaint(args);

            BidiGraphics g = new BidiGraphics(args.Graphics, ClientRectangle);

            g.DrawText(Text, Font, ClientRectangle, SystemColors.ControlText, TextFormatFlags);
        }
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            g.DrawText(Res.Get(StringId.MapSeeInBirdseye), Font,
                       new Rectangle(ScaleX(TEXT_INSET), 0, Width - ScaleX(TEXT_INSET + 5), Height), Color.Black, TextFormatFlags.VerticalCenter | TextFormatFlags.WordBreak);
        }
Beispiel #13
0
        /// <summary>
        /// Draw the image and the text overlay
        /// </summary>
        public override void Draw(BidiGraphics g, Font font, Rectangle thumbnailRect)
        {
            // draw the image
            base.Draw(g, font, thumbnailRect);

            // calculate the rectangle for the text then draw it
            Rectangle textRect = new Rectangle(thumbnailRect.X + (int)(thumbnailRect.Width * 0.1F), thumbnailRect.Y, (int)(thumbnailRect.Width * 0.8F), thumbnailRect.Height);

            g.DrawText(_textOverlay, font, textRect, Color.Gray, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter | TextFormatFlags.WordBreak);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            Point logoLocation = new Point(HORIZONTAL_INSET, VERTICAL_INSET);

            g.DrawImage(false, _bingLogoBitmap, new Rectangle(logoLocation, _bingLogoBitmap.Size));
        }
Beispiel #15
0
        private void DrawTabFace(BidiGraphics g, Color bgColor, Color borderColor, Color lineColor)
        {
            Rectangle borderRect = ClientRectangle;

            if (!Selected)
            {
                borderRect.Height -= 2;
            }

            // Remove one pixel for the bottom edge of the tab.
            // We don't want it filled in by the face color as
            // that would cause the corner pixels of the tab
            // to be filled in.
            borderRect.Height -= 1;

            using (Brush b = new SolidBrush(bgColor))
                g.Graphics.FillRectangle(b, borderRect);

            borderRect.Width -= 1;

            if (Selected)
            {
                borderRect.Y -= 1;
            }
            else
            {
                borderRect.Height -= 1;
            }

            if (clipLeftBorder)
            {
                borderRect.X     -= 1;
                borderRect.Width += 1;
            }

            if (clipRightBorder)
            {
                borderRect.Width += 1;
            }

            Region clip = g.Graphics.Clip;

            clip.Exclude(g.TranslateRectangle(new Rectangle(borderRect.X, borderRect.Bottom, 1, 1)));
            clip.Exclude(g.TranslateRectangle(new Rectangle(borderRect.Right, borderRect.Bottom, 1, 1)));
            g.Graphics.Clip = clip;

            using (Pen p = new Pen(borderColor))
                g.DrawRectangle(p, borderRect);

            if (!Selected)
            {
                using (Pen p = new Pen(lineColor))
                    g.DrawLine(p, 0, 0, ClientSize.Width, 0);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Raises the DrawItem event.
        /// </summary>
        /// <param name="e">A DrawItemEventArgs that contains the event data.</param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            //	Call the base class's method.
            base.OnDrawItem(e);

            //	Do the menu hack.
            MenuHack(e);

            //	Draw the menu item.
            if (Parent is MainMenu)
            {
                DrawMainMenuItem(e);
                //	Draw the offscreen bitmap.
                //BidiGraphics g = new BidiGraphics(e.Graphics, new Size(GetMainMenu().GetForm().Width, e.Bounds.Height));
                //g.DrawImage(false, offscreenBitmap, e.Bounds.Location);
            }
            else
            {
                //	If we have an offscreen bitmap, and it's the wrong size, dispose of it.
                //  Add try/catch due to lots of Watson-reported crashes here
                //    on offscreenBitmap.Size ("object is in use elsewhere" yadda yadda)
                try
                {
                    if (offscreenBitmap != null && offscreenBitmap.Size != e.Bounds.Size)
                    {
                        offscreenBitmap.Dispose();
                        offscreenBitmap = null;
                    }
                }
                catch (Exception ex)
                {
                    Trace.Fail(ex.ToString());
                    offscreenBitmap = null;
                }

                //	Allocate the offscreen bitmap, if we don't have one cached.
                if (offscreenBitmap == null)
                {
                    offscreenBitmap = new Bitmap(e.Bounds.Width, e.Bounds.Height);
                }

                DrawMenuItem(e.State, e.Bounds);
                //	Draw the offscreen bitmap.
                BidiGraphics g = new BidiGraphics(e.Graphics, e.Bounds);
                //in the main menu drop downs, the highlight rectangle is off by one
                Point location = e.Bounds.Location;
                if (e.Graphics.VisibleClipBounds.X == -1.0)
                {
                    location.X += 1;
                }

                g.DrawImage(false, offscreenBitmap, location);
            }
        }
Beispiel #17
0
 private static void TileFillScaledImageHorizontally(BidiGraphics graphics, Image image, Rectangle rectangle, Rectangle srcRectangle)
 {
     for (int x = rectangle.X; x < rectangle.Right; x += srcRectangle.Width)
     {
         graphics.DrawImage(true,
                            image,
                            new Rectangle(x, rectangle.Y, Math.Min(srcRectangle.Width, rectangle.Right - x), rectangle.Height),
                            srcRectangle,
                            GraphicsUnit.Pixel);
     }
 }
Beispiel #18
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">A PaintEventArgs that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            //	Paint.
            g.DrawText(Text, Font, ClientRectangle, Color.FromArgb(GraphicsHelper.Opacity(Enabled ? 100.0 : 50.0), ForeColor), stringFormat);

            Size size = new Size(ClientSize.Width, ClientSize.Height);

            measuredTextSize = g.MeasureText(Text, Font, size, stringFormat);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            StringFormat format = new StringFormat();

            format.LineAlignment = StringAlignment.Center;
            Rectangle rectangle = ClientRectangle;

            // draw text
            g.DrawText(HeaderText, _font, rectangle, ColorizedResources.Instance.SidebarHeaderTextColor, TextFormatFlags.VerticalCenter);
        }
Beispiel #20
0
        protected override void OnPaint(PaintEventArgs e)
        {
            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            using (Brush b = new SolidBrush(ColorizedResources.Instance.BorderDarkColor))
                g.FillRectangle(b, ClientRectangle);

            TextFormatFlags tf    = TextFormatFlags.VerticalCenter;
            int             width = g.MeasureText(Text, Font).Width;

            g.DrawText(Text, Font, new Rectangle(20, -1, width, ClientSize.Height), _uiTheme.TextColor, tf);
        }
        private static void DrawSystemButtonFace(BidiGraphics graphics, bool DropDownContextMenuUserInterface, bool contextMenuShowing, Rectangle VirtualClientRectangle, bool isLargeButton, ButtonSettings settings)
        {
            // calculate bitmaps
            Bitmap hoverButtonFace   = isLargeButton ? buttonFaceBitmapLarge : buttonFaceBitmap;
            Bitmap pressedButtonFace = isLargeButton ? buttonFacePushedBitmapLarge : buttonFacePushedBitmap;

            // draw button face
            DrawSystemButtonFace(graphics,
                                 DropDownContextMenuUserInterface,
                                 VirtualClientRectangle,
                                 hoverButtonFace,
                                 contextMenuShowing ? pressedButtonFace : hoverButtonFace,
                                 isLargeButton,
                                 settings);
        }
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">A PaintEventArgs that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            //	Call the base class's method so that registered delegates receive the event.
            base.OnPaint(e);

            if (!string.IsNullOrEmpty(text))
            {
                BidiGraphics bidiGraphics = new BidiGraphics(e.Graphics, VirtualSize);
                bidiGraphics.DrawText(text,
                                      ApplicationManager.ApplicationStyle.NormalApplicationFont,
                                      textLayoutRectangle,
                                      Color.Black,
                                      textFormatFlags | TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.NoPadding);
            }
        }
Beispiel #23
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            // draw icon
            if (_domainImage != null)
            {
                g.DrawImage(false, _domainImage, new Rectangle(0, 0, _domainImageSize.Width, _domainImageSize.Height));
            }
            else if (_domainIcon != null)
            {
                g.DrawIcon(false, _domainIcon, new Rectangle(0, 0, _domainImageSize.Width, _domainImageSize.Height));
            }
        }
Beispiel #24
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            if (topBorderColor != Color.Transparent)
            {
                using (Pen p = new Pen(topBorderColor))
                    e.Graphics.DrawLine(p, 0, 0, Width, 0);
            }

            if (DrawShadow)
            {
                BidiGraphics g = new BidiGraphics(e.Graphics, e.ClipRectangle);
                GraphicsHelper.TileFillScaledImageHorizontally(g, ColorizedResources.Instance.DropShadowBitmap, new Rectangle(0, 0, ShadowWidth, ColorizedResources.Instance.DropShadowBitmap.Height));
            }

            base.OnPaint(e);
        }
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">A PaintEventArgs that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs args)
        {
            if (!TabEntry.Hidden)
            {
                //	Call the base class's method so that registered delegates receive the event.
                base.OnPaint(args);

                BidiGraphics g = new BidiGraphics(args.Graphics, VirtualClientRectangle);

                //	Draw the tab.
                DrawTab(g);

                //	Draw the tab bitmap.
                if (!bitmapRectangle.IsEmpty)
                {
                    g.DrawImage(false, TabEntry.TabPageControl.TabBitmap, bitmapRectangle);
                }

                //	Draw tab text.
                if (!textLayoutRectangle.IsEmpty)
                {
                    //	Select the text color to use.
                    Color textColor;
                    if (tabEntry.IsSelected)
                    {
                        textColor = TabEntry.TabPageControl.ApplicationStyle.ActiveTabTextColor;
                    }
                    else
                    {
                        textColor = TabEntry.TabPageControl.ApplicationStyle.InactiveTabTextColor;
                    }

                    Rectangle tempRect = textLayoutRectangle;
                    //	Draw the tab text.
                    g.DrawText(TabEntry.TabPageControl.TabText,
                               TabEntry.TabPageControl.ApplicationStyle.NormalApplicationFont,
                               tempRect,
                               textColor,
                               textFormatFlags);
                }
            }

            if (Focused)
            {
                ControlPaint.DrawFocusRectangle(args.Graphics, VirtualClientRectangle, Parent.ForeColor, Parent.BackColor);
            }
        }
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">A PaintEventArgs that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            BidiGraphics g = new BidiGraphics(e.Graphics, VirtualClientRectangle);

            //	Fill the background.
            if (TopColor == BottomColor)
            {
                using (SolidBrush solidBrush = new SolidBrush(TopColor))
                    g.FillRectangle(solidBrush, VirtualClientRectangle);
            }
            else
            {
                using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(VirtualClientRectangle, TopColor, BottomColor, LinearGradientMode.Vertical))
                    g.FillRectangle(linearGradientBrush, VirtualClientRectangle);
            }

            //	Draw the first line of the top bevel, if we should.
            if (TopBevelStyle != BevelStyle.None)
            {
                using (SolidBrush solidBrush = new SolidBrush(TopBevelFirstLineColor))
                    g.FillRectangle(solidBrush, 0, 0, VirtualWidth, 1);
            }

            if (TopBevelStyle == BevelStyle.DoubleLine)
            {
                using (SolidBrush solidBrush = new SolidBrush(TopBevelSecondLineColor))
                    g.FillRectangle(solidBrush, 0, 1, VirtualWidth, 1);
            }

            //	Draw the first line of the bottom bevel.
            if (BottomBevelStyle == BevelStyle.DoubleLine)
            {
                using (SolidBrush solidBrush = new SolidBrush(BottomBevelFirstLineColor))
                    g.FillRectangle(solidBrush, 0, VirtualHeight - 2, VirtualWidth, 1);
                using (SolidBrush solidBrush = new SolidBrush(BottomBevelSecondLineColor))
                    g.FillRectangle(solidBrush, 0, VirtualHeight - 1, VirtualWidth, 1);
            }
            else if (BottomBevelStyle == BevelStyle.SingleLine)
            {
                using (SolidBrush solidBrush = new SolidBrush(BottomBevelFirstLineColor))
                    g.FillRectangle(solidBrush, 0, VirtualHeight - 1, VirtualWidth, 1);
            }

            //	Call the base class's method so that registered delegates receive the event.
            base.OnPaint(e);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            if (IsHovered || (SystemInformation.HighContrast && Focused))
            {
                BorderPaint borderPaint = new BorderPaint(ResourceHelper.LoadAssemblyResourceBitmap("Images.ChoiceOptionHover.png"), true, BorderPaintMode.StretchToFill | BorderPaintMode.PaintMiddleCenter, 3, 4, 3, 71);
                borderPaint.DrawBorder(e.Graphics, ClientRectangle);
            }
            else if (Focused)
            {
                BorderPaint borderPaint = new BorderPaint(ResourceHelper.LoadAssemblyResourceBitmap("Images.ChoiceOptionFocus.png"), true, BorderPaintMode.StretchToFill | BorderPaintMode.PaintMiddleCenter, 3, 4, 3, 71);
                borderPaint.DrawBorder(e.Graphics, ClientRectangle);
            }

            // Draw everything else
            Render(g, ClientRectangle.Width, ClientRectangle.Height);
        }
Beispiel #28
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            BidiGraphics g = new BidiGraphics(e.Graphics, ClientSize, false);

            ColorizedResources colRes = ColorizedResources.Instance;

            // draw the outer border
            using (Pen p = new Pen(colRes.BorderDarkColor, 1))
                g.DrawRectangle(p, new Rectangle(0, 0, ClientSize.Width - 1, ClientSize.Height - 1));

            // draw the caption
            using (Font f = Res.GetFont(FontSize.Large, FontStyle.Bold))
                g.DrawText(Text, f, new Rectangle(19, 8, ClientSize.Width - 1, ClientSize.Height - 1), SystemColors.WindowText, TextFormatFlags.NoPrefix);

            GdiTextHelper.DrawString(this, labelPublishingTo.Font, _progressMessage, labelPublishingTo.Bounds, false, GdiTextDrawMode.EndEllipsis);
        }
Beispiel #29
0
        public static void DrawErrorMockPlayer(Bitmap img, BidiGraphics bidiGraphics, string message)
        {
            int LEFT_PADDING          = 30;
            int RIGHT_PADDING         = 10;
            int ERROR_IMAGE_WIDTH     = 32;
            int ERROR_IMAGE_HEIGHT    = 32;
            int IMAGE_TO_TEXT_PADDING = 7;
            int PLACEHOLDER_HEIGHT    = img.Height;
            int PLACEHOLDER_WIDTH     = img.Width;
            int VERTICAL_OFFSET       = 30;
            int LINE_BREAK_PADDING    = 4;


            Size titleSize = bidiGraphics.MeasureText(Res.Get(StringId.VideoError),
                                                      Res.GetFont(FontSize.XXLarge, FontStyle.Bold),
                                                      new Size(PLACEHOLDER_WIDTH - LEFT_PADDING - ERROR_IMAGE_WIDTH - IMAGE_TO_TEXT_PADDING - RIGHT_PADDING, PLACEHOLDER_HEIGHT - VERTICAL_OFFSET),
                                                      TextFormatFlags.WordBreak);

            bidiGraphics.DrawText(Res.Get(StringId.VideoError),
                                  Res.GetFont(FontSize.XXLarge,
                                              FontStyle.Bold),
                                  new Rectangle(LEFT_PADDING + ERROR_IMAGE_WIDTH + IMAGE_TO_TEXT_PADDING,
                                                VERTICAL_OFFSET + (ERROR_IMAGE_HEIGHT / 2) - (titleSize.Height / 2),
                                                PLACEHOLDER_WIDTH - LEFT_PADDING - ERROR_IMAGE_WIDTH - IMAGE_TO_TEXT_PADDING - RIGHT_PADDING,
                                                PLACEHOLDER_HEIGHT - VERTICAL_OFFSET),
                                  Color.White,
                                  TextFormatFlags.WordBreak);


            bidiGraphics.DrawText(message,
                                  Res.GetFont(FontSize.XLarge,
                                              FontStyle.Regular),
                                  new Rectangle(LEFT_PADDING + ERROR_IMAGE_WIDTH + IMAGE_TO_TEXT_PADDING,
                                                VERTICAL_OFFSET + (ERROR_IMAGE_HEIGHT / 2) - (titleSize.Height / 2) + titleSize.Height + LINE_BREAK_PADDING,
                                                PLACEHOLDER_WIDTH - LEFT_PADDING - ERROR_IMAGE_WIDTH - IMAGE_TO_TEXT_PADDING - RIGHT_PADDING,
                                                PLACEHOLDER_HEIGHT - (VERTICAL_OFFSET + titleSize.Height + LINE_BREAK_PADDING)),
                                  Color.White,
                                  TextFormatFlags.WordBreak);

            bidiGraphics.DrawImage(false,
                                   ResourceHelper.LoadAssemblyResourceBitmap("Video.Images.Error.gif"),
                                   LEFT_PADDING,
                                   VERTICAL_OFFSET);
        }
Beispiel #30
0
        protected override void OnPaint(PaintEventArgs e)
        {
            BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle);

            // draw image
            const int HEADER_X_INSET = 0;
            const int HEADER_Y_INSET = 0;

            g.DrawImage(false, _headerImage, HEADER_X_INSET, HEADER_Y_INSET);

            // draw text centered vertically
            const int TEXT_X_INSET = 5;
            Size      textSize     = g.MeasureText(_label, Font);
            int       textY        = (Height / 2) - (textSize.Height / 2);
            Color     textColor    = !SystemInformation.HighContrast ? Color.FromArgb(0, 77, 131) : SystemColors.WindowText;
            Rectangle textRect     = new Rectangle(new Point(HEADER_X_INSET + _headerImage.Width + TEXT_X_INSET, textY), textSize);

            g.DrawText(_label, Font, textRect, textColor);
        }