예제 #1
0
        protected virtual void OnSkinElementChanged(SkinBaseElement element)
        {
            Image image = null;

            if (activeImage != null)
            {
                image = activeImage;
            }
            else if (pressedImage != null)
            {
                image = pressedImage;
            }
            else if (disabledImage != null)
            {
                image = disabledImage;
            }

            if (image != null)
            {
                Platform.MoveWindow(cbInfo.hwndCombo, Location.X, Location.Y, image.Width, image.Height, true);
                this.Size = image.Size;
            }

            if (element.haskeycolor)
            {
                GraphicsPath path = SkinBaseElement.GetPath(new Rectangle(Point.Empty, this.Size), (Bitmap)activeImage, element.keycolor);
                if (path != null)
                {
                    this.Region = new Region(path);
                    path.Dispose();
                }
            }
        }
예제 #2
0
        public GraphicsPath GetPath()
        {
            if (!bKeyColor)
            {
                if (destRect.Width > 0 && destRect.Height > 0)
                {
                    GraphicsPath path = new GraphicsPath();
                    path.AddRectangle(destRect);
                    return(path);
                }
            }
            if (bitmapRectangle != destRect)
            {
                if (pBitmapPath != null)
                {
                    pBitmapPath.Dispose();
                }
                pBitmapPath = null;
            }

            if (pBitmapPath == null)
            {
                bitmapRectangle = destRect;
                pBitmapPath     = SkinBaseElement.GetPath(destRect, bitmapPortion, keycolor);
            }
            else
            {
                Matrix matrix = new Matrix();
                matrix.Translate(destRect.X - PathPoint.X, destRect.Y - PathPoint.Y);
                pBitmapPath.Transform(matrix);
            }
            PathPoint = destRect.Location;
            return(pBitmapPath);
        }
예제 #3
0
 protected virtual void CreateRegion(SkinBaseElement element)
 {
     if (element.haskeycolor)
     {
         GraphicsPath path = SkinBaseElement.GetPath(new Rectangle(Point.Empty, this.Size), (Bitmap)activeImage, element.keycolor);
         if (path != null)
         {
             this.Region = new Region(path);
             path.Dispose();
         }
     }
 }
예제 #4
0
        protected override void OnSkinElementChanged(SkinBaseElement element)
        {
            Image image = null;

            if (ActiveImage != null)
            {
                image = ActiveImage;
            }
            else if (PressedImage != null)
            {
                image = PressedImage;
            }
            else if (DisabledImage != null)
            {
                image = DisabledImage;
            }

            if (image == null)
            {
                return;
            }

            if (element.haskeycolor)
            {
                GraphicsPath path = null;                //SkinBaseElement.GetPath(new Rectangle(Point.Empty, this.Size), (Bitmap)ActiveImage, element.keycolor);
                if (WestWidth != 0)
                {
                    GraphicsPath west_path = SkinBaseElement.GetPath(
                        new Rectangle(Point.Empty, new Size(WestWidth, this.Height)),
                        (Bitmap)ActiveImage,
                        new Rectangle(Point.Empty, new Size(WestWidth, image.Height)),
                        element.keycolor);

                    if (west_path != null)
                    {
                        path = west_path;
                    }
                }
                if (EastWidth != 0)
                {
                    GraphicsPath east_path = SkinBaseElement.GetPath(
                        new Rectangle(new Point(this.Width - EastWidth, 0), new Size(EastWidth, this.Height)),
                        (Bitmap)ActiveImage,
                        new Rectangle(new Point(image.Width - EastWidth, 0), new Size(EastWidth, image.Height)),
                        element.keycolor);
                    if (east_path != null)
                    {
                        if (path == null)
                        {
                            path = east_path;
                        }
                        else
                        {
                            path.AddPath(east_path, true);
                        }
                    }
                }
                GraphicsPath center_path = SkinBaseElement.GetPath(
                    new Rectangle(new Point(WestWidth, 0), new Size(this.Width - EastWidth - WestWidth, this.Height)),
                    (Bitmap)ActiveImage,
                    new Rectangle(new Point(WestWidth, 0), new Size(image.Width - EastWidth - WestWidth, image.Height)),
                    element.keycolor);
                if (path == null)
                {
                    path = center_path;
                }
                else
                {
                    path.AddPath(center_path, true);
                }

                if (path != null)
                {
                    this.Region = new Region(path);
                    path.Dispose();
                }
            }
        }
예제 #5
0
        protected override void CreateRegion(SkinBaseElement element)
        {
            /*if( element.haskeycolor)
             * {
             *      GraphicsPath path = null;
             *      if( WestWidth != 0)
             *      {
             *              GraphicsPath west_path = SkinBaseElement.GetPath(new Rectangle(Point.Empty, new Size(WestWidth, this.Height)), (Bitmap)ActiveImage, element.keycolor);
             *              if( west_path!=null)
             *              {
             *                      path = west_path;
             *              }
             *      }
             * }*/
            Bitmap image = (Bitmap)ActiveImage;

            if (image != null && element.haskeycolor)
            {
                GraphicsPath path = null;                //SkinBaseElement.GetPath(new Rectangle(Point.Empty, this.Size), (Bitmap)ActiveImage, element.keycolor);
                if (WestWidth != 0)
                {
                    GraphicsPath west_path = SkinBaseElement.GetPath(
                        new Rectangle(Point.Empty, new Size(WestWidth, this.Height)),
                        (Bitmap)ActiveImage,
                        new Rectangle(Point.Empty, new Size(WestWidth, image.Height)),
                        element.keycolor);

                    if (west_path != null)
                    {
                        path = west_path;
                    }
                }
                if (EastWidth != 0)
                {
                    GraphicsPath east_path = SkinBaseElement.GetPath(
                        new Rectangle(new Point(this.Width - EastWidth, 0), new Size(EastWidth, this.Height)),
                        (Bitmap)ActiveImage,
                        new Rectangle(new Point(image.Width - EastWidth, 0), new Size(EastWidth, image.Height)),
                        element.keycolor);
                    if (east_path != null)
                    {
                        if (path == null)
                        {
                            path = east_path;
                        }
                        else
                        {
                            path.AddPath(east_path, true);
                        }
                    }
                }
                GraphicsPath center_path = SkinBaseElement.GetPath(
                    new Rectangle(new Point(WestWidth, 0), new Size(this.Width - EastWidth - WestWidth, this.Height)),
                    (Bitmap)ActiveImage,
                    new Rectangle(new Point(WestWidth, 0), new Size(image.Width - EastWidth - WestWidth, image.Height)),
                    element.keycolor);
                if (path == null)
                {
                    path = center_path;
                }
                else
                {
                    path.AddPath(center_path, true);
                }

                if (path != null)
                {
                    this.Region = new Region(path);
                    path.Dispose();
                }
            }
        }
예제 #6
0
 /// <summary>
 /// Return path for this element
 /// </summary>
 public GraphicsPath GetPath(Color transparencyColor)
 {
     return(SkinBaseElement.GetPath(destRect, bitmapPortion, transparencyColor));
 }