示例#1
0
        /// <summary>
        /// Draws the slider arrows on both sides of the control.
        /// </summary>
        /// <param name="position">position value of the slider, lowest being at the bottom.  The range
        /// is between 0 and the controls height-9.  The values will be adjusted if too large/small</param>
        /// <param name="Unconditional">If Unconditional is true, the slider is drawn, otherwise some logic
        /// is performed to determine is drawing is really neccessary.</param>
        private void DrawSlider(Gdk.Window g, int position, bool Unconditional)
        {
            if (position < 0)
            {
                position = 0;
            }
            if (position > this.Allocation.Height - 9)
            {
                position = this.Allocation.Height - 9;
            }

            if (m_iMarker_Start_Y == position && !Unconditional)                //	If the marker position hasn't changed
            {
                return;                                                         //	since the last time it was drawn and we don't HAVE to redraw
            }
            //	then exit procedure

            m_iMarker_Start_Y = position;               //	Update the controls marker position

            this.ClearSlider(g);                        //	Remove old slider

            Gdk.GC gcfill = new Gdk.GC(g);
            //	Same gray color Photoshop uses
            gcfill.RgbFgColor = GraphUtil.gdkColorFromWinForms(Color.FromArgb(116, 114, 106));


            Gdk.GC gcborder = new Gdk.GC(g);
            gcfill.RgbFgColor = GraphUtil.gdkColorFromWinForms(Color.White);
            //	Same gray color Photoshop uses
            //Console.WriteLine( "position="+position );

            Gdk.Point[] arrow = new Gdk.Point[7];               //	 GGG
            arrow[0] = new Gdk.Point(1, position);              //	G   G
            arrow[1] = new Gdk.Point(3, position);              //	G    G
            arrow[2] = new Gdk.Point(7, position + 4);          //	G     G
            arrow[3] = new Gdk.Point(3, position + 8);          //	G      G
            arrow[4] = new Gdk.Point(1, position + 8);          //	G     G
            arrow[5] = new Gdk.Point(0, position + 7);          //	G    G
            arrow[6] = new Gdk.Point(0, position + 1);          //	G   G
            //	 GGG
            g.DrawPolygon(gcfill, true, arrow);                 //	Fill left arrow with white
            g.DrawPolygon(gcborder, false, arrow);              //	Draw left arrow border with gray

            //	    GGG
            arrow[0] = new Gdk.Point(this.Allocation.Width - 2, position);                      //	   G   G
            arrow[1] = new Gdk.Point(this.Allocation.Width - 4, position);                      //	  G    G
            arrow[2] = new Gdk.Point(this.Allocation.Width - 8, position + 4);                  //	 G     G
            arrow[3] = new Gdk.Point(this.Allocation.Width - 4, position + 8);                  //	G      G
            arrow[4] = new Gdk.Point(this.Allocation.Width - 2, position + 8);                  //	 G     G
            arrow[5] = new Gdk.Point(this.Allocation.Width - 1, position + 7);                  //	  G    G
            arrow[6] = new Gdk.Point(this.Allocation.Width - 1, position + 1);                  //	   G   G
            //	    GGG

            g.DrawPolygon(gcfill, true, arrow);                 //	Fill right arrow with white
            g.DrawPolygon(gcborder, false, arrow);              //	Draw right arrow border with gray
        }