public void OnPrintCommand(Panel p)
        {
           var printer = new SerialPortUtil();
            PrintDocument pd = new PrintDocument();
            pd.PrintPage += (s, e) =>
            {
                //p.Width = e.PrintableArea.Width;
                //p.Height = e.PrintableArea.Height;
                p.HorizontalAlignment = HorizontalAlignment.Center;
                //e.PageVisual = p;
                e.HasMorePages = false;
            };
            //printer.Write(Guid.Empty, null);

            pd.Print();

        }
        public void OnPrintCommand(Panel p)
        {
            var printer = new SerialPortUtil();
            PrintDocument pd = new PrintDocument();
            pd.PrintPage += (s, e) =>
            {
                p.HorizontalAlignment = HorizontalAlignment.Center;
                e.HasMorePages = false;
            };

            pd.Print();

        }