Skip to content

Commit 89e92ad

Browse files
committed
PaintTool
1 parent 8fe70c4 commit 89e92ad

34 files changed

+985
-0
lines changed

App.config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
5+
</startup>
6+
</configuration>

Form1.Designer.cs

+320
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form1.cs

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Windows.Forms;
10+
11+
namespace Paint
12+
{
13+
public partial class Form1 : Form
14+
{
15+
// Variables
16+
Graphics draw;
17+
int pen_x = -1, pen_y = -1;
18+
bool pen_moving = false;
19+
Pen my_pen;
20+
bool my_dots = true;
21+
22+
public Form1()
23+
{
24+
InitializeComponent();
25+
draw = flowLayoutPanel1.CreateGraphics();
26+
draw.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
27+
my_pen = new Pen(Color.Black, 3);
28+
pictureBox6.BackColor = Color.Black;
29+
my_pen.StartCap = my_pen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
30+
label4.Text = my_pen.Width.ToString();
31+
my_dots = true;
32+
Dots_check.Text = "Dots";
33+
}
34+
35+
private void flowLayoutPanel1_Paint(object sender, PaintEventArgs e)
36+
{
37+
38+
}
39+
40+
private void pictureBox1_Click(object sender, EventArgs e)
41+
{
42+
PictureBox my_picture = (PictureBox)sender;
43+
my_pen.Color = my_picture.BackColor;
44+
pictureBox6.BackColor = my_picture.BackColor;
45+
}
46+
47+
private void flowLayoutPanel1_MouseDown(object sender, MouseEventArgs e)
48+
{
49+
pen_moving = true;
50+
pen_x = e.X;
51+
pen_y = e.Y;
52+
}
53+
54+
private void flowLayoutPanel1_MouseMove(object sender, MouseEventArgs e)
55+
{
56+
if (pen_moving && pen_x != -1 && pen_y != -1)
57+
{
58+
if (my_dots)
59+
{
60+
draw.DrawLine(my_pen, new Point(pen_x, pen_y), e.Location);
61+
pen_x = e.X;
62+
pen_y = e.Y;
63+
}
64+
else
65+
{
66+
draw.DrawLine(my_pen, new Point(pen_x, pen_y), e.Location);
67+
}
68+
}
69+
}
70+
71+
private void Dots_Click(object sender, EventArgs e)
72+
{
73+
Button my_obj = (Button)sender;
74+
if (my_obj.Text == "Dots")
75+
{
76+
my_obj.Text = "Lines";
77+
my_dots = false;
78+
}
79+
else if (my_obj.Text == "Lines")
80+
{
81+
my_obj.Text = "Dots";
82+
my_dots = true;
83+
}
84+
}
85+
86+
private void pictureBox6_Click(object sender, EventArgs e)
87+
{
88+
89+
}
90+
91+
private void button1_Click(object sender, EventArgs e)
92+
{
93+
my_pen.Width += 2;
94+
if (my_pen.Width > 0)
95+
label4.Text = my_pen.Width.ToString();
96+
else
97+
{
98+
label4.Text = Convert.ToString(1);
99+
}
100+
}
101+
102+
private void button2_Click(object sender, EventArgs e)
103+
{
104+
my_pen.Width -= 2;
105+
if (my_pen.Width > 0)
106+
label4.Text = my_pen.Width.ToString();
107+
else
108+
{
109+
label4.Text = Convert.ToString(1);
110+
my_pen.Width = 1;
111+
}
112+
}
113+
114+
private void clearbtn_Click(object sender, EventArgs e)
115+
{
116+
draw.Clear(BackColor);
117+
}
118+
119+
private void flowLayoutPanel1_MouseUp(object sender, MouseEventArgs e)
120+
{
121+
pen_moving = false;
122+
pen_x = -1;
123+
pen_y = -1;
124+
}
125+
}
126+
}

Form1.resx

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
</root>

Paint Application.csproj

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{A294FAFC-54A6-4C78-8B45-9303AEC0545B}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>Paint</RootNamespace>
10+
<AssemblyName>Paint</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<TargetFrameworkProfile />
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<PlatformTarget>AnyCPU</PlatformTarget>
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<PlatformTarget>AnyCPU</PlatformTarget>
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="System" />
38+
<Reference Include="System.Core" />
39+
<Reference Include="System.Xml.Linq" />
40+
<Reference Include="System.Data.DataSetExtensions" />
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Deployment" />
44+
<Reference Include="System.Drawing" />
45+
<Reference Include="System.Net.Http" />
46+
<Reference Include="System.Windows.Forms" />
47+
<Reference Include="System.Xml" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Compile Include="Form1.cs">
51+
<SubType>Form</SubType>
52+
</Compile>
53+
<Compile Include="Form1.Designer.cs">
54+
<DependentUpon>Form1.cs</DependentUpon>
55+
</Compile>
56+
<Compile Include="Program.cs" />
57+
<Compile Include="Properties\AssemblyInfo.cs" />
58+
<EmbeddedResource Include="Form1.resx">
59+
<DependentUpon>Form1.cs</DependentUpon>
60+
</EmbeddedResource>
61+
<EmbeddedResource Include="Properties\Resources.resx">
62+
<Generator>ResXFileCodeGenerator</Generator>
63+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
64+
<SubType>Designer</SubType>
65+
</EmbeddedResource>
66+
<Compile Include="Properties\Resources.Designer.cs">
67+
<AutoGen>True</AutoGen>
68+
<DependentUpon>Resources.resx</DependentUpon>
69+
<DesignTime>True</DesignTime>
70+
</Compile>
71+
<None Include="Properties\Settings.settings">
72+
<Generator>SettingsSingleFileGenerator</Generator>
73+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
74+
</None>
75+
<Compile Include="Properties\Settings.Designer.cs">
76+
<AutoGen>True</AutoGen>
77+
<DependentUpon>Settings.settings</DependentUpon>
78+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
79+
</Compile>
80+
</ItemGroup>
81+
<ItemGroup>
82+
<None Include="App.config" />
83+
</ItemGroup>
84+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
85+
</Project>

Paint Application.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.106
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paint Application", "Paint Application.csproj", "{A294FAFC-54A6-4C78-8B45-9303AEC0545B}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A294FAFC-54A6-4C78-8B45-9303AEC0545B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A294FAFC-54A6-4C78-8B45-9303AEC0545B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A294FAFC-54A6-4C78-8B45-9303AEC0545B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A294FAFC-54A6-4C78-8B45-9303AEC0545B}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {3886D6E7-109D-4F2E-94A9-FD6CE4730412}
24+
EndGlobalSection
25+
EndGlobal

Program.cs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using System.Windows.Forms;
6+
7+
namespace Paint
8+
{
9+
static class Program
10+
{
11+
/// <summary>
12+
/// The main entry point for the application.
13+
/// </summary>
14+
[STAThread]
15+
static void Main()
16+
{
17+
Application.EnableVisualStyles();
18+
Application.SetCompatibleTextRenderingDefault(false);
19+
Application.Run(new Form1());
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)