Imitation apple AppStore download progress bar

Source: Internet
Author: User

Previously written by the project itself, a Winfrom user control that mimics the Apple AppStore download progress bar, is drawn by GDI. Effect

1 usingSystem.Drawing;2 usingSystem.Windows.Forms;3 usingSystem.ComponentModel;4 namespaceTest5 {6      Public classCircleprogressbar:control7     {8         float_progress =0F;9         float_wpen =1;Ten         float_npen =5; One         float_fwidth =Ten; A[Description ("progress bar Color")] -          PublicColor Circlecolor -         { the             Get; -             Set; -         } -[Description ("outer diameter roughness")] +          Public floatWpenthin -         { +             Get{return_wpen;} A             Set{_wpen =value;} at         } -[Description ("thickness of inner ring")] -          Public floatNpenthin -         { -             Get{return_npen;} -             Set{_npen =value;} in         } -[Description ("Inner square side length")] to          Public floatFWITDH +         { -             Get{return_fwidth;} the             Set{_fwidth =value;} *         } $          Public voidpaintprogress (PaintEventArgs e)Panax Notoginseng         { -             floatx = This. Width/2; the             floaty = This. Height/2;//Center coordinates +             floatWr = X-wpenthin/2;//Outer ring Radius A             floatNr = X-npenthin/2;//Inner Ring Radius the             intWx = (int) (X-Wr); +             intWy = (int) (Y-WR);//Outer ring starting coordinates -             intNx = (int) (X-Nr); $             intNy = (int) (Y-NR);//Outer ring starting coordinates $             intFy = (int) (y-fwitdh/2); -             intFx = (int) (x-fwitdh/2);//Inner Square coordinates -Graphics DC = This. CreateGraphics (); thedc. Clear ( This. BackColor); -Pen Wpen =NewPen (Circlecolor, Wpenthin);WuyiPen Npen =NewPen (Circlecolor, Npenthin); theBrush Fbrush =NewSolidBrush (circlecolor); -dc. SmoothingMode =System.Drawing.Drawing2D.SmoothingMode.HighQuality; Wu             floatStartAngle =- -; -             floatSweepAngle = Progress/ -* the;//Starting Angle AboutRectangle Wrec =NewRectangle (Wx, Wy,2* (int) Wr,2* (int) Wr); $Rectangle Nrec =NewRectangle (Nx, Ny,2* (int) Nr,2* (int) Nr); -Rectangle Frec =NewRectangle (Fx, Fy, (int) FWITDH, (int) FWITDH); - DC. DrawEllipse (Wpen, wrec); - DC. FillRectangle (Fbrush, Frec); A DC. DrawArc (Npen, Nrec, StartAngle, sweepAngle); +         } the          Public floatProgress -         { $             Get{return_progress;} the             Set the             { the                 if(_progress! = value && value >=0&& value <= -) the                 { -_progress =value; in onprogresschanged (); the                 } the             } About         } the         protected Virtual voidonprogresschanged () the         { the              This. Invalidate (); +         } -         protected Override voidOnPaint (PaintEventArgs e) the         {Bayi paintprogress (e); the             Base. OnPaint (e); the         } -     } -}

Imitation apple AppStore download progress bar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.