Example #1
0
 public virtual void OnWindowlessPaint(WindowlessPaintEventArgs e)
 {
     if (BackColor != Color.Transparent)
     {
         e.Graphics.FillRectangle(new SolidBrush(BackColor), e.Origin.X + e.ClipRectangle.X, e.Origin.Y + e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
     }
 }
        protected override void OnPaint(WindowlessPaintEventArgs e)
        {
            IntPtr hdc      = e.Graphics.GetHdc();
            IntPtr oldPen   = myPen.Value.Select(hdc);
            IntPtr oldBrush = myBrush.Value.Select(hdc);

            RoundRect(hdc, e.Origin.X, e.Origin.Y, e.Origin.X + ClientWidth, e.Origin.Y + ClientHeight, myEllipseWidth, myEllipseHeight);
            NativeObject.SelectObject(hdc, oldBrush);
            NativeObject.SelectObject(hdc, oldPen);
            e.Graphics.ReleaseHdc(hdc);
        }
        protected override void OnPaint(WindowlessPaintEventArgs e)
        {
            myVertices[0].X = e.Origin.X;
            myVertices[0].Y = e.Origin.Y;
            myVertices[1].X = e.Origin.X + ClientWidth;
            myVertices[1].Y = e.Origin.Y + ClientHeight;

            IntPtr hdc = e.Graphics.GetHdc();

            GradientFill(hdc, myVertices, 2, myRectIndices, 1, (int)myGradientDirection.Value);
            e.Graphics.ReleaseHdc(hdc);
        }
Example #4
0
        public void OnWindowlessPaint(WindowlessPaintEventArgs e)
        {
            Point     adjustedOrigin = new Point(e.Origin.X + Margin.Left, e.Origin.Y + Margin.Top);
            Rectangle newClip        = e.ClipRectangle;

            newClip.X      += Margin.Left;
            newClip.Y      += Margin.Top;
            newClip.Width  -= (Margin.Left + Margin.Right);
            newClip.Height -= (Margin.Top + Margin.Bottom);
            e.ClipRectangle = newClip;
            e.Origin        = adjustedOrigin;
            OnPaint(e);
        }
 protected override void OnPaint(WindowlessPaintEventArgs e)
 {
     if (myColor != Color.Transparent)
     {
         if (myFilled.Value)
         {
             e.Graphics.FillRectangle(myBrush, e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight);
         }
         else
         {
             e.Graphics.DrawRectangle(myPen, e.Origin.X, e.Origin.Y, ClientWidth - 1, ClientHeight - 1);
         }
     }
 }
Example #6
0
        protected override void OnPaint(WindowlessPaintEventArgs e)
        {
            //SetupDefaultClip(g);
            float topAdjust = 0;

            switch (VerticalTextAlignment)
            {
            case VerticalAlignment.Top:
                topAdjust = 0;
                break;

            case VerticalAlignment.Bottom:
                topAdjust = ClientHeight - myTotalHeight;
                break;

            case VerticalAlignment.Center:
                topAdjust = (ClientHeight - myTotalHeight) / 2;
                break;
            }

            if (BackColor != Color.Transparent)
            {
                e.Graphics.FillRectangle(myBackBrush, e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight);
            }

            foreach (LineBreak lineBreak in myLineBreaks)
            {
                float leftAdjust = 0;
                switch (HorizontalTextAlignment)
                {
                case HorizontalAlignment.Left:
                    leftAdjust = 0;
                    break;

                case HorizontalAlignment.Right:
                    leftAdjust = ClientWidth - lineBreak.Width;
                    break;

                case HorizontalAlignment.Center:
                    leftAdjust = (ClientWidth - lineBreak.Width) / 2.0f;
                    break;
                }

                if (e.ClipRectangle.IntersectsWith(new Rectangle(Margin.Left + (int)leftAdjust, Margin.Top + (int)topAdjust, (int)lineBreak.Width, (int)lineBreak.Height)))
                {
                    e.Graphics.DrawString(lineBreak.Text, Font, myForeBrush, e.Origin.X + leftAdjust, e.Origin.Y + topAdjust);
                }
                topAdjust += lineBreak.Height;
            }
        }
        protected override void OnPaint(WindowlessPaintEventArgs e)
        {
            PlatformBitmap bitmap = myBitmap.Value;

            if (bitmap != null)
            {
                bitmap.Draw(e.Graphics, new Rectangle(e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight), new Rectangle(0, 0, bitmap.Width, bitmap.Height));


                //bitmap.Draw(e.Graphics, e.ClipRectangle,


                //if (Transparent)
                //    e.Graphics.DrawImage(bitmap, new Rectangle(e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, WindowlessControlHost.TransparentImageAttributes);
                //else
                //    e.Graphics.DrawImage(bitmap, new Rectangle(e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight), new Rectangle(0, 0, bitmap.Width, bitmap.Height), GraphicsUnit.Pixel);
            }
        }
        protected override void OnPaint(WindowlessPaintEventArgs e)
        {
            base.OnPaint(e);

            int arrowHeight = (ClientHeight - 1) / 2;

            e.Graphics.FillPolygon(new SolidBrush(SystemColors.ControlDarkDark), new Point[] { new Point((int)Math.Ceiling((double)e.Origin.X + (double)ClientWidth / 2.0), e.Origin.Y), new Point(e.Origin.X, e.Origin.Y + arrowHeight), new Point(e.Origin.X + ClientWidth, e.Origin.Y + arrowHeight) });
            e.Graphics.FillPolygon(new SolidBrush(SystemColors.ControlDarkDark), new Point[] { new Point(e.Origin.X, e.Origin.Y + arrowHeight + 2), new Point(e.Origin.X + ClientWidth, e.Origin.Y + arrowHeight + 2), new Point((int)Math.Floor((double)e.Origin.X + (double)ClientWidth / 2.0), e.Origin.Y + arrowHeight + 2 + arrowHeight) });
        }
Example #9
0
        void WindowlessPaintHost(IWindowlessControl control, Graphics graphics, Point origin, Rectangle destRect)
        {
            if (!control.Visible)
            {
                return;
            }
            // paint everything in a clip rectangle belonging to a host tree

            IWindowlessPaintControl paintControl = control as IWindowlessPaintControl;

            if (paintControl != null)
            {
                if (paintControl.PaintSelf)
                {
                    WindowlessPaintEventArgs we = myPaintEventArgs;
                    we.Graphics      = graphics;
                    we.ClipRectangle = destRect;
                    we.Origin        = origin;
                    Rectangle clip = we.ClipRectangle;
                    clip.X += we.Origin.X;
                    clip.Y += we.Origin.Y;

                    if (paintControl.ClipToBounds)
                    {
                        myDummyRegion.MakeEmpty();
                        myDummyRegion.Union(clip);
                        myDummyRegion.Intersect(graphics.Clip);
                    }
                    else
                    {
                        myDummyRegion.MakeInfinite();
                    }
                    Region oldClip = we.Graphics.Clip;
                    we.Graphics.Clip = myDummyRegion;

                    paintControl.OnWindowlessPaint(we);

                    we.Graphics.Clip = oldClip;
                }
                if (!paintControl.PaintChildren)
                {
                    return;
                }
            }

            if (control.Controls == null)
            {
                return;
            }
            foreach (IWindowlessControl child in control.Controls)
            {
                if (child is WindowlessControlHost)
                {
                    continue;
                }
                Point     childOrigin = new Point(origin.X + child.Left, origin.Y + child.Top);
                Rectangle childRect   = new Rectangle(child.Left, child.Top, child.Width, child.Height);
                Rectangle clipRect    = childRect;
                clipRect.Location = childOrigin;
                if (!graphics.Clip.IsVisible(clipRect))
                {
                    continue;
                }
                childRect.Intersect(destRect);
                if (childRect.Width <= 0 || childRect.Height <= 0)
                {
                    continue;
                }
                childRect.X -= child.Left;
                childRect.Y -= child.Top;
                WindowlessPaintHost(child, graphics, childOrigin, childRect);
            }
        }
 protected override void OnPaint(WindowlessPaintEventArgs e)
 {
     base.OnPaint(e);
     e.Graphics.FillPolygon(new SolidBrush(SystemColors.ControlDarkDark), new Point[] { new Point(e.Origin.X, e.Origin.Y), new Point(e.Origin.X + ClientWidth, e.Origin.Y), new Point((int)Math.Round((double)e.Origin.X + (double)ClientWidth / 2.0), e.Origin.Y + ClientHeight) });
 }
        protected override void OnPaint(WindowlessPaintEventArgs e)
        {
            PlatformBitmap bitmap = myBitmap.Value;
            if (bitmap != null)
            {
                bitmap.Draw(e.Graphics, new Rectangle(e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight), new Rectangle(0, 0, bitmap.Width, bitmap.Height));

                //bitmap.Draw(e.Graphics, e.ClipRectangle,

                //if (Transparent)
                //    e.Graphics.DrawImage(bitmap, new Rectangle(e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, WindowlessControlHost.TransparentImageAttributes);
                //else
                //    e.Graphics.DrawImage(bitmap, new Rectangle(e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight), new Rectangle(0, 0, bitmap.Width, bitmap.Height), GraphicsUnit.Pixel);
            }
        }
 protected virtual void OnPaint(WindowlessPaintEventArgs e)
 {
 }
 public void OnWindowlessPaint(WindowlessPaintEventArgs e)
 {
     Point adjustedOrigin = new Point(e.Origin.X + Margin.Left, e.Origin.Y + Margin.Top);
     Rectangle newClip = e.ClipRectangle;
     newClip.X += Margin.Left;
     newClip.Y += Margin.Top;
     newClip.Width -= (Margin.Left + Margin.Right);
     newClip.Height -= (Margin.Top + Margin.Bottom);
     e.ClipRectangle = newClip;
     e.Origin = adjustedOrigin;
     OnPaint(e);
 }
 protected override void OnPaint(WindowlessPaintEventArgs e)
 {
     IntPtr hdc = e.Graphics.GetHdc();
     IntPtr oldPen = myPen.Value.Select(hdc);
     IntPtr oldBrush = myBrush.Value.Select(hdc);
     RoundRect(hdc, e.Origin.X, e.Origin.Y, e.Origin.X + ClientWidth, e.Origin.Y + ClientHeight, myEllipseWidth, myEllipseHeight);
     NativeObject.SelectObject(hdc, oldBrush);
     NativeObject.SelectObject(hdc, oldPen);
     e.Graphics.ReleaseHdc(hdc);
 }
 protected override void OnPaint(WindowlessPaintEventArgs e)
 {
     if (myColor != Color.Transparent)
     {
         if (myFilled.Value)
             e.Graphics.FillRectangle(myBrush, e.Origin.X, e.Origin.Y, ClientWidth, ClientHeight);
         else
             e.Graphics.DrawRectangle(myPen, e.Origin.X, e.Origin.Y, ClientWidth - 1, ClientHeight - 1);
     }
 }
        protected override void OnPaint(WindowlessPaintEventArgs e)
        {
            myVertices[0].X = e.Origin.X;
            myVertices[0].Y = e.Origin.Y;
            myVertices[1].X = e.Origin.X + ClientWidth;
            myVertices[1].Y = e.Origin.Y + ClientHeight;

            IntPtr hdc = e.Graphics.GetHdc();
            GradientFill(hdc, myVertices, 2, myRectIndices, 1, (int)myGradientDirection.Value);
            e.Graphics.ReleaseHdc(hdc);
        }
Example #17
0
 protected virtual void OnPaint(WindowlessPaintEventArgs e)
 {
 }
 public virtual void OnWindowlessPaint(WindowlessPaintEventArgs e)
 {
     if (BackColor != Color.Transparent)
         e.Graphics.FillRectangle(new SolidBrush(BackColor), e.Origin.X + e.ClipRectangle.X, e.Origin.Y + e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
 }