Exemplo n.º 1
0
 protected override void CreateChildItems(RadElement parent)
 {
     this.titleBarElement       = new RadTitleBarElement();
     this.titleBarElement.Class = "TitleBar";
     this.RootElement.Children.Add(this.titleBarElement);
     base.CreateChildItems(parent);
 }
Exemplo n.º 2
0
 protected override void CreateChildElements()
 {
     this.StretchHorizontally = true;
     this.StretchVertically   = true;
     this.GradientStyle       = GradientStyles.Solid;
     this.headerItem          = new BackstageVisualElement();
     this.headerItem.DrawText = false;
     this.headerItem.DrawFill = true;
     this.headerItem.MinSize  = new Size(0, 3);
     this.headerItem.Class    = "BackstageViewHeader";
     this.Children.Add((RadElement)this.headerItem);
     this.titleBarElement       = new RadTitleBarElement();
     this.titleBarElement.Class = "TitleBar";
     this.titleBarElement.TitlePrimitive.Alignment = ContentAlignment.MiddleCenter;
     this.titleBarElement.Close           += new TitleBarSystemEventHandler(this.titleBarElement_Close);
     this.titleBarElement.Minimize        += new TitleBarSystemEventHandler(this.titleBarElement_Minimize);
     this.titleBarElement.MaximizeRestore += new TitleBarSystemEventHandler(this.titleBarElement_MaximizeRestore);
     this.Children.Add((RadElement)this.titleBarElement);
     this.itemsElement          = new BackstageItemsPanelElement(this);
     this.itemsElement.DrawFill = true;
     this.Children.Add((RadElement)this.itemsElement);
     this.contentElement          = new BackstageContentPanelElement();
     this.contentElement.DrawFill = true;
     this.Children.Add((RadElement)this.contentElement);
     base.CreateChildElements();
 }
Exemplo n.º 3
0
 protected override void PaintOverride(
     IGraphics screenRadGraphics,
     Rectangle clipRectangle,
     float angle,
     SizeF scale,
     bool useRelativeTransformation)
 {
     if (this.LeftImage != null && this.RightImage != null && this.MiddleImage != null)
     {
         Graphics underlayGraphics = screenRadGraphics.UnderlayGraphics as Graphics;
         using (Brush brush = (Brush) new SolidBrush(Color.FromArgb((int)byte.MaxValue, this.BackColor)))
             underlayGraphics.FillRectangle(brush, this.BoundingRectangle);
         int         height                = this.MiddleImage.Height;
         int         x                     = this.Size.Width - this.rightImage.Width;
         Rectangle   rectangle             = new Rectangle(this.leftImage.Width, 0, this.Size.Width - this.leftImage.Width - this.rightImage.Width, height);
         Rectangle   clipRect              = Rectangle.Intersect(this.BoundingRectangle, rectangle);
         ImageLayout backgroundImageLayout = ImageLayout.Tile;
         if (this.ElementTree != null)
         {
             backgroundImageLayout = this.ElementTree.Control.BackgroundImageLayout;
         }
         RadTitleBarElement.DrawBackgroundImage(underlayGraphics, this.MiddleImage, this.BackColor, backgroundImageLayout, rectangle, clipRect, Point.Empty, this.RightToLeft);
         underlayGraphics.DrawImage(this.rightImage, new Point(x, 0));
         underlayGraphics.DrawImage(this.leftImage, Point.Empty);
     }
     base.PaintOverride(screenRadGraphics, clipRectangle, angle, scale, useRelativeTransformation);
 }
Exemplo n.º 4
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.borderPrimitive                     = new RibbonFormBorderPrimitive();
     this.borderPrimitive.Class               = "RibbonFormBorder";
     this.borderPrimitive.StretchVertically   = true;
     this.borderPrimitive.StretchHorizontally = true;
     this.Children.Add((RadElement)this.borderPrimitive);
     this.titleBarElement                             = (RadTitleBarElement) new RadFormTitleBarElement();
     this.titleBarElement.Class                       = "TitleBar";
     this.titleBarElement.Visibility                  = ElementVisibility.Collapsed;
     this.titleBarElement.StateManager                = new RibbonFormTitleBarElementStateManager().StateManagerInstance;
     this.titleBarElement.HelpButton.StateManager     = new RibbonFormTitleBarButtonStateManager().StateManagerInstance;
     this.titleBarElement.MinimizeButton.StateManager = new RibbonFormTitleBarButtonStateManager().StateManagerInstance;
     this.titleBarElement.MaximizeButton.StateManager = new RibbonFormTitleBarButtonStateManager().StateManagerInstance;
     this.titleBarElement.CloseButton.StateManager    = new RibbonFormTitleBarButtonStateManager().StateManagerInstance;
     this.Children.Add((RadElement)this.titleBarElement);
 }
Exemplo n.º 5
0
        internal static void DrawBackgroundImage(
            Graphics g,
            Image backgroundImage,
            Color backColor,
            ImageLayout backgroundImageLayout,
            Rectangle bounds,
            Rectangle clipRect,
            Point scrollOffset,
            bool rightToLeft)
        {
            if (backgroundImageLayout == ImageLayout.Tile)
            {
                using (TextureBrush textureBrush = new TextureBrush(backgroundImage, WrapMode.Tile))
                {
                    if (scrollOffset != Point.Empty)
                    {
                        Matrix transform = textureBrush.Transform;
                        transform.Translate((float)scrollOffset.X, (float)scrollOffset.Y);
                        textureBrush.Transform = transform;
                    }
                    g.FillRectangle((Brush)textureBrush, clipRect);
                }
            }
            else
            {
                Rectangle backgroundImageRectangle = RadTitleBarElement.CalculateBackgroundImageRectangle(bounds, backgroundImage, backgroundImageLayout);
                if (rightToLeft && backgroundImageLayout == ImageLayout.None)
                {
                    backgroundImageRectangle.X += clipRect.Width - backgroundImageRectangle.Width;
                }
                using (SolidBrush solidBrush = new SolidBrush(backColor))
                    g.FillRectangle((Brush)solidBrush, clipRect);
                if (!clipRect.Contains(backgroundImageRectangle))
                {
                    switch (backgroundImageLayout)
                    {
                    case ImageLayout.None:
                        backgroundImageRectangle.Offset(clipRect.Location);
                        Rectangle destRect1 = backgroundImageRectangle;
                        destRect1.Intersect(clipRect);
                        Rectangle rectangle1 = new Rectangle(Point.Empty, destRect1.Size);
                        g.DrawImage(backgroundImage, destRect1, rectangle1.X, rectangle1.Y, rectangle1.Width, rectangle1.Height, GraphicsUnit.Pixel);
                        break;

                    case ImageLayout.Stretch:
                    case ImageLayout.Zoom:
                        backgroundImageRectangle.Intersect(clipRect);
                        g.DrawImage(backgroundImage, backgroundImageRectangle);
                        break;

                    default:
                        Rectangle destRect2 = backgroundImageRectangle;
                        destRect2.Intersect(clipRect);
                        Rectangle rectangle2 = new Rectangle(new Point(destRect2.X - backgroundImageRectangle.X, destRect2.Y - backgroundImageRectangle.Y), destRect2.Size);
                        g.DrawImage(backgroundImage, destRect2, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, GraphicsUnit.Pixel);
                        break;
                    }
                }
                else
                {
                    ImageAttributes imageAttr = new ImageAttributes();
                    imageAttr.SetWrapMode(WrapMode.TileFlipXY);
                    g.DrawImage(backgroundImage, backgroundImageRectangle, 0, 0, backgroundImage.Width, backgroundImage.Height, GraphicsUnit.Pixel, imageAttr);
                    imageAttr.Dispose();
                }
            }
        }