Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65fdb92

Browse files
committed
Merge branch 'release/1.2.1' into main
2 parents616bd93 +6b68977 commit65fdb92

19 files changed

+673
-54
lines changed
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
usingSystem;
2+
usingSystem.ComponentModel;
3+
usingSystem.Windows.Forms;
4+
usingSystem.Drawing;
5+
6+
namespaceColorProgressBar
7+
{
8+
[Description("Color Progress Bar")]
9+
[ToolboxBitmap(typeof(ProgressBar))]
10+
[Designer(typeof(ColorProgressBarDesigner))]
11+
publicclassColorProgressBar:System.Windows.Forms.Control
12+
{
13+
14+
privateint_Value=0;
15+
privateint_Minimum=0;
16+
privateint_Maximum=100;
17+
privateint_Step=10;
18+
19+
privateColor_BarColor=Color.FromArgb(255,128,128);
20+
privateColor_BorderColor=Color.Black;
21+
22+
publicenumFillStyles
23+
{
24+
Solid,
25+
Dashed
26+
}
27+
28+
publicColorProgressBar()
29+
{
30+
base.Size=newSize(150,15);
31+
SetStyle(ControlStyles.AllPaintingInWmPaint|ControlStyles.ResizeRedraw|ControlStyles.DoubleBuffer,true);
32+
}
33+
34+
[Description("ColorProgressBar color")]
35+
[Category("ColorProgressBar")]
36+
publicColorBarColor
37+
{
38+
get
39+
{
40+
return_BarColor;
41+
}
42+
set
43+
{
44+
_BarColor=value;
45+
this.Invalidate();
46+
}
47+
}
48+
49+
[Description("The current value for the ColorProgressBar, in the range specified by the Minimum and Maximum properties.")]
50+
[Category("ColorProgressBar")]
51+
[RefreshProperties(RefreshProperties.All)]
52+
publicintValue
53+
{
54+
get
55+
{
56+
return_Value;
57+
}
58+
set
59+
{
60+
if(value<_Minimum)
61+
{
62+
thrownewArgumentException("'"+value+"' is not a valid value for 'Value'.\n"+
63+
"'Value' must be between 'Minimum' and 'Maximum'.");
64+
}
65+
66+
if(value>_Maximum)
67+
{
68+
thrownewArgumentException("'"+value+"' is not a valid value for 'Value'.\n"+
69+
"'Value' must be between 'Minimum' and 'Maximum'.");
70+
}
71+
72+
_Value=value;
73+
this.Invalidate();
74+
}
75+
}
76+
77+
[Description("The lower bound of the range this ColorProgressbar is working with.")]
78+
[Category("ColorProgressBar")]
79+
[RefreshProperties(RefreshProperties.All)]
80+
publicintMinimum
81+
{
82+
get
83+
{
84+
return_Minimum;
85+
}
86+
set
87+
{
88+
_Minimum=value;
89+
90+
if(_Minimum>_Maximum)
91+
_Maximum=_Minimum;
92+
if(_Minimum>_Value)
93+
_Value=_Minimum;
94+
95+
this.Invalidate();
96+
}
97+
}
98+
99+
[Description("The uppper bound of the range this ColorProgressbar is working with.")]
100+
[Category("ColorProgressBar")]
101+
[RefreshProperties(RefreshProperties.All)]
102+
publicintMaximum
103+
{
104+
get
105+
{
106+
return_Maximum;
107+
}
108+
set
109+
{
110+
_Maximum=value;
111+
112+
if(_Maximum<_Value)
113+
_Value=_Maximum;
114+
if(_Maximum<_Minimum)
115+
_Minimum=_Maximum;
116+
117+
this.Invalidate();
118+
}
119+
}
120+
121+
[Description("The amount to jump the current value of the control by when the Step() method is called.")]
122+
[Category("ColorProgressBar")]
123+
publicintStep
124+
{
125+
get
126+
{
127+
return_Step;
128+
}
129+
set
130+
{
131+
_Step=value;
132+
this.Invalidate();
133+
}
134+
}
135+
136+
[Description("The border color of ColorProgressBar")]
137+
[Category("ColorProgressBar")]
138+
publicColorBorderColor
139+
{
140+
get
141+
{
142+
return_BorderColor;
143+
}
144+
set
145+
{
146+
_BorderColor=value;
147+
this.Invalidate();
148+
}
149+
}
150+
151+
///
152+
/// <summary>Call the PerformStep() method to increase the value displayed by the amount set in the Step property</summary>
153+
///
154+
publicvoidPerformStep()
155+
{
156+
if(_Value<_Maximum)
157+
_Value+=_Step;
158+
else
159+
_Value=_Maximum;
160+
161+
this.Invalidate();
162+
}
163+
164+
///
165+
/// <summary>Call the PerformStepBack() method to decrease the value displayed by the amount set in the Step property</summary>
166+
///
167+
publicvoidPerformStepBack()
168+
{
169+
if(_Value>_Minimum)
170+
_Value-=_Step;
171+
else
172+
_Value=_Minimum;
173+
174+
this.Invalidate();
175+
}
176+
177+
///
178+
/// <summary>Call the Increment() method to increase the value displayed by an integer you specify</summary>
179+
///
180+
publicvoidIncrement(intvalue)
181+
{
182+
if(_Value<_Maximum)
183+
_Value+=value;
184+
else
185+
_Value=_Maximum;
186+
187+
this.Invalidate();
188+
}
189+
190+
//
191+
// <summary>Call the Decrement() method to decrease the value displayed by an integer you specify</summary>
192+
//
193+
publicvoidDecrement(intvalue)
194+
{
195+
if(_Value>_Minimum)
196+
_Value-=value;
197+
else
198+
_Value=_Minimum;
199+
200+
this.Invalidate();
201+
}
202+
203+
protectedoverridevoidOnPaint(System.Windows.Forms.PaintEventArgse)
204+
{
205+
//
206+
// Check for value
207+
//
208+
if(_Maximum==_Minimum||_Value==0)
209+
{
210+
// Draw border only and exit;
211+
DrawBorder(e.Graphics);
212+
return;
213+
}
214+
215+
//
216+
// The following is the width of the bar. This will vary with each value.
217+
//
218+
intfillWidth=(this.Width*_Value)/(_Maximum-_Minimum);
219+
220+
//
221+
// Rectangles for upper and lower half of bar
222+
//
223+
Rectanglerect=newRectangle(0,0,fillWidth,this.Height);
224+
225+
//
226+
// The brush
227+
//
228+
SolidBrushbrush=newSolidBrush(_BarColor);
229+
e.Graphics.FillRectangle(brush,rect);
230+
brush.Dispose();
231+
232+
//
233+
// Draw border and exit
234+
DrawBorder(e.Graphics);
235+
}
236+
237+
protectedvoidDrawBorder(Graphicsg)
238+
{
239+
RectangleborderRect=newRectangle(0,0,
240+
ClientRectangle.Width-1,ClientRectangle.Height-1);
241+
g.DrawRectangle(newPen(_BorderColor,1),borderRect);
242+
}
243+
}
244+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ProjectToolsVersion="15.0"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ImportProject="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<ConfigurationCondition=" '$(Configuration)' == ''">Debug</Configuration>
6+
<PlatformCondition=" '$(Platform)' == ''">AnyCPU</Platform>
7+
<ProjectGuid>{739E6F07-E688-4D16-8FDF-7472E7F0FEA0}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<RootNamespace>ColorProgressBar</RootNamespace>
10+
<AssemblyName>ColorProgressBar</AssemblyName>
11+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<Deterministic>true</Deterministic>
14+
</PropertyGroup>
15+
<PropertyGroupCondition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroupCondition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<PropertyGroup>
35+
<StartupObject />
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<ReferenceInclude="System" />
39+
<ReferenceInclude="System.Core" />
40+
<ReferenceInclude="System.Design" />
41+
<ReferenceInclude="System.Xml.Linq" />
42+
<ReferenceInclude="System.Data.DataSetExtensions" />
43+
<ReferenceInclude="Microsoft.CSharp" />
44+
<ReferenceInclude="System.Data" />
45+
<ReferenceInclude="System.Deployment" />
46+
<ReferenceInclude="System.Drawing" />
47+
<ReferenceInclude="System.Windows.Forms" />
48+
<ReferenceInclude="System.Xml" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<CompileInclude="ColorProgressBar.cs">
52+
<SubType>Component</SubType>
53+
</Compile>
54+
<CompileInclude="ColorProgressBarDesigner.cs" />
55+
<CompileInclude="Properties\AssemblyInfo.cs" />
56+
<EmbeddedResourceInclude="Properties\Resources.resx">
57+
<Generator>ResXFileCodeGenerator</Generator>
58+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
59+
<SubType>Designer</SubType>
60+
</EmbeddedResource>
61+
<CompileInclude="Properties\Resources.Designer.cs">
62+
<AutoGen>True</AutoGen>
63+
<DependentUpon>Resources.resx</DependentUpon>
64+
</Compile>
65+
<NoneInclude="Properties\Settings.settings">
66+
<Generator>SettingsSingleFileGenerator</Generator>
67+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
68+
</None>
69+
<CompileInclude="Properties\Settings.Designer.cs">
70+
<AutoGen>True</AutoGen>
71+
<DependentUpon>Settings.settings</DependentUpon>
72+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
73+
</Compile>
74+
</ItemGroup>
75+
<ImportProject="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
76+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
usingSystem.Collections;
2+
3+
namespaceColorProgressBar
4+
{
5+
internalclassColorProgressBarDesigner:System.Windows.Forms.Design.ControlDesigner
6+
{
7+
publicColorProgressBarDesigner()
8+
{}
9+
10+
/// <summary>Clean up some unnecessary properties</summary>
11+
protectedoverridevoidPostFilterProperties(IDictionaryProperties)
12+
{
13+
Properties.Remove("AllowDrop");
14+
Properties.Remove("BackgroundImage");
15+
Properties.Remove("ContextMenu");
16+
Properties.Remove("FlatStyle");
17+
Properties.Remove("Image");
18+
Properties.Remove("ImageAlign");
19+
Properties.Remove("ImageIndex");
20+
Properties.Remove("ImageList");
21+
Properties.Remove("Text");
22+
Properties.Remove("TextAlign");
23+
}
24+
}
25+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
usingSystem.Reflection;
2+
usingSystem.Runtime.CompilerServices;
3+
usingSystem.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly:AssemblyTitle("ColorProgressBar")]
9+
[assembly:AssemblyDescription("")]
10+
[assembly:AssemblyConfiguration("")]
11+
[assembly:AssemblyCompany("utPLSQL.org")]
12+
[assembly:AssemblyProduct("ColorProgressBar")]
13+
[assembly:AssemblyCopyright("Copyright © 2021")]
14+
[assembly:AssemblyTrademark("")]
15+
[assembly:AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly:ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly:Guid("739e6f07-e688-4d16-8fdf-7472e7f0fea0")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly:AssemblyVersion("1.0.0.0")]
36+
[assembly:AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp