Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

フロートメニューを実装 #3

Merged
merged 2 commits into from Dec 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions Drawing.sln
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drawing", "Drawing\Drawing.csproj", "{D4137B08-D784-4D52-82C3-519A622C5DC2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4137B08-D784-4D52-82C3-519A622C5DC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4137B08-D784-4D52-82C3-519A622C5DC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4137B08-D784-4D52-82C3-519A622C5DC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4137B08-D784-4D52-82C3-519A622C5DC2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions Drawing/App.config
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
64 changes: 64 additions & 0 deletions Drawing/Drawing.cs
@@ -0,0 +1,64 @@
using System.Drawing;
using System.Windows.Forms;

namespace Drawing
{
public partial class DrawingFm
{
public static int currentMode;
public static int currentShape;
public static Color currentColor;

public class Mode
{
public static int DRAW = 0;
public static int ERASE = 1;
}

public void DrawingFm_MouseDown(object sender, MouseEventArgs e)
{
Shape sh = null;
if (currentShape == Shape.RECT)
{
sh = new Rect();
}
else if (currentShape == Shape.OVAL)
{
sh = new Oval();
}
else if (currentShape == Shape.LINE)
{
sh = new Line();
}
// 図形オブジェクトの色を設定
sh.SetColor(currentColor);
// 図形オブジェクトの座標を設定
sh.SetStartPoint(e.X, e.Y);
sh.SetEndPoint(e.X, e.Y);
// 図形オブジェクトをリストに追加
shapeList.Add(sh);
// 再描画
this.Invalidate();
}

private void DrawingFm_MouseUp(object sender, MouseEventArgs e)
{
// 図形オブジェクトをリストから取り出す
Shape sh =
(Shape)(shapeList[shapeList.Count - 1] as Shape);
sh.SetEndPoint(e.X, e.Y);
// 再描画
this.Invalidate();
}

private void DrawingFm_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;

foreach (Shape sh in shapeList)
{
sh.Draw(g);
}
}
}
}
111 changes: 111 additions & 0 deletions Drawing/Drawing.csproj
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{D4137B08-D784-4D52-82C3-519A622C5DC2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Drawing</RootNamespace>
<AssemblyName>Drawing</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</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>
<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="Drawing.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DrawingFm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DrawingFm.Designer.cs">
<DependentUpon>DrawingFm.cs</DependentUpon>
</Compile>
<Compile Include="IO.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MenuFm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MenuFm.Designer.cs">
<DependentUpon>MenuFm.cs</DependentUpon>
</Compile>
<Compile Include="Printing.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Super.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="DrawingFm.resx">
<DependentUpon>DrawingFm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MenuFm.resx">
<DependentUpon>MenuFm.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>
</Compile>
<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>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>