Skip to content

Commit

Permalink
Added cursors and new icons
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes85 committed Jul 16, 2014
1 parent b4c87ae commit 1fa6fe3
Show file tree
Hide file tree
Showing 43 changed files with 320 additions and 478 deletions.
341 changes: 170 additions & 171 deletions MagicPaint/Form1.Designer.cs

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions MagicPaint/MagicPaint.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
<None Include="Resources\removepage.png" />
<None Include="Resources\imageadd.png" />
<None Include="Resources\save.png" />
<None Include="Resources\undo.png" />
<None Include="Resources\newdoc.png" />
<None Include="Resources\newpage.png" />
<None Include="Resources\open.png" />
<None Include="Resources\picture.png" />
<None Include="Resources\fill_color.png" />
<None Include="Resources\draw_brush.png" />
<None Include="Resources\device.png" />
<None Include="Resources\color_picker.png" />
<None Include="Resources\arrow_right.png" />
<None Include="Resources\arrow_left.png" />
<None Include="Resources\cursors\fill.cur" />
<None Include="Resources\cursors\pipette.cur" />
<None Include="Resources\cursors\brush.cur" />
<None Include="Resources\fill-color.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
1 change: 0 additions & 1 deletion MagicPaint/MagicPixler.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 35 additions & 1 deletion MagicPaint/MagicPixler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;

namespace MagicPaint
{
Expand All @@ -36,6 +37,7 @@ public partial class MagicPixler : UserControl
private Bitmap buffer;
private Pen penHelpingLines;
private Pen penCursor;
private Tool currentTool;

private Point cursorPosition;
private bool cursorEnabled;
Expand All @@ -47,7 +49,29 @@ public partial class MagicPixler : UserControl
public event EventHandler OnChanged;

public Boolean EditEnabled { get; set; }
public Tool CurrentTool { get; set; }
public Tool CurrentTool {
get
{
return currentTool;
}
set
{
currentTool = value;

switch (currentTool)
{
case Tool.Brush:
Cursor = GetCursor("brush");
break;
case Tool.ColorPicker:
Cursor = GetCursor("pipette");
break;
case Tool.Fill:
Cursor = GetCursor("fill");
break;
}
}
}
public Color CurrentColor { get; set; }
public int PixelSize
{
Expand Down Expand Up @@ -220,6 +244,16 @@ private Boolean EqualColor(Color color1, Color color2)
return (color1.ToArgb() == color2.ToArgb());
}

private Cursor GetCursor(string cursorName)
{
var buffer = Properties.Resources.ResourceManager.GetObject(cursorName) as byte[];

using (var m = new MemoryStream(buffer))
{
return new Cursor(m);
}
}

private void MagicPixler_Resize(object sender, EventArgs e)
{
RefreshEditor();
Expand Down
86 changes: 58 additions & 28 deletions MagicPaint/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1fa6fe3

Please sign in to comment.