Пример #1
0
        private void Prop_PropChanged(object sender, EventArgs e)
        {
            int total = max - min;
            int pot   = orientation == Orientation.Horizontal ? prop.HorizPot : prop.VertPot;

            value = PropGadget.FindScrollerTop(total, visibleAmount, pot);
        }
Пример #2
0
        private void AdjustProp()
        {
            int total = max - min;

            PropGadget.FindScrollerValues(total, visibleAmount, value, overlap, out int body, out int pot);
            prop.ModifyProp(prop.FreeHoriz, prop.FreeVert, pot, pot, body, body);
        }
Пример #3
0
        public ScrollbarGadget(Gadget parent, Orientation orientation = Orientation.Horizontal)
            : base(parent)
        {
            arrowPlace       = ArrowPlace.RightBottom;
            overlap          = 1;
            increment        = 1;
            this.orientation = orientation;
            bool vert = orientation == Orientation.Vertical;

            prop = new PropGadget(this)
            {
                FreeHoriz  = !vert,
                FreeVert   = vert,
                Borderless = true
            };
            prop.PropChanged += Prop_PropChanged;
            arrowInc          = new ButtonGadget(this, vert ? theme.ArrowDown : theme.ArrowRight)
            {
                Width      = 20,
                Height     = 20,
                Repeat     = true,
                Borderless = false
            };
            arrowInc.GadgetUp += ArrowInc_GadgetUp;
            arrowDec           = new ButtonGadget(this, vert ? theme.ArrowUp : theme.ArrowLeft)
            {
                Height     = 20,
                Width      = 20,
                Repeat     = true,
                Borderless = false
            };
            arrowDec.GadgetUp += ArrowDec_GadgetUp;
        }
Пример #4
0
        public void RenderGadget(IGraphics gfx, PropGadget gadget)
        {
            var frame = gadget.Bounds;

            if (!gadget.TransparentBackground)
            {
                FillBox(gfx, frame, WindowBackPen);
            }
            if (!gadget.Borderless)
            {
                gfx.DrawRectangle(frame.X, frame.Y, frame.Width, frame.Height, ShadowPen);
            }
            var knob = gadget.Knob;

            FillBox(gfx, knob, gadget.DrawSelected ? GadgetSelectedPen : gadget.Hover?GadgetHoverPen: GadgetBackPen);
            DrawBox(gfx, knob, gadget.DrawSelected ? ShadowPen : ShinePen, gadget.MouseSelected ? ShinePen : ShadowPen);
        }