Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="width">Width of the card (100 units/inch)</param>
 /// <param name="height">Height of the card (100 units/inch)</param>
 /// <param name="isInDesignMode">design mode indicator:
 /// true if in design mode, false otherwise</param>
 public CardWF(int width, int height, bool isInDesignMode)
     : base(width, height)
 {
     UserPreferences prefs = ((App)App.Current).UserPreferences;
     QslCard = this;
     App.Logger.Log("In CardWF constructor:" + Environment.NewLine,
                    App.Logger.DebugPrinting);
     CardPrintProperties = new PrintProperties();
     IsInDesignMode = isInDesignMode;
     ItemSize = new System.Drawing.Size(width, height);
     // background image
     BackgroundImage.QslCard = this;
     // call text item
     TextWFItem call = new TextWFItem();
     call.QslCard = this;
     foreach(TextPart part in prefs.Callsign)
     {
         call.Text.Add(part);
     }
     call.TextFontFace = prefs.DefaultTextItemsFontFace;
     call.IsBold = true;
     call.FontSize = 48.0F;
     call.X = -70;
     call.Y = 0;
     TextItems.Add(call);
     // name and Qth text item
     TextWFItem nameQth = new TextWFItem();
     nameQth.QslCard = this;
     foreach(TextPart part in prefs.NameQth)
     {
         nameQth.Text.Add(part);
     }
     nameQth.TextFontFace = prefs.DefaultTextItemsFontFace;
     nameQth.IsBold = false;
     nameQth.FontSize = 10.0F;
     nameQth.X = this.Width / 2;
     nameQth.Y = this.Height / 20;
     TextItems.Add(nameQth);
     // salutation text item
     TextWFItem salutation = new TextWFItem();
     salutation.QslCard = this;
     foreach(TextPart part in prefs.Salutation)
     {
         salutation.Text.Add(part);
     }
     salutation.TextFontFace = prefs.DefaultTextItemsFontFace;
     salutation.FontSize = 10.0F;
     salutation.X = this.Width / 75;
     salutation.Y = (int)((float)this.Height * 9F / 10F);
     TextItems.Add(salutation);
     // QsosBox
     QsosBox.QslCard = this;
 }
Esempio n. 2
0
 /// <summary>
 /// Handler for Print Cards menu item Executed event
 /// </summary>
 /// <param name="sender">not used</param>
 /// <param name="e">not used</param>
 private void PrintCardsCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     CardTabItem cti = mainTabControl.SelectedItem as CardTabItem;
     PrintProperties props = new PrintProperties(
         cti.cardPanel.QslCard.CardPrintProperties);
     if(App.Logger.DebugPrinting)
     {
         App.Logger.Log("PrintCardsCommand_Executed:" +
                        Environment.NewLine +
                        "Card size = " + cti.cardPanel.QslCard.Width +
                        " x " + cti.cardPanel.QslCard.Height +
                        Environment.NewLine +
                        props.ToString());
     }
     HamQSLerPrintDialog printDialog = new HamQSLerPrintDialog();
     printDialog.PrinterName = props.PrinterName;
     printDialog.PrinterPaperSize = props.PrinterPaperSize;
     printDialog.Resolution = props.Resolution;
     printDialog.Source = props.Source;
     printDialog.InsideMargins = props.InsideMargins;
     printDialog.PrintCardOutlines = props.PrintCardOutlines;
     printDialog.FillLastPage = props.FillLastPage;
     printDialog.SetCardMargins = props.SetCardMargins;
     printDialog.Layout = props.Layout;
     printDialog.CardWidth = cti.cardPanel.QslCard.Width;
     printDialog.CardHeight = cti.cardPanel.QslCard.Height;
     if(printDialog.ShowDialog() == true)
     {
         props.PrinterName = printDialog.PrinterName;
         props.PrinterPaperSize = printDialog.PrinterPaperSize;
         props.Resolution = printDialog.Resolution;
         props.Source = printDialog.Source;
         props.InsideMargins = printDialog.InsideMargins;
         props.PrintCardOutlines = printDialog.PrintCardOutlines;
         props.FillLastPage = printDialog.FillLastPage;
         props.SetCardMargins = printDialog.SetCardMargins;
         props.Layout = printDialog.Layout;
         if(App.Logger.DebugPrinting)
         {
             App.Logger.Log("PrintCardsCommand after printDialog.ShowDialog:" +
                            Environment.NewLine +
                            "Card size = " + cti.cardPanel.QslCard.Width +
                            " x " + cti.cardPanel.QslCard.Height +
                            Environment.NewLine +
                            props.ToString());
         }
         CardPrintDocument document =
             new CardPrintDocument(qsosView.DisplayQsos);
         document.PrintProperties = props;
         document.QslCard = cti.cardPanel.QslCard;
         if(printDialog.Preview)
         {
             System.Windows.Forms.PrintPreviewDialog ppDialog =
                 new System.Windows.Forms.PrintPreviewDialog();
             ppDialog.Document = document;
             ppDialog.WindowState = System.Windows.Forms.FormWindowState.Maximized;
             ppDialog.ShowDialog();
         }
         else
         {
             document.Print();
         }
     }
     else
     {
         if(App.Logger.DebugPrinting)
         {
             App.Logger.Log("Printing canceled");
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Copy constructor
        /// </summary>
        /// <param name="props">PrintProperties object to make copy of</param>
        public PrintProperties(PrintProperties props)
        {
            this.PrinterName = props.PrinterName;
            this.PrinterPaperSize =
                new PaperSize(props.PrinterPaperSize.PaperName,
                              props.PrinterPaperSize.Width,
                              props.PrinterPaperSize.Height);
            this.Resolution = new PrinterResolution();
            this.Resolution.Kind = props.Resolution.Kind;
            this.Resolution.X = props.Resolution.X;
            this.Resolution.Y = props.Resolution.Y;
            this.Source = props.Source;

            this.InsideMargins = props.InsideMargins;
            this.PrintCardOutlines = props.PrintCardOutlines;
            this.FillLastPage = props.FillLastPage;
            this.SetCardMargins = props.SetCardMargins;
            this.Layout = props.Layout;
        }