locked
after fetching image from DB and displaying into Canvas problem is in Alignment for that image into canvas RRS feed

  • Question

  • Hi , 

    I am working on Digital signature in c# metro app for windows 8 . i am able to do signature saving as image in Desktop and and DB , i am able to display that signature image in that canvas after clearing the canvas to make signature editable . the issue is here while displaying that image it is taking the AlignmentX , AlignmentY as "Center" bydefault . i need to display the signature at the same position where i did earlier . i am giving whole code here you can use and check this code where the problem is . 

    i am thinking that there are 1 area from where i can resolve this problem , but i am afraid to say that i am not able to implement this area . 

    • If i could able to Save the image as the Size of Canvas so i guess it will resolve because that image will fix into that canvas as it is . (That Time It will be best Fix to that canvas ). 

    Thanks in advance , please make your DB Appropriate .

    C# code -->

    using SQLite;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Reflection;
    using System.Threading.Tasks;
    using Windows.ApplicationModel;
    using Windows.Devices.Input;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    using Windows.Storage;
    using Windows.Storage.FileProperties;
    using Windows.Storage.Streams;
    using Windows.UI;
    using Windows.UI.Core;
    using Windows.UI.Input.Inking;
    using Windows.UI.Popups;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Controls.Primitives;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Media.Imaging;
    using Windows.UI.Xaml.Navigation;
    using Windows.UI.Xaml.Shapes;
    using System.Runtime.InteropServices.WindowsRuntime;
    using Windows.Storage.Pickers;
    using Windows.Graphics.Imaging;
    using Windows.UI.Input;

    // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

    namespace Metro_Paint
    {
        /// <summary>
        /// An empty page that can be used on its own or navigated to within a Frame.
        /// </summary>
        public sealed partial class MainPage : Page
        {
            InkManager MyInkManager = new InkManager();
            Rect rect = new Rect();
            ImageBrush imgBrush = new ImageBrush();
            bool isKeyPressed = false;
            string DrawingTool;
            double X1, X2, Y1, Y2, StrokeThickness = 2;
            //Line NewLine;
            //Ellipse NewEllipse;
            Point StartPoint, PreviousContactPoint, CurrentContactPoint;
            Polyline Pencil;
            //Rectangle NewRectangle;
            Color BorderColor = Colors.Black, FillColor;
            uint PenID, TouchID;

            public MainPage()
            {
                this.InitializeComponent();
                canvas.PointerMoved += canvas_PointerMoved;
                canvas.PointerReleased += canvas_PointerReleased;
                canvas.PointerPressed += canvas_PointerPressed;
                canvas.PointerExited += canvas_PointerExited;
            }

            /// <summary>
            /// Invoked when this page is about to be displayed in a Frame.
            /// </summary>
            /// <param name="e">Event data that describes how this page was reached.  The Parameter
            /// property is typically used to configure the page.</param>
            protected async override void OnNavigatedTo(NavigationEventArgs e)
            {
                await checkDataBase();
            }

            #region Pointer Events

            void canvas_PointerExited(object sender, PointerRoutedEventArgs e)
            {
                Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 1);
            }

            void canvas_PointerPressed(object sender, PointerRoutedEventArgs e)
            {
                try
                {
                    if (this.isKeyPressed)
                    {
                        if (e.Pointer.PointerId == PenID || e.Pointer.PointerId == TouchID)
                            MyInkManager.ProcessPointerUp(e.GetCurrentPoint(canvas));

                        TouchID = 0;
                        PenID = 0;
                        e.Handled = true;
                        Pencil = null;
                    }
                    this.isKeyPressed = true;
                    DrawingTool = "Pencil";
                    PointerPoint pt = e.GetCurrentPoint(canvas);
                    PreviousContactPoint = pt.Position;
                    if (DrawingTool != "Eraser")
                        Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Cross, 1);
                    else
                        Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.UniversalNo, 1);
                    switch (DrawingTool)
                    {
                        case "Pencil":
                            {
                                // PointerPoint pts = e.GetCurrentPoint(canvas);
                                //  PreviousContactPoint = pt.Position;
                                //Accept input only from a pen or mouse with a left button pressed
                                PointerDeviceType pointerDevType = e.Pointer.PointerDeviceType;
                                if (((pointerDevType == PointerDeviceType.Pen || pointerDevType == PointerDeviceType.Mouse) && pt.Properties.IsLeftButtonPressed))
                                {
                                    //Pass the point information to the inkmanager
                                    MyInkManager.ProcessPointerDown(pt);
                                    PenID = pt.PointerId;
                                    e.Handled = true;

                                }
                                else if ((pointerDevType == PointerDeviceType.Touch))
                                {
                                    MyInkManager.ProcessPointerDown(pt);
                                    Line NewLine = new Line();
                                    NewLine.X1 = e.GetCurrentPoint(canvas).Position.X;
                                    NewLine.Y1 = e.GetCurrentPoint(canvas).Position.Y;
                                    NewLine.X2 = NewLine.X1 + 1;
                                    NewLine.Y2 = NewLine.Y1 + 1;
                                    NewLine.StrokeThickness = 2;
                                    NewLine.Stroke = new SolidColorBrush(Colors.Red);
                                    canvas.Children.Add(NewLine);
                                    TouchID = pt.PointerId;
                                    e.Handled = true;

                                }
                                //var MyDrawingAttributes = new InkDrawingAttributes();
                                //MyDrawingAttributes.Size = new Size(StrokeThickness, StrokeThickness);
                                //MyDrawingAttributes.Color = BorderColor;
                                //MyDrawingAttributes.FitToCurve = true;
                                //MyInkManager.SetDefaultDrawingAttributes(MyDrawingAttributes);

                                //PreviousContactPoint = e.GetCurrentPoint(canvas).Position;
                                ////PointerDeviceType pointerDevType = e.Pointer.PointerDeviceType;  to identify the pointer device
                                //if (e.GetCurrentPoint(canvas).Properties.IsLeftButtonPressed)
                                //{
                                //     //Pass the pointer information to the InkManager.
                                //    MyInkManager.ProcessPointerDown(e.GetCurrentPoint(canvas));
                                //    PenID = e.GetCurrentPoint(canvas).PointerId;
                                //    e.Handled = true;
                                //}
                            }
                            break;
                        default:
                            break;
                    }
                }
                catch (Exception ex)
                {

                    throw ex;
                }
            }

            void canvas_PointerMoved(object sender, PointerRoutedEventArgs e)
            {
                if (DrawingTool != "Eraser")
                    Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Cross, 1);
                else
                    Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.UniversalNo, 1);

                switch (DrawingTool)
                {
                    case "Pencil":
                        {
                            if (e.Pointer.PointerId == PenID || e.Pointer.PointerId == TouchID)
                            {
                                // Distance() is an application-defined function that tests
                                // whether the pointer has moved far enough to justify 
                                // drawing a new line.
                                CurrentContactPoint = e.GetCurrentPoint(canvas).Position;
                                X1 = PreviousContactPoint.X;
                                Y1 = PreviousContactPoint.Y;
                                X2 = CurrentContactPoint.X;
                                Y2 = CurrentContactPoint.Y;

                                if (Distance(X1, Y1, X2, Y2) > 2.0)
                                {
                                    Line line = new Line()
                                    {
                                        X1 = X1,
                                        Y1 = Y1,
                                        X2 = X2,
                                        Y2 = Y2,
                                        StrokeThickness = StrokeThickness,
                                        Stroke = new SolidColorBrush(BorderColor)


                                    };

                                    PreviousContactPoint = CurrentContactPoint;
                                    canvas.Children.Add(line);
                                    MyInkManager.ProcessPointerUpdate(e.GetCurrentPoint(canvas));
                                }
                            }
                        }
                        break;
                    default:
                        break;
                }
            }

            private double Distance(double x1, double y1, double x2, double y2)
            {
                double d = 0;
                d = Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));
                return d;
            }

            void canvas_PointerReleased(object sender, PointerRoutedEventArgs e)
            {
                this.isKeyPressed = false;
                if (e.Pointer.PointerId == PenID || e.Pointer.PointerId == TouchID)
                    MyInkManager.ProcessPointerUp(e.GetCurrentPoint(canvas));

                TouchID = 0;
                PenID = 0;
                e.Handled = true;
                Pencil = null;
            }

            #endregion

            private void btnClearScreen_Click(object sender, RoutedEventArgs e)
            {
                //MyInkManager.Mode = InkManipulationMode.Erasing;
                //for (int i = 0; i < MyInkManager.GetStrokes().Count; i++)
                //    MyInkManager.GetStrokes().ElementAt(i).Selected = true;
               // MyInkManager.DeleteSelected();
                txtRecognizedText.Text = string.Empty;
                canvas.Children.Clear();
            }



            #region Other events

            private void btnExit_Click(object sender, RoutedEventArgs e)
            {
                canvas.Children.Clear();
                App.Current.Exit();
            }

            private async void btnSaveWritingAsImage_Click(object sender, RoutedEventArgs e)
            {
                if (MyInkManager.GetStrokes().Count > 0)
                {
                    //rect = MyInkManager.BoundingRect;
                    //rect.Height = canvas.Height;
                    //rect.Width = canvas.Width;

                    try
                    {
                        FileSavePicker SavePicker = new FileSavePicker();
                        SavePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop;
                        SavePicker.DefaultFileExtension = ".png";
                        SavePicker.FileTypeChoices.Add("PNG", new string[] { ".png" });
                        SavePicker.FileTypeChoices.Add("JPG", new string[] { ".jpg" });

                        StorageFile file = await SavePicker.PickSaveFileAsync();
                        using (IOutputStream fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
                        {

                            if (fileStream != null)
                            {
                                await MyInkManager.SaveAsync(fileStream);
                            }
                        }
                        FileOpenPicker openPicker = new FileOpenPicker();
                        foreach (string extension in FileExtensions.Image)
                        {
                            openPicker.FileTypeFilter.Add(extension);
                        }

                        StorageFile openfile = await openPicker.PickSingleFileAsync();
                        byte[] bytesouput;
                        bytesouput = await ReadFile(openfile);
                        SQLiteAsyncConnection db = new SQLiteAsyncConnection("oms.db");
                        var expected = new Imagecompression() { id = 1 };
                        expected.Blob = new byte[bytesouput.Length];
                        for (int idx = 0; idx < bytesouput.Length; idx++)
                        {
                            expected.Blob[idx] = bytesouput[idx];// (idx + 1);
                        }
                        await db.InsertAsync(expected);


                    }

                    catch (Exception)
                    {
                        var MsgDlg = new MessageDialog("Only handwriting can be saved as image.", "Error while saving");
                        MsgDlg.ShowAsync();
                    }
                }
                else
                {
                    var MsgDlg = new MessageDialog("Only handwriting can be saved as image.", "Error while saving");
                    await MsgDlg.ShowAsync();
                }
            }

            public async Task<byte[]> ReadFile(StorageFile file)
            {
                byte[] fileBytes = null;
                using (IRandomAccessStreamWithContentType stream = await file.OpenReadAsync())
                {
                    fileBytes = new byte[stream.Size];
                    using (DataReader reader = new DataReader(stream))
                    {
                        await reader.LoadAsync((uint)stream.Size);
                        reader.ReadBytes(fileBytes);
                    }
                }

                return fileBytes;
            }


            private static async Task<BitmapImage> LoadImage(StorageFile file)
            {
                BitmapImage bitmapImage = new BitmapImage();
                FileRandomAccessStream stream = (FileRandomAccessStream)await file.OpenAsync(FileAccessMode.Read);

                bitmapImage.SetSource(stream);

                return bitmapImage;

            }

            #endregion

            internal class FileExtensions
            {
                public static readonly string[] Image = new string[] { ".jpg", ".png", ".bmp", ".gif", ".tif" };
            }


            public static async Task<bool> checkDataBase()
            {
                bool isDatabaseExisting = false;

                try
                {
                    StorageFile storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync("oms.db");
                    isDatabaseExisting = true;
                }
                catch
                {
                    isDatabaseExisting = false;
                }

                if (!isDatabaseExisting)
                {
                    StorageFile databaseFile = await Package.Current.InstalledLocation.GetFileAsync("oms.db");
                    await databaseFile.CopyAsync(ApplicationData.Current.LocalFolder);
                }
                return isDatabaseExisting;
            }
            //retrive image 
            private async void Button_Click_1(object sender, RoutedEventArgs e)
            {

                SQLiteAsyncConnection db = new SQLiteAsyncConnection("oms.db");
                Imagecompression imgcompress = new Imagecompression();
                imgcompress = await db.GetAsync<Imagecompression>("select * from Imagecompression");
                byte[] outputbytes = imgcompress.Blob;
                BitmapImage img = new BitmapImage();
                var stream1 = new InMemoryRandomAccessStream();
                await stream1.WriteAsync(outputbytes.AsBuffer());
                stream1.Seek(0);
                img.SetSource(stream1);


                Rectangle blueRectangle = new Rectangle();
                blueRectangle.Height = 254;
                blueRectangle.Width = 523;

                imgBrush.ImageSource = img;
                //Shivam Added 
                imgBrush.Stretch = Stretch.None;


                // Fill rectangle with an ImageBrush
                blueRectangle.Fill = imgBrush;
                canvas.Children.Add(blueRectangle);

            }

        }

        public class Imagecompression
        {
            public int id { get; set; }
            public byte[] Blob { get; set; }

        }
    }

    // Xmal Code 

    <Page
        x:Class="Metro_Paint.MainPage"
        IsTabStop="false"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:Metro_Paint"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">

        <Page.Resources>
            <Style x:Key="PaintButton" TargetType="Button">
                <Setter Property="FontFamily" Value="Segoe UI Symbol"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="FontSize" Value="20"/>
                <Setter Property="Width" Value="auto"/>
                <Setter Property="Height" Value="50"/>
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="Grid.Row" Value="0"/>
            </Style>
        </Page.Resources>
        
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <Grid.Transitions>
                <TransitionCollection>
                    <EntranceThemeTransition FromHorizontalOffset="-50" FromVerticalOffset="-50"/>
                </TransitionCollection>
            </Grid.Transitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition Height="60"/>
                <RowDefinition Height="100"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal">
                <TextBlock x:Name="tbPageTitle" Text="Digital Signature" Style="{StaticResource PageHeaderTextStyle}" Grid.Row="0" Margin="10,0,0,21"/>
            </StackPanel>
            <!--<StackPanel Orientation="Horizontal" Margin="37,428,0,40" Grid.Row="3">-->
                <!--<Button x:Name="btnLine" Click="btnLine_Click" Content="&#x2571;" Style="{StaticResource PaintButton}" ToolTipService.ToolTip="Line"/>-->
                <!--<Button x:Name="btnEllipse" Click="btnEllipse_Click" Style="{StaticResource PaintButton}" Content="&#x25EF;" ToolTipService.ToolTip="Ellipse"/>-->
                <!--<Button x:Name="btnPencil" Click="btnPencil_Click" Style="{StaticResource PaintButton}" Content="&#x270E;" ToolTipService.ToolTip="Pencil"/>-->
                <!--<Button x:Name="btnRectagle" Click="btnRectagle_Click" Style="{StaticResource PaintButton}" Content="&#x25AD;" ToolTipService.ToolTip="Rectangle"/>-->
                <!--<Button x:Name="btnEraser" Click="btnEraser_Click" Style="{StaticResource PaintButton}" Content="&#x2205;" ToolTipService.ToolTip="Eraser"/>-->
             
                <!--<Button x:Name="btnRecognize" Click="btnRecognize_Click" Style="{StaticResource PaintButton}" Content="R" ToolTipService.ToolTip="Handwriting Recognition"/>-->
                <!--<TextBlock x:Name="tbBorderColor" Text="Border Colors : " VerticalAlignment="Center" FontSize="15" TextWrapping="Wrap" Padding="15,0,0,0" Margin="0"/>-->
                <!--<ComboBox x:Name="cbBorderColor" Width="200" Height="40" ItemsSource="{Binding Colors}" SelectedItem="{Binding SelectedColorName, Mode=TwoWay}" SelectionChanged="cbBorderColor_SelectionChanged" Padding="8,0" Margin="10,0,0,0">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Rectangle Width="35" Height="20" Fill="{Binding Name}" Margin="5,0"/>
                                <TextBlock Grid.Column="1" Margin="10,0,0,0" Text="{Binding Name}" Foreground="Black"/>
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>-->
                <!--<TextBlock x:Name="tbFillColor" Text="Fill Colors : " VerticalAlignment="Center" FontSize="15" Padding="15,0,0,0"/>-->
                <!--<ComboBox x:Name="cbFillColor" Width="200" Height="40" ItemsSource="{Binding Colors}" SelectedItem="{Binding SelectedColorName, Mode=TwoWay}" SelectionChanged="cbFillColor_SelectionChanged" Margin="10,0,0,0">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Rectangle Width="35" Height="20" Fill="{Binding Name}" Margin="5,0"/>
                                <TextBlock Grid.Column="1" Margin="10,0,0,0" Text="{Binding Name}" Foreground="Black"/>
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>-->
                
                <!--<Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="80"/>
                        <ColumnDefinition Width="20"/>
                        <ColumnDefinition Width="20"/>
                        <ColumnDefinition Width="20"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock x:Name="tbBorderColor" Text="Border Colors : " Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" FontSize="15" TextWrapping="Wrap" Grid.RowSpan="3" Padding="15,0,0,0"/>
                    <Button x:Name="btnRed" Background="Red" Height="20" Width="20" Click="btnRed_Click" Grid.Row="0" Grid.Column="1" BorderThickness="0"/>
                    <Button x:Name="btnGreen" Background="Green" Height="20" Width="20" Click="btnGreen_Click" Grid.Row="0" Grid.Column="2" BorderThickness="0"/>
                    <Button x:Name="btnBlue" Background="Blue" Height="20" Width="20" Click="btnBlue_Click" Grid.Row="0" Grid.Column="3" BorderThickness="0"/>
                    <Button x:Name="btnBlack" Background="Black" Height="20" Width="20" Click="btnBlack_Click" Grid.Row="1" Grid.Column="1" BorderThickness="0"/>
                    <Button x:Name="btnYellow" Background="Yellow" Height="20" Width="20" Click="btnYellow_Click" Grid.Row="1" Grid.Column="2" BorderThickness="0"/>
                    <Button x:Name="btnMagenta" Background="Magenta" Height="20" Width="20" Click="btnMagenta_Click" Grid.Row="1" Grid.Column="3" BorderThickness="0"/>
                    <Button x:Name="btnCyan" Background="Cyan" Height="20" Width="20" Click="btnCyan_Click" Grid.Row="2" Grid.Column="1" BorderThickness="0"/>
                    <Button x:Name="btnWhite" Background="White" Height="20" Width="20" Click="btnWhite_Click" Grid.Row="2" Grid.Column="2" BorderThickness="0"/>
                    <Button x:Name="btnPink" Background="Pink" Height="20" Width="20" Click="btnPink_Click" Grid.Row="2" Grid.Column="3" BorderThickness="0"/>
                </Grid>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70"/>
                        <ColumnDefinition Width="20"/>
                        <ColumnDefinition Width="20"/>
                        <ColumnDefinition Width="20"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock x:Name="tbFillColor" Text="Fill Colors : " Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Grid.RowSpan="3" FontSize="15" TextWrapping="Wrap" Padding="15,0,0,0"/>
                    <Button x:Name="btnFillRed" Background="Red" Height="20" Width="20" Click="btnFillRed_Click" Grid.Row="0" Grid.Column="1" BorderThickness="0"/>
                    <Button x:Name="btnFillGreen" Background="Green" Height="20" Width="20" Click="btnFillGreen_Click" Grid.Row="0" Grid.Column="2" BorderThickness="0"/>
                    <Button x:Name="btnFillBlue" Background="Blue" Height="20" Width="20" Click="btnFillBlue_Click" Grid.Row="0" Grid.Column="3" BorderThickness="0"/>
                    <Button x:Name="btnFillBlack" Background="Black" Height="20" Width="20" Click="btnFillBlack_Click" Grid.Row="1" Grid.Column="1" BorderThickness="0"/>
                    <Button x:Name="btnFillYellow" Background="Yellow" Height="20" Width="20" Click="btnFillYellow_Click" Grid.Row="1" Grid.Column="2" BorderThickness="0"/>
                    <Button x:Name="btnFillMagenta" Background="Magenta" Height="20" Width="20" Click="btnFillMagenta_Click" Grid.Row="1" Grid.Column="3" BorderThickness="0"/>
                    <Button x:Name="btnFillCyan" Background="Cyan" Height="20" Width="20" Click="btnFillCyan_Click" Grid.Row="2" Grid.Column="1" BorderThickness="0"/>
                    <Button x:Name="btnFillWhite" Background="White" Height="20" Width="20" Click="btnFillWhite_Click" Grid.Row="2" Grid.Column="2" BorderThickness="0"/>
                    <Button x:Name="btnFillPink" Background="Pink" Height="20" Width="20" Click="btnFillPink_Click" Grid.Row="2" Grid.Column="3" BorderThickness="0"/>
                </Grid>-->
                <!--<TextBlock x:Name="tbStrokeThickness" Text="Stroke Thickness :" FontSize="15" TextWrapping="Wrap" Padding="15,0,0,0" MaxWidth="90" VerticalAlignment="Center"/>
                <ComboBox x:Name="cbStrokeThickness" SelectionChanged="cbStrokeThickness_SelectionChanged" Margin="10,0,0,0" Height="30"/>-->
                
            <!--</StackPanel>-->
            <StackPanel Grid.Row="3" Orientation="Horizontal" Margin="0,328,833,100">
                <!--<StackPanel Width="578" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,31">-->
                <Button x:Name="btnClearScreen" Click="btnClearScreen_Click" Style="{StaticResource PaintButton}" Content="Clear" ToolTipService.ToolTip="Clear Screen" Margin="10,31,0,10" Width="163" Height="59"/>
                <Button x:Name="btnSaveWritingAsImage" Style="{StaticResource PaintButton}" Click="btnSaveWritingAsImage_Click" Visibility="Visible" Width="155" Content="Save" HorizontalAlignment="Left" RenderTransformOrigin="0.311,0.514" Margin="10,0,0,10" VerticalAlignment="Bottom" Height="59" />
                <Button x:Name="btnExit" Click="btnExit_Click" Style="{StaticResource PaintButton}" Content="Cancel" Margin="10,31,0,10" Width="177" Height="59"/>
                <!--<StackPanel Width="578" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,31">-->
                <!--<StackPanel Width="578" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,31">-->
                <!--<StackPanel Width="578" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,31">-->
                <!--<Button x:Name="btnSaveRecognizedText" Click="btnSaveRecognizedText_Click" Visibility="Visible" Width="155" Content="Save as text" HorizontalAlignment="Center"  />-->
                    <!--<Button x:Name="btnSaveRecognizedText" Click="btnSaveRecognizedText_Click" Visibility="Visible" Width="155" Content="Save as text" HorizontalAlignment="Center"  />-->
                <!--</StackPanel>-->
            </StackPanel>
            <Canvas Name="canvas" Background="White" Grid.Row="3" Grid.RowSpan="1" Margin="10,10,833,264">
            </Canvas>
            <TextBox x:Name="txtRecognizedText" Visibility="Visible" Padding="10,3,10,5" Margin="10,269,833,205" TextWrapping="Wrap" Grid.Row="3"/>
            <Button Content="retieve signature" HorizontalAlignment="Left" Margin="562,359,0,0" Grid.Row="3" VerticalAlignment="Top" Height="54" Click="Button_Click_1"/>
        </Grid>
    </Page>

    Wednesday, September 25, 2013 11:04 AM

All replies

  • Please put a working sample on Skydrive and give us to link to it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, September 25, 2013 8:03 PM
    Moderator
  • i'm working on a similar project for my final year project. i can save the images in the local storage but i want to be able to save the images in sqlite database as you did with this project. can you send the source code or help me in anyway you can...thanks
    Wednesday, November 5, 2014 4:48 PM