資源簡介
c#自定義的進度條和音樂播放器的進度條一樣炫,絕對值5分,控件的屬性中有個布爾類型的IsPlay,如果為true的話,進度點就會閃爍,有當前點Current,自己看吧

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Drawing;
using?System.Data;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Drawing.Drawing2D;
using?System.Drawing.Imaging;
namespace?ControlProcess
{
????[DefaultEvent(“ProgressClick“)]
????[ToolboxBitmap(typeof(TrackBar))]
????public?partial?class?ProcessBar?:?UserControl
????{
????????public?ProcessBar()
????????{
????????????//232進度條
????????????InitializeComponent();
????????????//this.Setstyle(Controlstyles.UserPaint?true);
????????????//this.Setstyle(Controlstyles.AllPaintingInWmPaint?true);
????????????//this.Setstyle(Controlstyles.DoubleBuffer?true);
????????}
????????private?int?locationX=0;
????????[Description(“單擊時X的坐標“)]
????????public?int?LocationX
????????{
????????????get?{?return?locationX;?}
????????}
???
????????private?int?current?=?0;
????????[Description(“當前進度“)]
????????public?int?Current
????????{
????????????get?{?return?current;?}
????????????set
????????????{
????????????????if?(value?>?232?||?value?0)
????????????????????return;
????????????????current?=?value;
????????????????panelCurrent.Size?=?new?Size(value?1);
????????????????picture.Location?=?new?Point(value?-?4?-3);
????????????????Invalidate();
????????????}
????????}
????????private?bool?isPlay?=?false;
????????[Description(“是否播放“)]
????????public?bool?IsPlay
????????{
????????????get?{?return?isPlay;?}
????????????set?{?isPlay?=?value;?tmrCurrent.Enabled?=?isPlay;?Invalidate();?}
????????}
????????public?delegate?void?MouseHandle(object?senderEventArgs?e);
????????[Description(“點下鼠標“)]
????????public?event?MouseHandle?BarMouseDown;
????????int?picturetype?=?0;
????????private?void?tmrCurrent_Tick(object?sender?EventArgs?e)
????????{
????????????if?(picturetype?==?0)
????????????{?picture.Image?=?Properties.Resources.play_slider_thumb;?picturetype?=?1;?}
????????????else
????????????{?picture.Image?=?Properties.Resources.play_slider_thumb_animate;?picturetype?=?0;?}
????????????GraphicsPath?g?=?subGraphicsPath(picture.Image);
????????????if?(g?==?null)?return;
????????????picture.Region?=?new?Region(g);
????????}
????????private?unsafe?static?GraphicsPath?subGraphicsPath(Image?img)
????????{
????????????if?(img?==?null)?return?null;
????????????//?建立GraphicsPath?給我們的位圖路徑計算使用???
????????????GraphicsPath?g?=?new?GraphicsPath(FillMode.Alternate);
????????????Bitmap?bitmap?=?new?Bitmap(img);
????????????int?width?=?bitmap.Width;
????????????int?height?=?bitmap.Height;
????????????BitmapData?bmData?=?bitmap.LockBits(new?Rectangle(0?0?width?height)?ImageLockMode.ReadWrite?PixelFormat.Format24bppRgb);
????????????byte*?p?=?(byte*)bmData.Scan0;
????????????int?offset?=?bmData.Stride?-?width?*?3;
????????????int?p0?p1?p2;?????????//?記錄左上角0,0座標的顏色值??
????????????p0?=?p[0];
????????????p1?=?p[1];
????????????p2?=?p[2];
????????????int?star
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????16384??2014-02-19?22:37??ControlProcess\bin\Debug\ControlProcess.dll
?????文件??????19968??2014-02-19?22:37??ControlProcess\bin\Debug\ControlProcess.pdb
?????文件???????3702??2014-02-06?14:30??ControlProcess\ControlProcess.csproj
?????文件????????671??2014-02-19?22:37??ControlProcess\obj\Debug\ControlProcess.csproj.FileListAbsolute.txt
?????文件??????16384??2014-02-19?22:37??ControlProcess\obj\Debug\ControlProcess.dll
?????文件??????19968??2014-02-19?22:37??ControlProcess\obj\Debug\ControlProcess.pdb
?????文件????????180??2014-02-19?22:37??ControlProcess\obj\Debug\ControlProcess.ProcessBar.resources
?????文件???????4897??2014-02-19?22:37??ControlProcess\obj\Debug\ControlProcess.Properties.Resources.resources
?????文件??????15072??2014-02-06?15:26??ControlProcess\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6401??2014-02-19?22:37??ControlProcess\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????290??2014-02-19?22:37??ControlProcess\obj\Debug\GenerateResource.read.1.tlog
?????文件????????554??2014-02-19?22:37??ControlProcess\obj\Debug\GenerateResource.write.1.tlog
?????文件???????4608??2014-02-06?15:16??ControlProcess\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件???????5148??2014-02-12?11:38??ControlProcess\ProcessBar.cs
?????文件???????4320??2014-02-12?11:35??ControlProcess\ProcessBar.Designer.cs
?????文件???????6015??2014-02-12?11:35??ControlProcess\ProcessBar.resx
?????文件???????1380??2014-02-05?17:02??ControlProcess\Properties\AssemblyInfo.cs
?????文件???????3429??2014-02-06?15:16??ControlProcess\Properties\Resources.Designer.cs
?????文件??????12589??2014-02-06?15:16??ControlProcess\Properties\Resources.resx
?????文件???????3020??2014-02-06?10:19??ControlProcess\Resources\play_slider_thumb.png
?????文件???????1257??2014-02-06?10:19??ControlProcess\Resources\play_slider_thumb_animate.png
?????目錄??????????0??2014-02-06?15:16??ControlProcess\obj\Debug\TempPE
?????目錄??????????0??2014-02-19?22:37??ControlProcess\bin\Debug
?????目錄??????????0??2014-02-05?17:03??ControlProcess\bin\Release
?????目錄??????????0??2014-02-19?22:37??ControlProcess\obj\Debug
?????目錄??????????0??2014-02-05?17:03??ControlProcess\bin
?????目錄??????????0??2014-02-05?17:02??ControlProcess\obj
?????目錄??????????0??2014-02-06?10:18??ControlProcess\Properties
?????目錄??????????0??2014-02-06?10:19??ControlProcess\Resources
?????目錄??????????0??2014-02-06?10:19??ControlProcess
............此處省略3個文件信息
評論
共有 條評論