Beispiel #1
0
        protected void UpdateColors()
        {
            if (Created && _rebar != null)
            {
                COLORSCHEME CSInfo = new COLORSCHEME();
                CSInfo.dwSize          = (uint)Marshal.SizeOf(CSInfo);
                CSInfo.clrBtnHighlight = new COLORREF(_embossHighlight);
                CSInfo.clrBtnShadow    = new COLORREF(_embossShadow);
                win32.SendMessage(_rebar.Handle, (int)win32.RB_SETCOLORSCHEME, 0, ref CSInfo);

                COLORREF color = new COLORREF(this.ForeColor);
                win32.SendMessage(_rebar.Handle, (int)win32.RB_SETTEXTCOLOR, 0, color);
                color = new COLORREF(this.BackColor);
                win32.SendMessage(_rebar.Handle, (int)win32.RB_SETBKCOLOR, 0, color);
            }
        }
        /// <summary>
        /// The ColorMapper constructor.
        /// </summary>
        /// <param name="dfMin">Specifies the minimum value in the number range.</param>
        /// <param name="dfMax">Specifies the maximum value in the number range.</param>
        /// <param name="clrDefault">Specifies the default color to use.</param>
        /// <param name="clrError">Specifies the color to use when an error is detected.</param>
        /// <param name="clrScheme">Specifies the color scheme to use (default = COLORSCHEME.NORMAL).</param>
        /// <param name="nResolution">Specifies the number of colors to generate (default = 160).</param>
        public ColorMapper(double dfMin, double dfMax, Color clrDefault, Color clrError, COLORSCHEME clrScheme = COLORSCHEME.NORMAL, int nResolution = 160)
        {
            m_clrDefault  = clrDefault;
            m_clrError    = clrError;
            m_nResolution = nResolution;
            m_dfMin       = dfMin;
            m_dfMax       = dfMax;

            if (clrScheme == COLORSCHEME.GBR)
            {
                m_rgrgColors.Add(new List <double>()
                {
                    1, 0, 0
                });                                                 // red
                m_rgrgColors.Add(new List <double>()
                {
                    0, 0, 0.5
                });                                                   // blue
                m_rgrgColors.Add(new List <double>()
                {
                    0, 1, 0
                });                                                 // green
            }
            else
            {
                m_rgrgColors.Add(new List <double>()
                {
                    0, 0, 0
                });                                                 // black
                m_rgrgColors.Add(new List <double>()
                {
                    0, 0, 1
                });                                                 // blue
                m_rgrgColors.Add(new List <double>()
                {
                    0, 1, 0
                });                                                 // green
                m_rgrgColors.Add(new List <double>()
                {
                    1, 0, 0
                });                                                 // red
                m_rgrgColors.Add(new List <double>()
                {
                    1, 1, 0
                });                                                 // yellow
            }


            double dfRange = dfMax - dfMin;
            double dfInc   = dfRange / m_nResolution;

            dfMax = dfMin + dfInc;

            while (dfMax < m_dfMax)
            {
                Color clr = calculate(dfMin);
                m_rgColorMappings.Add(new KeyValuePair <Color, SizeF>(clr, new SizeF((float)dfMin, (float)dfMax)));
                dfMin  = dfMax;
                dfMax += dfInc;
            }
        }
Beispiel #3
0
        /// <summary>
        /// The ColorMapper constructor.
        /// </summary>
        /// <param name="dfMin">Specifies the minimum value in the number range.</param>
        /// <param name="dfMax">Specifies the maximum value in the number range.</param>
        /// <param name="clrDefault">Specifies the default color to use.</param>
        /// <param name="clrError">Specifies the color to use when an error is detected.</param>
        /// <param name="clrScheme">Specifies the color scheme to use (default = COLORSCHEME.NORMAL).</param>
        /// <param name="nResolution">Specifies the number of colors to generate (default = 160).</param>
        public ColorMapper(double dfMin, double dfMax, Color clrDefault, Color clrError, COLORSCHEME clrScheme = COLORSCHEME.NORMAL, int nResolution = 160)
        {
            m_clrDefault  = clrDefault;
            m_clrError    = clrError;
            m_nResolution = nResolution;
            m_dfMin       = dfMin;
            m_dfMax       = dfMax;

            if (clrScheme == COLORSCHEME.GBR)
            {
                m_rgrgColors.Add(new List <double>()
                {
                    1, 0, 0
                });                                                 // red
                m_rgrgColors.Add(new List <double>()
                {
                    0, 0, 0.5
                });                                                   // blue
                m_rgrgColors.Add(new List <double>()
                {
                    0, 1, 0
                });                                                 // green
            }
            else
            {
                m_rgrgColors.Add(new List <double>()
                {
                    0, 0, 0
                });                                                 // black
                m_rgrgColors.Add(new List <double>()
                {
                    0, 0, 1
                });                                                 // blue
                m_rgrgColors.Add(new List <double>()
                {
                    0, 1, 0
                });                                                 // green
                m_rgrgColors.Add(new List <double>()
                {
                    1, 0, 0
                });                                                 // red
                m_rgrgColors.Add(new List <double>()
                {
                    1, 1, 0
                });                                                 // yellow
            }


            double dfMin1 = dfMin;
            double dfMax1 = dfMax;

            double dfRange = dfMax - dfMin;
            double dfInc   = dfRange / m_nResolution;

            dfMax = dfMin + dfInc;

            while (dfMax < m_dfMax)
            {
                Color clr = calculate(dfMin);
                m_rgColorMappings.Add(new KeyValuePair <Color, SizeF>(clr, new SizeF((float)dfMin, (float)dfMax)));
                dfMin  = dfMax;
                dfMax += dfInc;
            }

            if (m_rgColorMappings.Count == 0)
            {
                m_rgColorMappings.Add(new KeyValuePair <Color, SizeF>(Color.Black, new SizeF((float)dfMin1, (float)dfMax1)));
            }

            m_dfMid    = dfRange / 2;
            m_nMidIdx  = m_rgColorMappings.Count / 2;
            m_rgQuads0 = createSearchQuads(0, 0, m_rgColorMappings.Count, dfRange);
            m_rgQuads1 = createSearchQuads(m_dfMid, m_nMidIdx, m_rgColorMappings.Count, dfRange);
        }
Beispiel #4
0
        protected void UpdateColors() {
            if ( Created && _rebar != null ) {
                COLORSCHEME CSInfo = new COLORSCHEME();
                CSInfo.dwSize = (uint)Marshal.SizeOf( CSInfo );
                CSInfo.clrBtnHighlight = new COLORREF( _embossHighlight );
                CSInfo.clrBtnShadow = new COLORREF( _embossShadow );
                win32.SendMessage( _rebar.Handle, (int)win32.RB_SETCOLORSCHEME, 0, ref CSInfo );

                COLORREF color = new COLORREF( this.ForeColor );
                win32.SendMessage( _rebar.Handle, (int)win32.RB_SETTEXTCOLOR, 0, color );
                color = new COLORREF( this.BackColor );
                win32.SendMessage( _rebar.Handle, (int)win32.RB_SETBKCOLOR, 0, color );
            }
        }