I don't think this would work, unless you did something with saving the coordinates of the x and y's of each persons hand, by putting a canvas down, then an image on top of it, then 4 ellipses, like:
, then scaling the position of them to peoples joints, (see Channel 9 for how to do this). Then I would copy the coordinates to a double
to then set the pixels of them. Do that like this.
double person1hand1x = Canvas.GetLeft(person1hand1);
double person1hand1y = Canvas.GetTop(person1hand1);
Then I would change the color of the canvas based on those actions by using the Image control. import the System.Drawing
resource into your project, you will need it to set the pixels Then create a Bitmap
and set the pixels of it as where the x and y's have been. Do that like this:
Bitmap b = new Bitmap((int)image1.Width, (int)image1.Height); //set the max height and width
b.SetPixel(person1hand1x, person1hand1y, person1hand1.Fill); //set the ellipse fill so they can keep track of who drew what
image1.Source = ToBitmapSource(b); //convert to bitmap source... see https://stackoverflow.com/questions/94456/load-a-wpf-bitmapimage-from-a-system-drawing-bitmap/1470182#1470182 for more details
}
/// <summary>
/// Converts a <see cref="System.Drawing.Bitmap"/> into a WPF <see cref="BitmapSource"/>.
/// </summary>
/// <remarks>Uses GDI to do the conversion. Hence the call to the marshalled DeleteObject.
/// </remarks>
/// <param name="source">The source bitmap.</param>
/// <returns>A BitmapSource</returns>
public static BitmapSource ToBitmapSource(this System.Drawing.Bitmap source)
{
BitmapSource bitSrc = null;
var hBitmap = source.GetHbitmap();
try
{
bitSrc = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
hBitmap,
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
}
catch (Win32Exception)
{
bitSrc = null;
}
finally
{
NativeMethods.DeleteObject(hBitmap);
}
return bitSrc;
}
internal static class NativeMethods
{
[DllImport("gdi32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool DeleteObject(IntPtr hObject);
}
Hope this helps! Note: I got the ToBitmapSource
from Load a WPF BitmapImage from a System.Drawing.Bitmap