用Graphic畫出漸層色(2) in LinearGradientBrush

因為漸層的增量交給系統控制了

因此拿掉增量及間隔參數

        public static void vDrawLineGradient(System.Drawing.Graphics _G,//要用的Graphics
                                             double _dLightPoint,//最亮點在區塊的比例
                                             System.Drawing.Color _BaseColor,//基礎顏色
                                             int _iStartAlpha,//顏色開始的Alpha值
                                             int _iLightAlpha,//顏色最亮點的Alpha值
                                             int _iDarkAlpha,//顏色最暗點的Alpha值
                                             System.Drawing.Rectangle _DrawRect)//繪圖區塊
        {
            if (_iLightAlpha < 0)
                _iLightAlpha = 0;
            if (_iDarkAlpha > 255)
                _iDarkAlpha = 255;
            if (_iStartAlpha < 0)
                _iStartAlpha = 0;
            if (_iStartAlpha > 255)
                _iStartAlpha = 255;
            float iUpRectBottom = (float)(_DrawRect.Height * _dLightPoint);

            System.Drawing.RectangleF rectUp = new System.Drawing.RectangleF(_DrawRect.X, _DrawRect.Y, _DrawRect.Width, iUpRectBottom);
            System.Drawing.RectangleF rectDn = new System.Drawing.RectangleF(_DrawRect.X, (_DrawRect.Y + iUpRectBottom), _DrawRect.Width, _DrawRect.Height - iUpRectBottom);
            System.Drawing.Drawing2D.LinearGradientBrush tmpGradientBrushUp = new System.Drawing.Drawing2D.LinearGradientBrush(rectUp, System.Drawing.Color.FromArgb(_iStartAlpha, _BaseColor),
                                                                                                                                        System.Drawing.Color.FromArgb(_iLightAlpha, _BaseColor),
                                                                                                                                        90);
            System.Drawing.Drawing2D.LinearGradientBrush tmpGradientBrushDn = new System.Drawing.Drawing2D.LinearGradientBrush(rectDn, System.Drawing.Color.FromArgb(_iLightAlpha, _BaseColor),
                                                                                                                                        System.Drawing.Color.FromArgb(_iDarkAlpha, _BaseColor),
                                                                                                                                        90);
            _G.FillRectangle(tmpGradientBrushUp, rectUp);
            _G.FillRectangle(tmpGradientBrushDn, rectDn);
        }        

因為漸層的增量交給系統控制了

因此拿掉增量及間隔參數