| @@ -0,0 +1,17 @@ | |||
| # Auto detect text files and perform LF normalization | |||
| * text=auto | |||
| # Custom for Visual Studio | |||
| *.cs diff=csharp | |||
| # Standard to msysgit | |||
| *.doc diff=astextplain | |||
| *.DOC diff=astextplain | |||
| *.docx diff=astextplain | |||
| *.DOCX diff=astextplain | |||
| *.dot diff=astextplain | |||
| *.DOT diff=astextplain | |||
| *.pdf diff=astextplain | |||
| *.PDF diff=astextplain | |||
| *.rtf diff=astextplain | |||
| *.RTF diff=astextplain | |||
| @@ -0,0 +1,61 @@ | |||
| # Visual Studio 2015/2017 cache/options directory | |||
| .vs/ | |||
| # Visual Studio files | |||
| *.suo | |||
| *.user | |||
| *.pdb | |||
| _ReSharper.* | |||
| obj/ | |||
| Debug/ | |||
| Release/ | |||
| packages | |||
| # Windows image file caches | |||
| Thumbs.db | |||
| ehthumbs.db | |||
| # Folder config file | |||
| Desktop.ini | |||
| # Recycle Bin used on file shares | |||
| $RECYCLE.BIN/ | |||
| # Windows Installer files | |||
| *.cab | |||
| *.msi | |||
| *.msm | |||
| *.msp | |||
| # Windows shortcuts | |||
| *.lnk | |||
| # ========================= | |||
| # Operating System Files | |||
| # ========================= | |||
| # OSX | |||
| # ========================= | |||
| .DS_Store | |||
| .AppleDouble | |||
| .LSOverride | |||
| # Thumbnails | |||
| ._* | |||
| # Files that might appear in the root of a volume | |||
| .DocumentRevisions-V100 | |||
| .fseventsd | |||
| .Spotlight-V100 | |||
| .TemporaryItems | |||
| .Trashes | |||
| .VolumeIcon.icns | |||
| # Directories potentially created on remote AFP share | |||
| .AppleDB | |||
| .AppleDesktop | |||
| Network Trash Folder | |||
| Temporary Items | |||
| .apdisk | |||
| @@ -0,0 +1,58 @@ | |||
| using System.Reflection; | |||
| using System.Runtime.CompilerServices; | |||
| // | |||
| // General Information about an assembly is controlled through the following | |||
| // set of attributes. Change these attribute values to modify the information | |||
| // associated with an assembly. | |||
| // | |||
| [assembly: AssemblyTitle("Knob Control")] | |||
| [assembly: AssemblyDescription("Knob Control")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("")] | |||
| [assembly: AssemblyProduct("")] | |||
| [assembly: AssemblyCopyright("Fabrice Lacharme 2018")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // | |||
| // Version information for an assembly consists of the following four values: | |||
| // | |||
| // Major Version | |||
| // Minor Version | |||
| // Build Number | |||
| // Revision | |||
| // | |||
| // You can specify all the values or you can default the Revision and Build Numbers | |||
| // by using the '*' as shown below: | |||
| [assembly: AssemblyVersion("1.0.*")] | |||
| // | |||
| // In order to sign your assembly you must specify a key to use. Refer to the | |||
| // Microsoft .NET Framework documentation for more information on assembly signing. | |||
| // | |||
| // Use the attributes below to control which key is used for signing. | |||
| // | |||
| // Notes: | |||
| // (*) If no key is specified, the assembly is not signed. | |||
| // (*) KeyName refers to a key that has been installed in the Crypto Service | |||
| // Provider (CSP) on your machine. KeyFile refers to a file which contains | |||
| // a key. | |||
| // (*) If the KeyFile and the KeyName values are both specified, the | |||
| // following processing occurs: | |||
| // (1) If the KeyName can be found in the CSP, that key is used. | |||
| // (2) If the KeyName does not exist and the KeyFile does exist, the key | |||
| // in the KeyFile is installed into the CSP and used. | |||
| // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. | |||
| // When specifying the KeyFile, the location of the KeyFile should be | |||
| // relative to the project output directory which is | |||
| // %Project Directory%\obj\<configuration>. For example, if your KeyFile is | |||
| // located in the project directory, you would specify the AssemblyKeyFile | |||
| // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] | |||
| // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework | |||
| // documentation for more information on this. | |||
| // | |||
| [assembly: AssemblyDelaySign(false)] | |||
| [assembly: AssemblyKeyFile("")] | |||
| [assembly: AssemblyKeyName("")] | |||
| @@ -0,0 +1,104 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> | |||
| <PropertyGroup> | |||
| <ProjectType>Local</ProjectType> | |||
| <ProductVersion>7.0.9466</ProductVersion> | |||
| <SchemaVersion>1.0</SchemaVersion> | |||
| <ProjectGuid>{04123F59-331D-4582-BE0D-721FEAB6050F}</ProjectGuid> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ApplicationIcon>App.ico</ApplicationIcon> | |||
| <AssemblyKeyContainerName /> | |||
| <AssemblyName>KnobControl</AssemblyName> | |||
| <AssemblyOriginatorKeyFile /> | |||
| <DefaultClientScript>JScript</DefaultClientScript> | |||
| <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | |||
| <DefaultTargetSchema>IE50</DefaultTargetSchema> | |||
| <DelaySign>false</DelaySign> | |||
| <OutputType>Library</OutputType> | |||
| <RootNamespace>VolumeControl</RootNamespace> | |||
| <StartupObject /> | |||
| <FileUpgradeFlags> | |||
| </FileUpgradeFlags> | |||
| <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | |||
| <UpgradeBackupLocation> | |||
| </UpgradeBackupLocation> | |||
| <OldToolsVersion>0.0</OldToolsVersion> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <AllowUnsafeBlocks>false</AllowUnsafeBlocks> | |||
| <BaseAddress>285212672</BaseAddress> | |||
| <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> | |||
| <ConfigurationOverrideFile /> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <DocumentationFile /> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <FileAlignment>4096</FileAlignment> | |||
| <Optimize>false</Optimize> | |||
| <RegisterForComInterop>false</RegisterForComInterop> | |||
| <RemoveIntegerChecks>false</RemoveIntegerChecks> | |||
| <TreatWarningsAsErrors>false</TreatWarningsAsErrors> | |||
| <WarningLevel>4</WarningLevel> | |||
| <DebugType>full</DebugType> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <AllowUnsafeBlocks>false</AllowUnsafeBlocks> | |||
| <BaseAddress>285212672</BaseAddress> | |||
| <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> | |||
| <ConfigurationOverrideFile /> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <DocumentationFile /> | |||
| <DebugSymbols>false</DebugSymbols> | |||
| <FileAlignment>4096</FileAlignment> | |||
| <Optimize>true</Optimize> | |||
| <RegisterForComInterop>false</RegisterForComInterop> | |||
| <RemoveIntegerChecks>false</RemoveIntegerChecks> | |||
| <TreatWarningsAsErrors>false</TreatWarningsAsErrors> | |||
| <WarningLevel>4</WarningLevel> | |||
| <DebugType>none</DebugType> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="System"> | |||
| <Name>System</Name> | |||
| </Reference> | |||
| <Reference Include="System.Data"> | |||
| <Name>System.Data</Name> | |||
| </Reference> | |||
| <Reference Include="System.Drawing"> | |||
| <Name>System.Drawing</Name> | |||
| </Reference> | |||
| <Reference Include="System.Windows.Forms"> | |||
| <Name>System.Windows.Forms</Name> | |||
| </Reference> | |||
| <Reference Include="System.Xml"> | |||
| <Name>System.XML</Name> | |||
| </Reference> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="AssemblyInfo.cs"> | |||
| <SubType>Code</SubType> | |||
| </Compile> | |||
| <Compile Include="KnobControl.cs"> | |||
| <SubType>UserControl</SubType> | |||
| </Compile> | |||
| <Compile Include="Utility.cs"> | |||
| <SubType>Code</SubType> | |||
| </Compile> | |||
| <Content Include="App.ico" /> | |||
| <EmbeddedResource Include="KnobControl.resx"> | |||
| <DependentUpon>KnobControl.cs</DependentUpon> | |||
| </EmbeddedResource> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <PropertyGroup> | |||
| <PreBuildEvent /> | |||
| <PostBuildEvent /> | |||
| </PropertyGroup> | |||
| </Project> | |||
| @@ -0,0 +1,102 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 1.3 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">1.3</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1">this is my long string</data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| [base64 mime encoded serialized .NET Framework object] | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| [base64 mime encoded string representing a byte array form of the .NET Framework object] | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>1.3</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <data name="$this.Name"> | |||
| <value>KnobControl</value> | |||
| </data> | |||
| </root> | |||
| @@ -0,0 +1,30 @@ | |||
| Microsoft Visual Studio Solution File, Format Version 12.00 | |||
| # Visual Studio Version 16 | |||
| VisualStudioVersion = 16.0.34407.143 | |||
| MinimumVisualStudioVersion = 10.0.40219.1 | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KnobControl", "KnobControl.csproj", "{04123F59-331D-4582-BE0D-721FEAB6050F}" | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FSRemotePowerSwitch", "..\FSRemotePowerSwitch\FSRemotePowerSwitch.csproj", "{6E722770-D2DB-40AA-BCF4-0443519CCC0C}" | |||
| EndProject | |||
| Global | |||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
| Debug|Any CPU = Debug|Any CPU | |||
| Release|Any CPU = Release|Any CPU | |||
| EndGlobalSection | |||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Release|Any CPU.Build.0 = Release|Any CPU | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Release|Any CPU.Build.0 = Release|Any CPU | |||
| EndGlobalSection | |||
| GlobalSection(SolutionProperties) = preSolution | |||
| HideSolutionNode = FALSE | |||
| EndGlobalSection | |||
| GlobalSection(ExtensibilityGlobals) = postSolution | |||
| SolutionGuid = {E74D20E2-FBDA-4EAA-BAA3-9812E385D238} | |||
| EndGlobalSection | |||
| EndGlobal | |||
| @@ -0,0 +1,21 @@ | |||
| MIT License | |||
| Copyright (c) 2019 Fabrice Lacharme | |||
| Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| of this software and associated documentation files (the "Software"), to deal | |||
| in the Software without restriction, including without limitation the rights | |||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
| copies of the Software, and to permit persons to whom the Software is | |||
| furnished to do so, subject to the following conditions: | |||
| The above copyright notice and this permission notice shall be included in all | |||
| copies or substantial portions of the Software. | |||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
| SOFTWARE. | |||
| @@ -0,0 +1,124 @@ | |||
| #region License | |||
| /* Copyright (c) 2017 Fabrice Lacharme | |||
| * This code was originally written by Jigar Desai | |||
| * http://www.c-sharpcorner.com/article/knob-control-using-windows-forms-and-gdi/ | |||
| * Note that another implementation exists in vb.net by Blong | |||
| * https://www.codeproject.com/Articles/2563/VB-NET-Knob-Control-using-Windows-Forms-and-GDI?msg=1884770#xx1884770xx | |||
| * | |||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| * of this software and associated documentation files (the "Software"), to | |||
| * deal in the Software without restriction, including without limitation the | |||
| * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |||
| * sell copies of the Software, and to permit persons to whom the Software is | |||
| * furnished to do so, subject to the following conditions: | |||
| * | |||
| * The above copyright notice and this permission notice shall be included in | |||
| * all copies or substantial portions of the Software. | |||
| * | |||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
| * THE SOFTWARE. | |||
| */ | |||
| #endregion | |||
| #region Contact | |||
| /* | |||
| * Fabrice Lacharme | |||
| * Email: fabrice.lacharme@gmail.com | |||
| */ | |||
| #endregion | |||
| using System; | |||
| using System.Drawing; | |||
| namespace KnobControl { | |||
| /// <summary> | |||
| /// Summary description for Utility. | |||
| /// </summary> | |||
| public class Utility { | |||
| public static float GetRadian(float val) { | |||
| return (float)(val * Math.PI / 180); | |||
| } | |||
| public static Color GetDarkColor(Color c, byte d) { | |||
| byte r = 0; | |||
| byte g = 0; | |||
| byte b = 0; | |||
| if (c.R > d) r = (byte)(c.R - d); | |||
| if (c.G > d) g = (byte)(c.G - d); | |||
| if (c.B > d) b = (byte)(c.B - d); | |||
| Color c1 = Color.FromArgb(r, g, b); | |||
| return c1; | |||
| } | |||
| public static Color GetLightColor(Color c, byte d) { | |||
| byte r = 255; | |||
| byte g = 255; | |||
| byte b = 255; | |||
| if (c.R + d < 255) r = (byte)(c.R + d); | |||
| if (c.G + d < 255) g = (byte)(c.G + d); | |||
| if (c.B + d < 255) b = (byte)(c.B + d); | |||
| Color c2 = Color.FromArgb(r, g, b); | |||
| return c2; | |||
| } | |||
| /// <summary> | |||
| /// Method which checks is particular point is in rectangle | |||
| /// </summary> | |||
| /// <param name="p">Point to be Chaecked</param> | |||
| /// <param name="r">Rectangle</param> | |||
| /// <returns>true is Point is in rectangle, else false</returns> | |||
| public static bool IsPointinRectangle(Point p, Rectangle r) { | |||
| bool flag = false; | |||
| if (p.X > r.X && p.X < r.X + r.Width && p.Y > r.Y && p.Y < r.Y + r.Height) { | |||
| flag = true; | |||
| } | |||
| return flag; | |||
| } | |||
| public static bool IsPointInCircle(Point p, Point center, double diameter) { | |||
| bool flag = false; | |||
| double distToCenter = Math.Sqrt(Math.Pow(p.X - center.X, 2) + Math.Pow(p.Y - center.Y, 2)); | |||
| if (distToCenter <= diameter / 2) { | |||
| flag = true; | |||
| } | |||
| return flag; | |||
| } | |||
| public static void DrawInsetCircle(ref Graphics g, Rectangle r, Pen p) { | |||
| Pen p1 = new Pen(GetDarkColor(p.Color, 50)); | |||
| Pen p2 = new Pen(GetLightColor(p.Color, 50)); | |||
| for (int i = 0; i < p.Width; i++) { | |||
| Rectangle r1 = new Rectangle(r.X + i, r.Y + i, r.Width - i * 2, r.Height - i * 2); | |||
| g.DrawArc(p2, r1, -45, 180); | |||
| g.DrawArc(p1, r1, 135, 180); | |||
| } | |||
| } | |||
| public static Rectangle shrinkRectangle(Rectangle r, int shrinkWidth) { | |||
| int x = r.X + shrinkWidth / 2; | |||
| int y = r.Y + shrinkWidth / 2; | |||
| int w = r.Width - shrinkWidth; | |||
| int h = r.Height - shrinkWidth; | |||
| return new Rectangle(x, y, w, h); | |||
| } | |||
| } | |||
| } | |||