Exemple #1
0
 private void CreateBuffer(Rectangle bounds)
 {
     // draw it into a buffer
     if (_cDrawDc != null)
     {
         _cDrawDc.Dispose();
     }
     _cDrawDc        = new cStoreDc();
     _cDrawDc.Width  = bounds.Width;
     _cDrawDc.Height = bounds.Height;
     bounds.X        = 0;
     bounds.Y        = 0;
     PositionWindow();
     using (Graphics g = Graphics.FromHdc(_cDrawDc.Hdc))
     {
         CopyBackground(g);
         g.SmoothingMode = SmoothingMode.HighQuality;
         bounds.Inflate(-4, -4);
         DrawDropShadow(g, bounds, 4, 255);
         DrawBackGround(g, bounds);
         DrawBorder(g, bounds);
         DrawCaption(g, bounds);
         DrawTitle(g, bounds);
         DrawIcon(g, bounds);
     }
 }
Exemple #2
0
        private void CreateGraphBar(int width, int height)
        {
            int barwidth  = ((width - 4) / 21);
            int barheight = height - 2;

            if (_bmpGraphBar != null)
            {
                _bmpGraphBar.Dispose();
            }
            _bmpGraphBar = new Bitmap(barwidth, barheight);

            Rectangle barRect = new Rectangle(0, 0, barwidth, barheight);

            using (Graphics g = Graphics.FromImage(_bmpGraphBar))
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                using (LinearGradientBrush fillBrush = new LinearGradientBrush(barRect, Color.FromArgb(0, 255, 0), Color.FromArgb(255, 0, 0), LinearGradientMode.Vertical))
                {
                    Color[] fillColors =
                    {
                        Color.FromArgb(255,   0, 0),
                        Color.FromArgb(255,  64, 0),
                        Color.FromArgb(255, 128, 0),
                        Color.FromArgb(255, 196, 0),
                        Color.FromArgb(255, 255, 0),
                        Color.FromArgb(196, 255, 0),
                        Color.FromArgb(128, 255, 0),
                        Color.FromArgb(64,  255, 0),
                        Color.FromArgb(0,   255, 0)
                    };

                    float[]    fillPositions = { 0f, .2f, .4f, .5f, .6f, .7f, .8f, .9f, 1f };
                    ColorBlend myBlend       = new ColorBlend();
                    myBlend.Colors                = fillColors;
                    myBlend.Positions             = fillPositions;
                    fillBrush.InterpolationColors = myBlend;
                    g.FillRectangle(fillBrush, barRect);
                }
            }

            _cBufferDc         = new cStoreDc();
            _cBufferDc.Height  = height;
            _cBufferDc.Width   = width;
            _cGraphicDc        = new cStoreDc();
            _cGraphicDc.Height = _bmpGraphBar.Height;
            _cGraphicDc.Width  = _bmpGraphBar.Width;
            _cGraphicDc.SelectImage(_bmpGraphBar);
        }
Exemple #3
0
 private void StartPulseTimer()
 {
     if (_cPulseTimer == null)
     {
         _bPulseTimerOn = true;
         if (_cAnimationDc != null)
             _cAnimationDc.Dispose();
         _cAnimationDc = new cStoreDc();
         _cAnimationDc.Width = _cControlDc.Width;
         _cAnimationDc.Height = _cControlDc.Height;
         BitBlt(_cAnimationDc.Hdc, 0, 0, _cControlDc.Width, _cControlDc.Height, _cControlDc.Hdc, 0, 0, 0xCC0020);
         // timer setup
         _cPulseTimer = new FadeTimer(this);
         _cPulseTimer.Tick += _cPulseTimer_Tick;
         _cPulseTimer.Complete += _cPulseTimer_Complete;
         _cPulseTimer.Interval = (int)AnimationSpeed;
         _cPulseTimer.Fade(FadeTimer.FadeType.Loop);
     }
 }
Exemple #4
0
 /// <summary>Create graphics objects</summary>
 private void CreateGraphicsObjects()
 {
     DestroyGraphicsObjects();
     // load primary buffer
     _cControlDc = new cStoreDc();
     _cControlDc.Height = Height;
     _cControlDc.Width = Width;
     // track and background dc
     _cTrackDc = new cStoreDc();
     _cTrackDc.Height = Height;
     _cTrackDc.Width = Width;
     // draw the track
     CreateTrack();
     // create the button image
     CreateButtonBitmap();
     // create the animation sprite
     CreateSprite();
 }
Exemple #5
0
 /// <summary>
 /// Release resources
 /// </summary>
 private void DeInit()
 {
     _bHasInitialized = false;
     // reset region
     Control ct = (Control)this;
     if (ct.Region != null)
     {
         ct.Region = null;
     }
     if (_gpButtonPath != null)
     {
         _gpButtonPath.Dispose();
         _gpButtonPath = null;
     }
     if (_hButtonRegion != null)
     {
         _hButtonRegion.Dispose();
         _hButtonRegion = null;
     }
     // release resources
     if (_cButtonDc != null)
     {
         _cButtonDc.Dispose();
         _cButtonDc = null;
     }
     if (_cTempDc != null)
     {
         _cTempDc.Dispose();
         _cTempDc = null;
     }
     StopSwirlTimer();
     StopResizeTimer();
     StopPulseTimer();
     StopSwishTimer();
     DestroySwish();
     DestroyResize();
     DestroySwirl();
 }
Exemple #6
0
 /// <summary>
 /// Create the bitmaps, temp dc, and Start the Fade Timer
 /// </summary>
 private void StartSwishTimer()
 {
     if (_cSwishTimer == null)
     {
         _bSwishTimerOn = true;
         CreateSwish();
         // set up the dc
         if (_cTempDc != null)
             _cTempDc.Dispose();
         _cTempDc = new cStoreDc();
         _cTempDc.Width = _cButtonDc.Width;
         _cTempDc.Height = _cButtonDc.Height;
         // blit in clean button
         BitBlt(_cTempDc.Hdc, 0, 0, _cButtonDc.Width, _cButtonDc.Height, _cButtonDc.Hdc, 0, 0, 0xCC0020);
         // reset stage
         _tSwishStage = new SwishStage(false);
         // timer setup
         _cSwishTimer = new FadeTimer(this);
         _cSwishTimer.Tick += new FadeTimer.TickDelegate(_cSwishTimer_Tick);
         _cSwishTimer.Complete += new FadeTimer.CompleteDelegate(_cSwishTimer_Complete);
         _cSwishTimer.Interval = 10;
         _cSwishTimer.Fade(FadeTimer.FadeType.Loop);
     }
 }
Exemple #7
0
 /// <summary>
 /// Setup of buffer dc and Fade timer
 /// </summary>
 private void StartSwirlTimer()
 {
     if (_cSwirlTimer == null)
     {
         _bSwirlTimerOn = true;
         if (_cTempDc != null)
             _cTempDc.Dispose();
         _cTempDc = new cStoreDc();
         _cTempDc.Width = _cButtonDc.Width;
         _cTempDc.Height = _cButtonDc.Height;
         BitBlt(_cTempDc.Hdc, 0, 0, _cButtonDc.Width, _cButtonDc.Height, _cButtonDc.Hdc, 0, 0, 0xCC0020);
         // timer setup
         _cSwirlTimer = new FadeTimer(this);
         _cSwirlTimer.Tick += new FadeTimer.TickDelegate(_cSwirlTimer_Tick);
         _cSwirlTimer.Complete += new FadeTimer.CompleteDelegate(_cSwirlTimer_Complete);
         if (this.Image != null)
         {
             if (Image.Width > 128)//v1.1 added some delay adjsutments ju
                 _cSwirlTimer.Interval = 28;
             else if (Image.Width < 128)
                 _cSwirlTimer.Interval = 36;
             else
                 _cSwirlTimer.Interval = 32;
         }
         else
         {
             _cSwirlTimer.Interval = 32;
         }
         _cSwirlTimer.Fade(FadeTimer.FadeType.Loop);
     }
 }
Exemple #8
0
 /// <summary>
 /// Create dc, and setup Fade Timer
 /// </summary>
 private void StartPulseTimer()
 {
     if (_cPulseTimer == null)
     {
         _bPulseTimerOn = true;
         _iPulseTick = 0;
         if (_cTempDc != null)
             _cTempDc.Dispose();
         _cTempDc = new cStoreDc();
         _cTempDc.Width = _cButtonDc.Width;
         _cTempDc.Height = _cButtonDc.Height;
         // blit clean image in
         BitBlt(_cTempDc.Hdc, 0, 0, _cButtonDc.Width, _cButtonDc.Height, _cButtonDc.Hdc, 0, 0, 0xCC0020);
         // timer setup
         _cPulseTimer = new FadeTimer(this);
         _cPulseTimer.Tick += new FadeTimer.TickDelegate(_cPulseTimer_Tick);
         _cPulseTimer.Complete += new FadeTimer.CompleteDelegate(_cPulseTimer_Complete);
         _cPulseTimer.Interval = 40;
         _cPulseTimer.Fade(FadeTimer.FadeType.Loop);
     }
 }
Exemple #9
0
 /// <summary>
 /// Load the primary graphics buffer
 /// </summary>
 private void LoadBuffers()
 {
     // load the buffer
     if (_cButtonDc != null)
         _cButtonDc.Dispose();
     _cButtonDc = new cStoreDc();
     _cButtonDc.Height = this.Height;
     _cButtonDc.Width = this.Width;
     if (_eButtonStyle == ButtonStyle.MenuButton)
         CreateSwirl();
 }