Skip to content

Commit fc3a3d9

Browse files
committed
Add Carubbi.Cards.WinForms
1 parent b3a7622 commit fc3a3d9

File tree

9 files changed

+242
-4
lines changed

9 files changed

+242
-4
lines changed

Carubbi.Cards.WinForms/CardBox.Designer.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Carubbi.Cards.WinForms/CardBox.cs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using Carubbi.Cards;
2+
using System;
3+
using System.Drawing;
4+
using System.Windows.Forms;
5+
6+
namespace Carubbi.Cards.WinForms
7+
{
8+
public partial class CardBox : PictureBox
9+
{
10+
public CardBox()
11+
{
12+
InitializeComponent();
13+
}
14+
15+
protected override void OnPaint(PaintEventArgs pe)
16+
{
17+
base.OnPaint(pe);
18+
if (DesignMode && BackgroundImage == null)
19+
{
20+
BackgroundImage = Resources.Back;
21+
Width = Resources.Back.Width;
22+
Height = Resources.Back.Height;
23+
}
24+
}
25+
26+
27+
private Card _card;
28+
29+
public Card Card
30+
{
31+
get => _card;
32+
set
33+
{
34+
_card = value;
35+
if (_card != null)
36+
{
37+
38+
_card.closed += _card_changed;
39+
_card.opened += _card_changed;
40+
BackgroundImage = _card.Image;
41+
Width = _card.Image.Width;
42+
Height = _card.Image.Height;
43+
BringToFront();
44+
45+
}
46+
else
47+
{
48+
BackgroundImage = null;
49+
BackColor = Color.Transparent;
50+
51+
}
52+
Invalidate();
53+
54+
}
55+
}
56+
57+
private void _card_changed(object sender, EventArgs e)
58+
{
59+
if (_card != null)
60+
{
61+
BackgroundImage = _card.Image;
62+
Width = _card.Image.Width;
63+
Height = _card.Image.Height;
64+
}
65+
else
66+
{
67+
BackgroundImage = null;
68+
}
69+
BringToFront();
70+
Refresh();
71+
}
72+
}
73+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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>{86F4F039-0057-43F9-AA70-0BDF4BE1FB19}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Carubbi.Cards.WinForms</RootNamespace>
11+
<AssemblyName>Carubbi.Cards.WinForms</AssemblyName>
12+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="Carubbi.Cards, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
35+
<HintPath>..\packages\Carubbi.Cards.1.1.0\lib\net461\Carubbi.Cards.dll</HintPath>
36+
</Reference>
37+
<Reference Include="System" />
38+
<Reference Include="System.Core" />
39+
<Reference Include="System.Drawing" />
40+
<Reference Include="System.Windows.Forms" />
41+
<Reference Include="System.Xml.Linq" />
42+
<Reference Include="System.Data.DataSetExtensions" />
43+
<Reference Include="Microsoft.CSharp" />
44+
<Reference Include="System.Data" />
45+
<Reference Include="System.Net.Http" />
46+
<Reference Include="System.Xml" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<Compile Include="CardBox.cs">
50+
<SubType>Component</SubType>
51+
</Compile>
52+
<Compile Include="CardBox.Designer.cs">
53+
<DependentUpon>CardBox.cs</DependentUpon>
54+
</Compile>
55+
<Compile Include="Properties\AssemblyInfo.cs" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<None Include="Carubbi.Cards.WinForms.nuspec" />
59+
<None Include="packages.config" />
60+
</ItemGroup>
61+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
62+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>$id$</id>
5+
<version>$version$</version>
6+
<title>$title$</title>
7+
<authors>Raphael Carubbi Neto</authors>
8+
<owners>Raphael Carubbi Neto</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<description>WinForms Visual Components do use with Carubbi.Cards</description>
11+
<releaseNotes></releaseNotes>
12+
<copyright>Copyright Carubbi Consultoria e Tecnologia 2018</copyright>
13+
<tags>poker, card game</tags>
14+
</metadata>
15+
</package>
16+
17+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Carubbi.Cards.WinForms")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Carubbi.Cards.WinForms")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("86f4f039-0057-43f9-aa70-0bdf4be1fb19")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Carubbi.Cards" version="1.1.0" targetFramework="net462" />
4+
</packages>

Carubbi.Cards.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Carubbi.Truco.UI", "Carubbi
2727
EndProject
2828
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Carubbi.RobaMonte", "Carubbi.RobaMonte\Carubbi.RobaMonte.csproj", "{9BE2F5C1-32ED-44DA-BDA4-90C82E27BF4D}"
2929
EndProject
30+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Carubbi.Cards.WinForms", "Carubbi.Cards.WinForms\Carubbi.Cards.WinForms.csproj", "{86F4F039-0057-43F9-AA70-0BDF4BE1FB19}"
31+
EndProject
3032
Global
3133
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3234
Debug|Any CPU = Debug|Any CPU
@@ -81,6 +83,10 @@ Global
8183
{9BE2F5C1-32ED-44DA-BDA4-90C82E27BF4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
8284
{9BE2F5C1-32ED-44DA-BDA4-90C82E27BF4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
8385
{9BE2F5C1-32ED-44DA-BDA4-90C82E27BF4D}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{86F4F039-0057-43F9-AA70-0BDF4BE1FB19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87+
{86F4F039-0057-43F9-AA70-0BDF4BE1FB19}.Debug|Any CPU.Build.0 = Debug|Any CPU
88+
{86F4F039-0057-43F9-AA70-0BDF4BE1FB19}.Release|Any CPU.ActiveCfg = Release|Any CPU
89+
{86F4F039-0057-43F9-AA70-0BDF4BE1FB19}.Release|Any CPU.Build.0 = Release|Any CPU
8490
EndGlobalSection
8591
GlobalSection(SolutionProperties) = preSolution
8692
HideSolutionNode = FALSE

Carubbi.SlotCard.UI/Carubbi.SlotCard.UI.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
<Prefer32Bit>false</Prefer32Bit>
5757
</PropertyGroup>
5858
<ItemGroup>
59+
<Reference Include="Carubbi.Cards, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
60+
<HintPath>..\packages\Carubbi.Cards.1.1.0\lib\net461\Carubbi.Cards.dll</HintPath>
61+
</Reference>
5962
<Reference Include="System" />
6063
<Reference Include="System.Core">
6164
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -95,6 +98,7 @@
9598
<DesignTime>True</DesignTime>
9699
</Compile>
97100
<None Include="app.config" />
101+
<None Include="packages.config" />
98102
<None Include="Properties\Settings.settings">
99103
<Generator>SettingsSingleFileGenerator</Generator>
100104
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -106,10 +110,6 @@
106110
</Compile>
107111
</ItemGroup>
108112
<ItemGroup>
109-
<ProjectReference Include="..\Carubbi.Cards\Carubbi.Cards.csproj">
110-
<Project>{1491ED5C-868B-4E08-AF44-4F2C4C7AEF7E}</Project>
111-
<Name>Carubbi.Cards</Name>
112-
</ProjectReference>
113113
<ProjectReference Include="..\Carubbi.SlotCard\Carubbi.SlotCard.csproj">
114114
<Project>{FD3F4BE7-0A7F-4AD6-AA94-9CDC593A5F96}</Project>
115115
<Name>Carubbi.SlotCard</Name>

Carubbi.SlotCard.UI/packages.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Carubbi.Cards" version="1.1.0" targetFramework="net461" />
4+
</packages>

0 commit comments

Comments
 (0)