Пример #1
0
        //unhighlight, do clicking
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            //update and click
            ZoomTracker trk = this.Control as ZoomTracker;

            switch (loc)
            {
            case MouseLoc.ZoomIn: trk.Value++; break;

            case MouseLoc.ZoomOut: trk.Value--; break;

            default: return;
            }
            loc = MouseLoc.Out;
            tracker_ValueChanged(trk, new ValueChangedEventArgs());
        }
Пример #2
0
 //paint the buttons
 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     if (zoom_in != null && zoom_out != null)
     {
         ZoomTracker trk = this.Control as ZoomTracker;
         //zoom out button
         if (trk.Value <= trk.Minimum || !Enabled)
         {
             ControlPaint.DrawImageDisabled(e.Graphics,
                                            zoom_out, 0, 0, SystemColors.Control);
         }
         else
         {
             if (loc == MouseLoc.ZoomOut && Control.MouseButtons != MouseButtons.None)
             {
                 ControlPaint.DrawBorder3D(e.Graphics,
                                           new Rectangle(0, 0, 20, this.Height),
                                           Border3DStyle.RaisedInner);
             }
             e.Graphics.DrawImageUnscaled(zoom_out, Point.Empty);
         }
         //zoom in button
         if (trk.Value >= trk.Maximum || !Enabled)
         {
             ControlPaint.DrawImageDisabled(e.Graphics,
                                            zoom_in, this.Width - zoom_in.Width, 0, SystemColors.Control);
         }
         else
         {
             if (loc == MouseLoc.ZoomIn && Control.MouseButtons != MouseButtons.None)
             {
                 ControlPaint.DrawBorder3D(e.Graphics,
                                           new Rectangle(this.Width - 20, 0, 20, this.Height),
                                           Border3DStyle.RaisedInner);
             }
             e.Graphics.DrawImageUnscaled(zoom_in, new Point(this.Width - zoom_in.Width, 0));
         }
     }
     //100% zoom line
     e.Graphics.DrawLine(Pens.Black, this.Width / 2 - 1, 3 * this.Height / 4,
                         this.Width / 2 - 1, this.Height - 1);
     e.Graphics.DrawLine(Pens.White, this.Width / 2, 3 * this.Height / 4 + 1,
                         this.Width / 2, this.Height);
 }