コード例 #1
0
ファイル: ScrollBarTrack.cs プロジェクト: windygu/haina
 public void Draw(Graphics gr, Rectangle drawRect, Rectangle visibleRect, Rectangle trackRect, ScrollBarTrackType type, Resco.Controls.ScrollBar.ScrollBar.ScrollBarOrientation orientation, System.Drawing.Color parentColor)
 {
     if (this._borderStyle != ScrollBarBorderStyle.None)
     {
         Resco.Controls.ScrollBar.ScrollBar.BorderSide all = Resco.Controls.ScrollBar.ScrollBar.BorderSide.All;
         if (orientation == Resco.Controls.ScrollBar.ScrollBar.ScrollBarOrientation.Horizontal)
         {
             //all &= ~((type == ScrollBarTrackType.Low) ? 4 : 1);
             int temp = (int)all;
             temp &= ~((type == ScrollBarTrackType.Low) ? 4 : 1);
             all   = (Resco.Controls.ScrollBar.ScrollBar.BorderSide)temp;
         }
         else
         {
             //all &= ~((type == ScrollBarTrackType.Low) ? 8 : 2);
             int temp = (int)all;
             temp &= ~((type == ScrollBarTrackType.Low) ?  8 : 2);
             all   = (Resco.Controls.ScrollBar.ScrollBar.BorderSide)temp;
         }
         Resco.Controls.ScrollBar.ScrollBar.DoDrawBorder(gr, this._borderStyle, this._borderColor, drawRect, all, parentColor);
         drawRect.Inflate(-1, -1);
         if (orientation == Resco.Controls.ScrollBar.ScrollBar.ScrollBarOrientation.Horizontal)
         {
             drawRect.Width++;
             if (type == ScrollBarTrackType.High)
             {
                 drawRect.X--;
             }
         }
         else
         {
             drawRect.Height++;
             if (type == ScrollBarTrackType.High)
             {
                 drawRect.Y--;
             }
         }
     }
     if ((this._image != null) || this._gradientColor.CanDraw())
     {
         Rectangle destRect = drawRect;
         Region    clip     = null;
         if (this._trackLayout == ScrollBarTrackLayout.FixedToTrack)
         {
             destRect = trackRect;
             clip     = gr.Clip;
             Region helperRegion = Resco.Controls.ScrollBar.ScrollBar.GetHelperRegion();
             helperRegion.MakeEmpty();
             helperRegion.Union(drawRect);
             gr.Clip = helperRegion;
         }
         if (this._image != null)
         {
             gr.DrawImage(this._image, destRect, new Rectangle(0, 0, this._image.Width, this._image.Height), GraphicsUnit.Pixel);
         }
         else
         {
             this._gradientColor.DrawGradient(gr, destRect);
         }
         if (this._trackLayout == ScrollBarTrackLayout.FixedToTrack)
         {
             gr.Clip = clip;
         }
     }
     else
     {
         gr.FillRectangle(Resco.Controls.ScrollBar.ScrollBar.GetBrush(this._color), drawRect);
     }
 }
コード例 #2
0
ファイル: ScrollBar.cs プロジェクト: north0808/haina
        private void DoDrawTrack(Graphics gr, Rectangle drawRect, Rectangle visibleRect, Rectangle trackRect, ScrollBarElementState state, ScrollBarTrackType type)
        {
            ScrollBarTrack defaultHighlight = null;
            switch (state)
            {
                case ScrollBarElementState.Normal:
                    defaultHighlight = (type == ScrollBarTrackType.Low) ? this.LowTrack : this.HighTrack;
                    break;

                case ScrollBarElementState.Pressed:
                    defaultHighlight = (type == ScrollBarTrackType.Low) ? this.LowTrackHighlight : this.HighTrackHighlight;
                    break;

                case ScrollBarElementState.Disabled:
                    defaultHighlight = (type == ScrollBarTrackType.Low) ? this.LowTrackDisabled : this.HighTrackDisabled;
                    break;
            }
            if (defaultHighlight == null)
            {
                switch (state)
                {
                    case ScrollBarElementState.Normal:
                        defaultHighlight = ScrollBarTrack.Default;
                        break;

                    case ScrollBarElementState.Pressed:
                        defaultHighlight = ScrollBarTrack.DefaultHighlight;
                        break;

                    case ScrollBarElementState.Disabled:
                        defaultHighlight = ScrollBarTrack.DefaultDisabled;
                        break;
                }
            }
            Color window = SystemColors.Window;
            if (base.Parent != null)
            {
                window = base.Parent.BackColor;
            }
            defaultHighlight.Draw(gr, drawRect, visibleRect, trackRect, type, this._scrollBarOrientation, window);
        }
コード例 #3
0
ファイル: ScrollBarTrack.cs プロジェクト: north0808/haina
 public void Draw(Graphics gr, Rectangle drawRect, Rectangle visibleRect, Rectangle trackRect, ScrollBarTrackType type, Resco.Controls.ScrollBar.ScrollBar.ScrollBarOrientation orientation, System.Drawing.Color parentColor)
 {
     if (this._borderStyle != ScrollBarBorderStyle.None)
     {
         Resco.Controls.ScrollBar.ScrollBar.BorderSide all = Resco.Controls.ScrollBar.ScrollBar.BorderSide.All;
         if (orientation == Resco.Controls.ScrollBar.ScrollBar.ScrollBarOrientation.Horizontal)
         {
             //all &= ~((type == ScrollBarTrackType.Low) ? 4 : 1);
             int temp = (int)all;
             temp&= ~((type == ScrollBarTrackType.Low) ? 4 : 1);
             all = (Resco.Controls.ScrollBar.ScrollBar.BorderSide)temp;
         }
         else
         {
             //all &= ~((type == ScrollBarTrackType.Low) ? 8 : 2);
             int temp = (int)all;
             temp &= ~((type == ScrollBarTrackType.Low) ?  8 : 2);
             all = (Resco.Controls.ScrollBar.ScrollBar.BorderSide)temp;
         }
         Resco.Controls.ScrollBar.ScrollBar.DoDrawBorder(gr, this._borderStyle, this._borderColor, drawRect, all, parentColor);
         drawRect.Inflate(-1, -1);
         if (orientation == Resco.Controls.ScrollBar.ScrollBar.ScrollBarOrientation.Horizontal)
         {
             drawRect.Width++;
             if (type == ScrollBarTrackType.High)
             {
                 drawRect.X--;
             }
         }
         else
         {
             drawRect.Height++;
             if (type == ScrollBarTrackType.High)
             {
                 drawRect.Y--;
             }
         }
     }
     if ((this._image != null) || this._gradientColor.CanDraw())
     {
         Rectangle destRect = drawRect;
         Region clip = null;
         if (this._trackLayout == ScrollBarTrackLayout.FixedToTrack)
         {
             destRect = trackRect;
             clip = gr.Clip;
             Region helperRegion = Resco.Controls.ScrollBar.ScrollBar.GetHelperRegion();
             helperRegion.MakeEmpty();
             helperRegion.Union(drawRect);
             gr.Clip = helperRegion;
         }
         if (this._image != null)
         {
             gr.DrawImage(this._image, destRect, new Rectangle(0, 0, this._image.Width, this._image.Height), GraphicsUnit.Pixel);
         }
         else
         {
             this._gradientColor.DrawGradient(gr, destRect);
         }
         if (this._trackLayout == ScrollBarTrackLayout.FixedToTrack)
         {
             gr.Clip = clip;
         }
     }
     else
     {
         gr.FillRectangle(Resco.Controls.ScrollBar.ScrollBar.GetBrush(this._color), drawRect);
     }
 }
コード例 #4
0
ファイル: DrawTrackEventArgs.cs プロジェクト: windygu/haina
 public DrawTrackEventArgs(Graphics graphics, Rectangle bounds, ScrollBarElementState state, Rectangle visibleRect, Rectangle trackRect, ScrollBarTrackType track) : base(graphics, bounds, state)
 {
     this._visibleRect = visibleRect;
     this._trackRect   = trackRect;
     this._track       = track;
 }