Commit 8af4571e SK

添加项目文件。

1 个父辈 e51d2214
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.3.2.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.3.2.0\build\Costura.Fody.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2F0D362D-2A49-49C4-963D-99F958A616D7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Acc.Demo</RootNamespace>
<AssemblyName>Demo</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Acc.Demo.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>disc_64px.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\AccImage\AccImage.csproj">
<Project>{2626350b-63da-416c-b72a-7fe7825c3711}</Project>
<Name>AccImage</Name>
</ProjectReference>
<ProjectReference Include="..\ImageBox\ImageBox.csproj">
<Project>{db03ed04-5e06-4feb-b891-0633448f24ec}</Project>
<Name>ImageBox</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="disc_64px.ico" />
<Content Include="FodyWeavers.xml">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Costura.Fody.3.2.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.3.2.0\build\Costura.Fody.props'))" />
<Error Condition="!Exists('..\packages\Fody.3.3.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.3.2\build\Fody.targets'))" />
</Target>
<Import Project="..\packages\Fody.3.3.2\build\Fody.targets" Condition="Exists('..\packages\Fody.3.3.2\build\Fody.targets')" />
</Project>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura>
<ExcludeAssemblies></ExcludeAssemblies>
</Costura>
</Weavers>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuild. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification on the target assembly after all weavers have been finished.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file \ No newline at end of file

using Acc.Img;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Acc.Demo
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void OpenImage()
{
using (FileDialog dialog = new OpenFileDialog())
{
dialog.Filter = "图片 (*.raw,*.bmp;*.gif;*.jpeg;*.jpg;*.png)|*.raw;*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|RAW (*.raw)|*.raw|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
dialog.DefaultExt = "png";
if (dialog.ShowDialog(this) == DialogResult.OK)
{
try
{
string imagePath = dialog.FileName;
labelImageName.Text = imagePath;
Image image = ImageUtil.ReadImage(imagePath);
orginalImage = image;
imageBox.Image = image;
imageBox.ZoomToFit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
private void buttonOpen_Click(object sender, EventArgs e)
{
ClearStatusBar();
OpenImage();
}
Image orginalImage = null;
private void buttonCount_Click(object sender, EventArgs e)
{
Count();
}
private void buttonThesh_Click(object sender, EventArgs e)
{
int theshValue = -1;
if (!checkBoxAutoThresh.Checked)
{
theshValue = int.Parse(textBoxThesh.Text);
}
Image result = ImageUtil.Threshhold(orginalImage, theshValue);
imageBox.Image = result;
}
private void checkBoxAutoThresh_CheckedChanged(object sender, EventArgs e)
{
textBoxThesh.Enabled = !checkBoxAutoThresh.Checked;
}
private void 原图ToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearStatusBar();
imageBox.Image = orginalImage;
}
private int markX = -1;
private int markY = -1;
private void imageBox_MouseDown(object sender, MouseEventArgs e)
{
base.OnMouseUp(e);
if (e.Button == MouseButtons.Right)
{
bool inImage = imageBox.IsPointInImage(e.Location);
System.Drawing.Point markPoint = imageBox.PointToImage(e.Location);
markX = markPoint.X;
markY = markPoint.Y;
元件特征ToolStripMenuItem.Enabled = inImage;
原图ToolStripMenuItem.Enabled = inImage;
contextMenuStrip.Show(this, e.Location);
}
}
private void Count()
{
ClearStatusBar();
int theshValue = -1;
if (!checkBoxAutoThresh.Checked)
{
theshValue = int.Parse(textBoxThesh.Text);
}
Task.Factory.StartNew(delegate {
//Image image = ImageUtil.FindCircle(orginalImage, theshValue, inv);
//imageBox.Image = image;
Stopwatch sw = new Stopwatch();
sw.Start();
int itemFeature = int.Parse(textBoxFeature.Text);
Image image = orginalImage;
int count = ImageUtil.CountItems(ref image, itemFeature, theshValue);
sw.Stop();
labelTime.Text = "耗时:" + sw.ElapsedMilliseconds + " ms";
labelCount.Text = "数量:" + count;
imageBox.Image = image;
});
}
private void ClearStatusBar()
{
labelFeature.Text = "";
labelCount.Text = "";
labelTime.Text = "";
}
private void 打开图片ToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearStatusBar();
OpenImage();
}
private void 计数ToolStripMenuItem_Click(object sender, EventArgs e)
{
Count();
}
private void 元件特征ToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearStatusBar();
int theshValue = -1;
if (!checkBoxAutoThresh.Checked)
{
theshValue = int.Parse(textBoxThesh.Text);
}
int feature = ImageUtil.GetItemFeature(orginalImage, markX, markY, theshValue);
labelFeature.Text = "特征值:" + feature + "";
textBoxFeature.Text = feature + "";
}
}
}
此文件的差异被折叠, 点击展开。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Acc.Demo
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Control.CheckForIllegalCrossThreadCalls = false;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("锐驰点料Demo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Acc Feeder Counter")]
[assembly: AssemblyCopyright("Copyright Acctronics© 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("2f0d362d-2a49-49c4-963d-99f958a616d7")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Acc.Demo.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Acc.Demo.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
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">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</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="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<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>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Acc.Demo.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
此文件类型无法预览
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="3.2.0" targetFramework="net40" />
<package id="Fody" version="3.3.2" targetFramework="net40" developmentDependency="true" />
</packages>
\ No newline at end of file \ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{2F0D362D-2A49-49C4-963D-99F958A616D7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccImage", "..\AccImage\AccImage.csproj", "{2626350B-63DA-416C-B72A-7FE7825C3711}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageBox", "ImageBox\ImageBox.csproj", "{DB03ED04-5E06-4FEB-B891-0633448F24EC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Debug|x64.ActiveCfg = Debug|Any CPU
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Debug|x64.Build.0 = Debug|Any CPU
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Release|Any CPU.Build.0 = Release|Any CPU
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Release|x64.ActiveCfg = Release|Any CPU
{2F0D362D-2A49-49C4-963D-99F958A616D7}.Release|x64.Build.0 = Release|Any CPU
{2626350B-63DA-416C-B72A-7FE7825C3711}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2626350B-63DA-416C-B72A-7FE7825C3711}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2626350B-63DA-416C-B72A-7FE7825C3711}.Debug|x64.ActiveCfg = Debug|x64
{2626350B-63DA-416C-B72A-7FE7825C3711}.Debug|x64.Build.0 = Debug|x64
{2626350B-63DA-416C-B72A-7FE7825C3711}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2626350B-63DA-416C-B72A-7FE7825C3711}.Release|Any CPU.Build.0 = Release|Any CPU
{2626350B-63DA-416C-B72A-7FE7825C3711}.Release|x64.ActiveCfg = Release|x64
{2626350B-63DA-416C-B72A-7FE7825C3711}.Release|x64.Build.0 = Release|x64
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Debug|x64.ActiveCfg = Debug|Any CPU
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Debug|x64.Build.0 = Debug|Any CPU
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Release|Any CPU.Build.0 = Release|Any CPU
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Release|x64.ActiveCfg = Release|Any CPU
{DB03ED04-5E06-4FEB-B891-0633448F24EC}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AE0B833E-EEE6-4719-952C-7233EA17EC3D}
EndGlobalSection
EndGlobal
此文件类型无法预览
此文件的差异太大,无法显示。
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DB03ED04-5E06-4FEB-B891-0633448F24EC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ImageBox</RootNamespace>
<AssemblyName>ImageBox</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ImageBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ImageBoxActionSources.cs" />
<Compile Include="ImageBoxBorderStyle.cs" />
<Compile Include="ImageBoxCancelEventArgs.cs" />
<Compile Include="ImageBoxGridDisplayMode.cs" />
<Compile Include="ImageBoxGridScale.cs" />
<Compile Include="ImageBoxNativeMethods.cs" />
<Compile Include="ImageBoxSelectionMode.cs" />
<Compile Include="ImageBoxSizeMode.cs" />
<Compile Include="ImageBoxZoomActions.cs" />
<Compile Include="ImageBoxZoomEventArgs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScrollControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ScrollProperties.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="VirtualScrollableControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ZoomLevelCollection.cs" />
<Compile Include="ZoomLevelCollectionConverter.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="ImageBox.bmp" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
using System;
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Specifies the source of an action being performed.
/// </summary>
[Flags]
public enum ImageBoxActionSources
{
/// <summary>
/// Unknown source.
/// </summary>
Unknown = 0,
/// <summary>
/// A user initialized the action.
/// </summary>
User = 1
}
}
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Specifies the border styles of an image
/// </summary>
public enum ImageBoxBorderStyle
{
/// <summary>
/// No border.
/// </summary>
None,
/// <summary>
/// A fixed, single-line border.
/// </summary>
FixedSingle,
/// <summary>
/// A fixed, single-line border with a solid drop shadow.
/// </summary>
FixedSingleDropShadow,
/// <summary>
/// A fixed, single-line border with a soft outer glow.
/// </summary>
FixedSingleGlowShadow
}
}
using System.ComponentModel;
using System.Drawing;
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Provides data for a cancelable event.
/// </summary>
public class ImageBoxCancelEventArgs : CancelEventArgs
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ImageBoxCancelEventArgs"/> class.
/// </summary>
/// <param name="location">The location of the action being performed.</param>
public ImageBoxCancelEventArgs(Point location)
: this()
{
this.Location = location;
}
#endregion
#region Protected Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ImageBoxCancelEventArgs"/> class.
/// </summary>
protected ImageBoxCancelEventArgs()
{ }
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the location of the action being performed.
/// </summary>
/// <value>The location of the action being performed.</value>
public Point Location { get; protected set; }
#endregion
}
}
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Specifies the display styles for the background texture grid
/// </summary>
public enum ImageBoxGridDisplayMode
{
/// <summary>
/// No background.
/// </summary>
None,
/// <summary>
/// Background is displayed in the control's client area.
/// </summary>
Client,
/// <summary>
/// Background is displayed only in the image region.
/// </summary>
Image
}
}
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Specifies the size of the background texture grid.
/// </summary>
public enum ImageBoxGridScale
{
/// <summary>
/// Displays a solid color
/// </summary>
None,
/// <summary>
/// Half of the default size.
/// </summary>
Tiny,
/// <summary>
/// Default size.
/// </summary>
Small,
/// <summary>
/// 50% increase of default size.
/// </summary>
Medium,
/// <summary>
/// 100% increase of default size.
/// </summary>
Large
}
}
using System;
using System.Runtime.InteropServices;
// ReSharper disable NotAccessedField.Global
// ReSharper disable InconsistentNaming
// ReSharper disable FieldCanBeMadeReadOnly.Global
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable PartialTypeWithSinglePart
internal partial class NativeMethods // partial for when linking this file into other assemblies
// ReSharper restore PartialTypeWithSinglePart
// ReSharper restore ClassNeverInstantiated.Global
{
#region Enums
[Flags]
public enum SIF
{
SIF_RANGE = 0x0001,
SIF_PAGE = 0x0002,
SIF_POS = 0x0004,
SIF_DISABLENOSCROLL = 0x0008,
SIF_TRACKPOS = 0x0010,
SIF_ALL = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS
}
#endregion
#region Constants
public const int GWL_STYLE = (-16);
public const int SB_BOTH = 3;
public const int SB_BOTTOM = 7;
public const int SB_CTL = 2;
public const int SB_ENDSCROLL = 8;
public const int SB_HORZ = 0;
public const int SB_LEFT = 6;
public const int SB_LINEDOWN = 1;
public const int SB_LINELEFT = 0;
public const int SB_LINERIGHT = 1;
public const int SB_LINEUP = 0;
public const int SB_PAGEDOWN = 3;
public const int SB_PAGELEFT = 2;
public const int SB_PAGERIGHT = 3;
public const int SB_PAGEUP = 2;
public const int SB_RIGHT = 7;
public const int SB_THUMBPOSITION = 4;
public const int SB_THUMBTRACK = 5;
public const int SB_TOP = 6;
public const int SB_VERT = 1;
public const int WM_HSCROLL = 0x00000114;
public const int WM_VSCROLL = 0x00000115;
public const int WS_BORDER = 0x00800000;
public const int WS_EX_CLIENTEDGE = 0x200;
public const int WS_HSCROLL = 0x00100000;
public const int WS_VSCROLL = 0x00200000;
#endregion
#region Private Constructors
private NativeMethods()
{ }
#endregion
#region Class Members
[DllImport("user32.dll", SetLastError = true)]
public static extern int GetScrollInfo(IntPtr hwnd, int bar, [MarshalAs(UnmanagedType.LPStruct)] SCROLLINFO scrollInfo);
[DllImport("user32.dll", SetLastError = true)]
public static extern uint GetWindowLong(IntPtr hwnd, int index);
[DllImport("user32.dll")]
public static extern int SetScrollInfo(IntPtr hwnd, int bar, [MarshalAs(UnmanagedType.LPStruct)] SCROLLINFO scrollInfo, bool redraw);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hwnd, int index, UInt32 newLong);
#endregion
#region Nested Types
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public class SCROLLINFO
{
public int cbSize;
public SIF fMask;
public int nMin;
public int nMax;
public int nPage;
public int nPos;
public int nTrackPos;
public SCROLLINFO()
{
cbSize = Marshal.SizeOf(this);
nPage = 0;
nMin = 0;
nMax = 0;
nPos = 0;
nTrackPos = 0;
fMask = 0;
}
}
#endregion
}
// ReSharper restore NotAccessedField.Global
// ReSharper restore FieldCanBeMadeReadOnly.Global
// ReSharper restore InconsistentNaming
}
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Specifies the selection mode.
/// </summary>
public enum ImageBoxSelectionMode
{
/// <summary>
/// No selection.
/// </summary>
None,
/// <summary>
/// Rectangle selection.
/// </summary>
Rectangle,
/// <summary>
/// Zoom selection.
/// </summary>
Zoom
}
}
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Determines the sizing mode of an image hosted in an <see cref="ImageBox" /> control.
/// </summary>
public enum ImageBoxSizeMode
{
/// <summary>
/// The image is disiplayed according to current zoom and scroll properties.
/// </summary>
Normal,
/// <summary>
/// The image is stretched to fill the client area of the control.
/// </summary>
Stretch,
/// <summary>
/// The image is stretched to fill as much of the client area of the control as possible, whilst retaining the same aspect ratio for the width and height.
/// </summary>
Fit
}
}
using System;
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Describes the zoom action occuring
/// </summary>
[Flags]
public enum ImageBoxZoomActions
{
/// <summary>
/// No action.
/// </summary>
None = 0,
/// <summary>
/// The control is increasing the zoom.
/// </summary>
ZoomIn = 1,
/// <summary>
/// The control is decreasing the zoom.
/// </summary>
ZoomOut = 2,
/// <summary>
/// The control zoom was reset.
/// </summary>
ActualSize = 4
}
}
using System;
namespace Cyotek.Windows.Forms
{
// Cyotek ImageBox
// Copyright (c) 2010-2014 Cyotek.
// http://cyotek.com
// http://cyotek.com/blog/tag/imagebox
// Licensed under the MIT License. See imagebox-license.txt for the full text.
// If you use this control in your applications, attribution, donations or contributions are welcome.
/// <summary>
/// Contains event data for the <see cref="ImageBox.ZoomChanged"/> event.
/// </summary>
public class ImageBoxZoomEventArgs : EventArgs
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ImageBoxZoomEventArgs"/> class.
/// </summary>
/// <param name="actions">The zoom operation being performed.</param>
/// <param name="source">The source of the operation.</param>
/// <param name="oldZoom">The old zoom level.</param>
/// <param name="newZoom">The new zoom level.</param>
public ImageBoxZoomEventArgs(ImageBoxZoomActions actions, ImageBoxActionSources source, int oldZoom, int newZoom)
: this()
{
this.Actions = actions;
this.Source = source;
this.OldZoom = oldZoom;
this.NewZoom = newZoom;
}
#endregion
#region Protected Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ImageBoxZoomEventArgs"/> class.
/// </summary>
protected ImageBoxZoomEventArgs()
{ }
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the actions that occured.
/// </summary>
/// <value>The zoom operation.</value>
public ImageBoxZoomActions Actions { get; protected set; }
/// <summary>
/// Gets or sets the new zoom level.
/// </summary>
/// <value>The new zoom level.</value>
public int NewZoom { get; protected set; }
/// <summary>
/// Gets or sets the old zoom level.
/// </summary>
/// <value>The old zoom level.</value>
public int OldZoom { get; protected set; }
/// <summary>
/// Gets or sets the source of the operation..
/// </summary>
/// <value>The source.</value>
public ImageBoxActionSources Source { get; protected set; }
#endregion
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ImageBox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImageBox")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("db03ed04-5e06-4feb-b891-0633448f24ec")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.ComponentModel;
// Original ScrollControl code by Scott Crawford (http://sukiware.com/)
namespace Cyotek.Windows.Forms
{
partial class ScrollControl
{
#region Nested Types
/// <summary>
/// Provides basic properties for the horizontal scroll bar in a <see cref="ScrollControl"/>.
/// </summary>
public class HScrollProperties : ScrollProperties
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ScrollProperties" /> class.
/// </summary>
/// <param name="container">The <see cref="ScrollControl" /> whose scrolling properties this object describes.</param>
public HScrollProperties(ScrollControl container)
: base(container)
{ }
#endregion
}
/// <summary>
/// Encapsulates properties related to scrolling.
/// </summary>
public abstract class ScrollProperties
{
#region Instance Fields
private readonly ScrollControl _container;
#endregion
#region Protected Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ScrollProperties"/> class.
/// </summary>
/// <param name="container">The <see cref="ScrollControl"/> whose scrolling properties this object describes.</param>
protected ScrollProperties(ScrollControl container)
{
//System.Windows.Forms.ScrollProperties
_container = container;
}
#endregion
#region Public Properties
/// <summary>
/// Gets or sets whether the scroll bar can be used on the container.
/// </summary>
/// <value><c>true</c> if the scroll bar can be used; otherwise, <c>false</c>.</value>
[DefaultValue(true)]
public bool Enabled { get; set; }
/// <summary>
/// Gets or sets the distance to move a scroll bar in response to a large scroll command.
/// </summary>
/// <value>An <see cref="int"/> describing how far, in pixels, to move the scroll bar in response to a large change.</value>
[DefaultValue(10)]
public int LargeChange { get; set; }
/// <summary>
/// Gets or sets the upper limit of the scrollable range.
/// </summary>
/// <value>An <see cref="int"/> representing the maximum range of the scroll bar.</value>
[DefaultValue(100)]
public int Maximum { get; set; }
/// <summary>
/// Gets or sets the lower limit of the scrollable range.
/// </summary>
/// <value>An <see cref="int"/> representing the lower range of the scroll bar.</value>
[DefaultValue(0)]
public int Minimum { get; set; }
/// <summary>
/// Gets the control to which this scroll information applies.
/// </summary>
/// <value>A <see cref="ScrollControl"/>.</value>
public ScrollControl ParentControl
{
get { return _container; }
}
/// <summary>
/// Gets or sets the distance to move a scroll bar in response to a small scroll command.
/// </summary>
/// <value>An <see cref="int"/> representing how far, in pixels, to move the scroll bar.</value>
[DefaultValue(1)]
public int SmallChange { get; set; }
/// <summary>
/// Gets or sets a numeric value that represents the current position of the scroll bar box.
/// </summary>
/// <value>An <see cref="int"/> representing the position of the scroll bar box, in pixels. </value>
[Bindable(true)]
[DefaultValue(0)]
public int Value { get; set; }
/// <summary>
/// Gets or sets whether the scroll bar can be seen by the user.
/// </summary>
/// <value><c>true</c> if it can be seen; otherwise, <c>false</c>.</value>
[DefaultValue(false)]
public bool Visible { get; set; }
#endregion
}
/// <summary>
/// Provides basic properties for the vertical scroll bar in a <see cref="ScrollControl"/>.
/// </summary>
public class VScrollProperties : ScrollProperties
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ScrollProperties" /> class.
/// </summary>
/// <param name="container">The <see cref="ScrollControl" /> whose scrolling properties this object describes.</param>
public VScrollProperties(ScrollControl container)
: base(container)
{ }
#endregion
}
#endregion
}
}
using System;
using System.Collections;
using System.Collections.Generic;
namespace Cyotek.Windows.Forms
{
/// <summary>
/// Represents available levels of zoom in an <see cref="ImageBox"/> control
/// </summary>
public class ZoomLevelCollection : IList<int>
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ZoomLevelCollection"/> class.
/// </summary>
public ZoomLevelCollection()
{
this.List = new SortedList<int, int>();
}
/// <summary>
/// Initializes a new instance of the <see cref="ZoomLevelCollection"/> class.
/// </summary>
/// <param name="collection">The default values to populate the collection with.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <c>collection</c> parameter is null</exception>
public ZoomLevelCollection(IEnumerable<int> collection)
: this()
{
if (collection == null)
{
throw new ArgumentNullException("collection");
}
this.AddRange(collection);
}
#endregion
#region Class Properties
/// <summary>
/// Returns the default zoom levels
/// </summary>
public static ZoomLevelCollection Default
{
get
{
return new ZoomLevelCollection(new[]
{
7, 10, 15, 20, 25, 30, 50, 70, 100, 150, 200, 300, 400, 500, 600, 700, 800, 1200, 1600
});
}
}
#endregion
#region Public Properties
/// <summary>
/// Gets the number of elements contained in the <see cref="ZoomLevelCollection" />.
/// </summary>
/// <returns>
/// The number of elements contained in the <see cref="ZoomLevelCollection" />.
/// </returns>
public int Count
{
get { return this.List.Count; }
}
/// <summary>
/// Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only.
/// </summary>
/// <value><c>true</c> if this instance is read only; otherwise, <c>false</c>.</value>
/// <returns>true if the <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only; otherwise, false.
/// </returns>
public bool IsReadOnly
{
get { return false; }
}
/// <summary>
/// Gets or sets the zoom level at the specified index.
/// </summary>
/// <param name="index">The index.</param>
public int this[int index]
{
get { return this.List.Values[index]; }
set
{
this.List.RemoveAt(index);
this.Add(value);
}
}
#endregion
#region Protected Properties
/// <summary>
/// Gets or sets the backing list.
/// </summary>
protected SortedList<int, int> List { get; set; }
#endregion
#region Public Members
/// <summary>
/// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1" />.
/// </summary>
/// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1" />.</param>
public void Add(int item)
{
this.List.Add(item, item);
}
/// <summary>
/// Adds a range of items to the <see cref="ZoomLevelCollection"/>.
/// </summary>
/// <param name="collection">The items to add to the collection.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <c>collection</c> parameter is null.</exception>
public void AddRange(IEnumerable<int> collection)
{
if (collection == null)
{
throw new ArgumentNullException("collection");
}
foreach (int value in collection)
{
this.Add(value);
}
}
/// <summary>
/// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1" />.
/// </summary>
public void Clear()
{
this.List.Clear();
}
/// <summary>
/// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1" /> contains a specific value.
/// </summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1" />.</param>
/// <returns>true if <paramref name="item" /> is found in the <see cref="T:System.Collections.Generic.ICollection`1" />; otherwise, false.</returns>
public bool Contains(int item)
{
return this.List.ContainsKey(item);
}
/// <summary>
/// Copies a range of elements this collection into a destination <see cref="Array"/>.
/// </summary>
/// <param name="array">The <see cref="Array"/> that receives the data.</param>
/// <param name="arrayIndex">A 64-bit integer that represents the index in the <see cref="Array"/> at which storing begins.</param>
public void CopyTo(int[] array, int arrayIndex)
{
for (int i = 0; i < this.Count; i++)
{
array[arrayIndex + i] = this.List.Values[i];
}
}
/// <summary>
/// Finds the index of a zoom level matching or nearest to the specified value.
/// </summary>
/// <param name="zoomLevel">The zoom level.</param>
public int FindNearest(int zoomLevel)
{
int nearestValue = this.List.Values[0];
int nearestDifference = Math.Abs(nearestValue - zoomLevel);
for (int i = 1; i < this.Count; i++)
{
int value = this.List.Values[i];
int difference = Math.Abs(value - zoomLevel);
if (difference < nearestDifference)
{
nearestValue = value;
nearestDifference = difference;
}
}
return nearestValue;
}
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>A <see cref="T:System.Collections.Generic.IEnumerator`1" /> that can be used to iterate through the collection.</returns>
public IEnumerator<int> GetEnumerator()
{
return this.List.Values.GetEnumerator();
}
/// <summary>
/// Determines the index of a specific item in the <see cref="T:System.Collections.Generic.IList`1" />.
/// </summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.IList`1" />.</param>
/// <returns>The index of <paramref name="item" /> if found in the list; otherwise, -1.</returns>
public int IndexOf(int item)
{
return this.List.IndexOfKey(item);
}
/// <summary>
/// Not implemented.
/// </summary>
/// <param name="index">The index.</param>
/// <param name="item">The item.</param>
/// <exception cref="System.NotImplementedException">Not implemented</exception>
public void Insert(int index, int item)
{
throw new NotImplementedException();
}
/// <summary>
/// Returns the next increased zoom level for the given current zoom.
/// </summary>
/// <param name="zoomLevel">The current zoom level.</param>
/// <returns>The next matching increased zoom level for the given current zoom if applicable, otherwise the nearest zoom.</returns>
public int NextZoom(int zoomLevel)
{
int index;
index = this.IndexOf(this.FindNearest(zoomLevel));
if (index < this.Count - 1)
{
index++;
}
return this[index];
}
/// <summary>
/// Returns the next decreased zoom level for the given current zoom.
/// </summary>
/// <param name="zoomLevel">The current zoom level.</param>
/// <returns>The next matching decreased zoom level for the given current zoom if applicable, otherwise the nearest zoom.</returns>
public int PreviousZoom(int zoomLevel)
{
int index;
index = this.IndexOf(this.FindNearest(zoomLevel));
if (index > 0)
{
index--;
}
return this[index];
}
/// <summary>
/// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1" />.
/// </summary>
/// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1" />.</param>
/// <returns>true if <paramref name="item" /> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1" />; otherwise, false. This method also returns false if <paramref name="item" /> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1" />.</returns>
public bool Remove(int item)
{
return this.List.Remove(item);
}
/// <summary>
/// Removes the element at the specified index of the <see cref="ZoomLevelCollection"/>.
/// </summary>
/// <param name="index">The zero-based index of the element to remove.</param>
public void RemoveAt(int index)
{
this.List.RemoveAt(index);
}
/// <summary>
/// Copies the elements of the <see cref="ZoomLevelCollection"/> to a new array.
/// </summary>
/// <returns>An array containing copies of the elements of the <see cref="ZoomLevelCollection"/>.</returns>
public int[] ToArray()
{
int[] results;
results = new int[this.Count];
this.CopyTo(results, 0);
return results;
}
#endregion
#region IList<int> Members
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>An <see cref="ZoomLevelCollection" /> object that can be used to iterate through the collection.</returns>
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
#endregion
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
namespace Cyotek.Windows.Forms
{
public class ZoomLevelCollectionConverter
: TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(InstanceDescriptor) || base.CanConvertTo(context, destinationType);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
string data;
ZoomLevelCollection result;
data = value as string;
if (!string.IsNullOrEmpty(data))
{
char separator;
string[] items;
TypeConverter converter;
if (culture == null)
culture = CultureInfo.CurrentCulture;
result = new ZoomLevelCollection();
separator = culture.TextInfo.ListSeparator[0];
items = data.Split(separator);
converter = TypeDescriptor.GetConverter(typeof(int));
foreach (string item in items)
result.Add((int)converter.ConvertFromString(context, culture, item));
}
else
result = null;
return result;
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
object result;
if (destinationType == null)
throw new ArgumentNullException("destinationType");
if (value is ZoomLevelCollection)
{
if (destinationType == typeof(string))
{
ZoomLevelCollection collection;
StringBuilder data;
string separator;
TypeConverter converter;
collection = (ZoomLevelCollection)value;
if (culture == null)
culture = CultureInfo.CurrentCulture;
separator = culture.TextInfo.ListSeparator + " ";
converter = TypeDescriptor.GetConverter(typeof(int));
data = new StringBuilder();
foreach (int item in collection)
{
if (data.Length != 0)
data.Append(separator);
data.Append(converter.ConvertToString(context, culture, item));
}
result = data.ToString();
}
else if (destinationType == typeof(InstanceDescriptor))
{
ZoomLevelCollection collection;
ConstructorInfo constructor;
collection = (ZoomLevelCollection)value;
constructor = typeof(ZoomLevelCollection).GetConstructor(new Type[] { typeof(IList<int>) });
result = new InstanceDescriptor(constructor, new object[] { collection.ToArray() });
}
else
result = null;
}
else
result = null;
if (result == null)
result = base.ConvertTo(context, culture, value, destinationType);
return result;
}
}
}
此文件太大,无法显示。
此文件太大,无法显示。
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<dllmap dll="OpenCvSharpExtern" target="libOpenCvSharpExtern.so" />
</configuration>
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!