Esempio n. 1
0
        private void UpdateBox()
        {
            var layout = GetParentLayout(currentItem);

            PKPoint pos = currentItem.GetAbsPosition();

            boxRect.X = pos.X;
            boxRect.Y = pos.Y;

            boxRect.Width  = currentItem.Width;
            boxRect.Height = currentItem.Height;

            if (layout == typeof(PKHBox))
            {
                canResize         = true;
                direction         = PKResizeDirection.LeftRight;
                resizeRect.X      = boxRect.X + boxRect.Width - 3 * SIZE;
                resizeRect.Y      = boxRect.Y + (boxRect.Height - 6 * SIZE) / 2;
                resizeRect.Width  = 3 * SIZE;
                resizeRect.Height = 6 * SIZE;
            }
            if (layout == typeof(PKVBox))
            {
                canResize         = true;
                direction         = PKResizeDirection.TopBottom;
                resizeRect.X      = boxRect.X + (boxRect.Width - 6 * SIZE) / 2;
                resizeRect.Y      = boxRect.Y + boxRect.Height - 3 * SIZE;
                resizeRect.Width  = 6 * SIZE;
                resizeRect.Height = 3 * SIZE;
            }
        }
Esempio n. 2
0
 public PKBoxItem()
 {
     this.Name     = "Box";
     this.Layout   = new PKLayout();
     this.ID       = PKSequenceGenerator.GetNextId();
     this.position = new PKPoint();
     this.Corners  = PKRectangleCorners.None;
 }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public virtual PKBoxItem HitTest(int x, int y)
        {
            PKPoint absPosition = GetAbsPosition();

            if (absPosition.X <= x && x <= absPosition.X + this.Width &&
                absPosition.Y <= y && y <= absPosition.Y + this.Height)
            {
                return(this);
            }
            return(null);
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="graphics"></param>
        public virtual void RenderBackground(PKGraphics graphics)
        {
            if (this.BackgroundBrush != null)
            {
                PKPoint absPosition = GetAbsPosition();

                graphics.FillRectangle(this.BackgroundBrush,
                                       absPosition.X, absPosition.Y,
                                       this.Width, this.Height, this.Corners);
            }
        }
Esempio n. 5
0
        public override void Render(PKGraphics graphics)
        {
            PKPoint absPosition = GetAbsPosition();

            base.Render(graphics);

            graphics.FillEllipse(PKBrushes.GrayWhiteBrush, absPosition.X + this.Padding, absPosition.Y + 2,
                                 18, 18);
            graphics.DrawEllipse(
                PKPens.DarkGrayPen,
                absPosition.X + this.Padding, absPosition.Y + 2,
                18, 18);
        }
Esempio n. 6
0
        public override void Render(PKGraphics graphics)
        {
            base.Render(graphics);

            if (IsSelected)
            {
                PKPoint absPosition = GetAbsPosition();

                graphics.DrawRectangle(
                    PKPens.ActiveItem,
                    absPosition.X, absPosition.Y,
                    this.Width, this.Height, this.Corners);
            }
        }
        public override void Render(PKGraphics graphics)
        {
            PKPoint absPosition = GetAbsPosition();

            base.Render(graphics);

            graphics.FillRectangle(PKBrushes.GrayWhiteBrush, absPosition.X + this.Padding, absPosition.Y + 2,
                                   this.Width - this.Padding * 2, 20);

            graphics.DrawRectangle(
                PKPens.DarkGrayPen,
                absPosition.X + this.Padding,
                absPosition.Y + 2,
                this.Width - this.Padding * 2, 20);
        }
Esempio n. 8
0
 public override PKBoxItem HitTest(int x, int y)
 {
     if (this.IsComponent)
     {
         PKPoint absPosition = GetAbsPosition();
         if (absPosition.X <= x && x <= absPosition.X + this.Width &&
             absPosition.Y <= y && y <= absPosition.Y + this.Height)
         {
             return(this);
         }
         return(null);
     }
     else
     {
         return(base.HitTest(x, y));
     }
 }
Esempio n. 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="graphics"></param>
        public override void Render(PKGraphics graphics)
        {
            PKPoint absPosition = GetAbsPosition();

            this.RenderBackground(graphics);

            if (this.TextFont == null)
            {
                this.TextFont = new PKFont("Tahoma", 10, false);
            }

            graphics.WriteText(
                this.Value,
                this.TextBrush == null ? PKBrushes.BlackBrush : this.TextBrush,
                this.TextFont == null?new PKFont("Tahoma", 10, false): this.TextFont,
                this.Align,
                absPosition.X + this.Padding,
                absPosition.Y,
                this.Width - this.Padding * 2, this.Height);
            base.Render(graphics);
        }
Esempio n. 10
0
        /// <summary>
        /// Render the Item
        /// </summary>
        public virtual void Render(PKGraphics graphics)
        {
            if (BorderPen != null && BorderPen.Size > 0)
            {
                PKPoint absPosition = GetAbsPosition();

                graphics.DrawRectangle(
                    BorderPen,
                    absPosition.X, absPosition.Y,
                    this.Width, this.Height,
                    this.Corners);
            }

            if (IsSelected)
            {
                PKPoint absPosition = GetAbsPosition();

                graphics.DrawRectangle(
                    PKPens.SelectedItem,
                    absPosition.X, absPosition.Y,
                    this.Width, this.Height, this.Corners);
            }
        }
Esempio n. 11
0
        public override void Render(PKGraphics graphics)
        {
            PKPoint absPosition = GetAbsPosition();

            base.Render(graphics);

            graphics.FillRectangle(PKBrushes.GrayWhiteBrush, absPosition.X + this.Padding, absPosition.Y + 2,
                                   this.Width - this.Padding * 2, 20);

            graphics.DrawRectangle(
                PKPens.DarkGrayPen,
                absPosition.X + this.Padding,
                absPosition.Y + 2,
                this.Width - this.Padding * 2, 20);
            graphics.DrawRectangle(
                PKPens.DarkGrayPen,
                absPosition.X - this.Padding + this.Width - 18,
                absPosition.Y + 2,
                18, 20);
            graphics.WriteText("[]", PKBrushes.BlackBrush, this.TextFont, PKHAlign.Center,
                               absPosition.X - this.Padding + this.Width - 18,
                               absPosition.Y + 2,
                               18, 20);
        }