[ADDED] made a color picker for the canvas
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.0.1" />
|
||||||
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
|
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.9" />
|
<PackageReference Include="PropertyChanged.Fody" Version="3.2.9" />
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Client.Views"
|
xmlns:local="clr-namespace:Client.Views"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Scrubl.io" Height="600" Width="1200">
|
Title="Scrubl.io" Height="600" Width="1200">
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="200"/>
|
<ColumnDefinition Width="200"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
@@ -29,23 +30,19 @@
|
|||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Label Grid.Row="0" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
<Label Grid.Row="1" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
<Label Grid.Row="2" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
<Label Grid.Row="3" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
<Label Grid.Row="4" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
<Label Grid.Row="5" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
<Label Grid.Row="6" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
<Label Grid.Row="7" Content="{Binding Path=...}" FontSize="15"/>
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Button Name="CanvasReset" Click="CanvasReset_Click" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Width="100" Margin="10, 10, 10, 10" Content="RESET" />
|
<Button Name="CanvasReset" Click="CanvasReset_Click" Grid.Row="0" Grid.Column="1" Margin="890,10,10,10" Content="RESET" />
|
||||||
<Canvas Name="CanvasForPaint" Grid.Row="1" Grid.Column="1" MouseDown="CanvasForPaint_MouseDown" MouseMove="CanvasForPaint_MouseMove" Margin="10, 10, 10, 10">
|
|
||||||
|
<xctk:ColorPicker Name="ClrPcker_Background" SelectedColorChanged="ClrPcker_Background_SelectedColorChanged_1" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"></xctk:ColorPicker>
|
||||||
|
|
||||||
|
<Canvas Name="CanvasForPaint" Grid.Row="1" Grid.Column="1" MouseDown="CanvasForPaint_MouseDown" MouseMove="CanvasForPaint_MouseMove" Margin="10, 10, 10, 10" >
|
||||||
<Canvas.Background>
|
<Canvas.Background>
|
||||||
<SolidColorBrush Color="White" Opacity="0"/>
|
<SolidColorBrush Color="White" Opacity="0"/>
|
||||||
</Canvas.Background>
|
</Canvas.Background>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ namespace Client.Views
|
|||||||
{
|
{
|
||||||
Line line = new Line();
|
Line line = new Line();
|
||||||
|
|
||||||
line.Stroke = SystemColors.WindowFrameBrush;
|
|
||||||
|
line.Stroke = new SolidColorBrush(color);
|
||||||
|
//line.Stroke = SystemColors.WindowFrameBrush;
|
||||||
line.X1 = currentPoint.X;
|
line.X1 = currentPoint.X;
|
||||||
line.Y1 = currentPoint.Y;
|
line.Y1 = currentPoint.Y;
|
||||||
line.X2 = e.GetPosition(CanvasForPaint).X;
|
line.X2 = e.GetPosition(CanvasForPaint).X;
|
||||||
@@ -53,11 +55,22 @@ namespace Client.Views
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Color color;
|
||||||
|
|
||||||
|
private void ClrPcker_Background_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color> e)
|
||||||
|
{
|
||||||
|
Color colorSelected = new Color();
|
||||||
|
colorSelected.A = 255;
|
||||||
|
colorSelected.R = ClrPcker_Background.SelectedColor.Value.R;
|
||||||
|
colorSelected.G = ClrPcker_Background.SelectedColor.Value.G;
|
||||||
|
colorSelected.B = ClrPcker_Background.SelectedColor.Value.B;
|
||||||
|
color = colorSelected;
|
||||||
|
}
|
||||||
|
|
||||||
private void CanvasReset_Click(object sender, RoutedEventArgs e)
|
private void CanvasReset_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
CanvasForPaint.Children.Clear();
|
CanvasForPaint.Children.Clear();
|
||||||
|
|
||||||
|
|
||||||
//FOR FUTURE USE, IF NECCESSARY
|
//FOR FUTURE USE, IF NECCESSARY
|
||||||
//TEST.Children.Clear();
|
//TEST.Children.Clear();
|
||||||
|
|
||||||
@@ -69,5 +82,15 @@ namespace Client.Views
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClrPcker_Background_SelectedColorChanged_1(object sender, RoutedPropertyChangedEventArgs<Color?> e)
|
||||||
|
{
|
||||||
|
Color colorSelected = new Color();
|
||||||
|
colorSelected.A = 255;
|
||||||
|
colorSelected.R = ClrPcker_Background.SelectedColor.Value.R;
|
||||||
|
colorSelected.G = ClrPcker_Background.SelectedColor.Value.G;
|
||||||
|
colorSelected.B = ClrPcker_Background.SelectedColor.Value.B;
|
||||||
|
color = colorSelected;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AsyncAwaitBestPractices" Version="4.3.0" />
|
<PackageReference Include="AsyncAwaitBestPractices" Version="4.3.0" />
|
||||||
|
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.0.1" />
|
||||||
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
|
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.9" />
|
<PackageReference Include="PropertyChanged.Fody" Version="3.2.9" />
|
||||||
|
|||||||
Reference in New Issue
Block a user