/*------------------------------------------------------ ** Constructor ** description: Initializes the private data fields **----------------------------------------------------*/ public MultipagePrintDocument(TXTextControl.TextControl textControl, PagePerSheet pagesPerSheet, bool drawPageBorders) { if (textControl == null) throw new ArgumentNullException( "An object of type TXTextControl.TextControl must be defined."); m_textControl = textControl; m_pagesPerSheet = pagesPerSheet; m_drawPageBorders = drawPageBorders; }
private int StreamTypeToFilterIndex(TXTextControl.StreamType streamType) { switch (streamType) { case TXTextControl.StreamType.RichTextFormat: return 1; case TXTextControl.StreamType.HTMLFormat: return 2; } return 1; }
/// <summary> /// Find a paper size that matches Text Control's current page size settings. /// </summary> private static PaperSize GetTxPaperSize(TXTextControl.PageSize pgSize, bool bLandscape) { const int nTolerance = 1; PrintDocument pdoc = new PrintDocument(); // Swap values if Landscape. if (bLandscape) pgSize = new TXTextControl.PageSize(pgSize.Height, pgSize.Width); // swap // Find a matching page size in the printer's paper size collection foreach (PaperSize ps in pdoc.PrinterSettings.PaperSizes) { if ((Math.Abs(ps.Height - Math.Round(pgSize.Height)) <= nTolerance) && (Math.Abs(ps.Width - Math.Round(pgSize.Width)) <= nTolerance)) return ps; } return null; }
public static void pageSetup_Click( object sender, System.EventArgs e, TXTextControl.TextControl tc, FileHandler fh ) { PageSetupDialog psd = new PageSetupDialog(); psd.Document = new PrintDocument(); tc.PageUnit = TXTextControl.MeasuringUnit.CentiInch; psd.EnableMetric = true; psd.PageSettings.PaperSize = GetTxPaperSize( tc.Selection.SectionFormat.PageSize, tc.Selection.SectionFormat.Landscape ); Margins mrgDlg = psd.PageSettings.Margins; TXTextControl.PageMargins mrgTX = tc.Selection.SectionFormat.PageMargins; mrgDlg.Top = (int)mrgTX.Top; mrgDlg.Right = (int)mrgTX.Right; mrgDlg.Bottom = (int)mrgTX.Bottom; mrgDlg.Left = (int)mrgTX.Left; psd.PageSettings.Landscape = tc.Selection.SectionFormat.Landscape; if (psd.ShowDialog() == DialogResult.OK) { mrgDlg = psd.PageSettings.Margins; mrgTX.Top = mrgDlg.Top; mrgTX.Right = mrgDlg.Right; mrgTX.Bottom = mrgDlg.Bottom; mrgTX.Left = mrgDlg.Left; // Temporarily set page orientation to portrait so the // page size is set correctly tc.Selection.SectionFormat.Landscape = false; tc.Selection.SectionFormat.PageSize.Height = psd.PageSettings.PaperSize.Height; tc.Selection.SectionFormat.PageSize.Width = psd.PageSettings.PaperSize.Width; tc.Selection.SectionFormat.Landscape = psd.PageSettings.Landscape; fh.DocumentDirty = true; } }
private void mailMerge1_FieldMerged(object sender, TXTextControl.DocumentServer.MailMerge.FieldMergedEventArgs e) { ApplicationField field = e.MailMergeFieldAdapter.ApplicationField; field.Text = field.Text.Replace(@"\r\n", "\r\n"); }
private void textControl1_TextFieldClicked(object sender, TXTextControl.TextFieldEventArgs e) { // cast the field to an ApplicationField ApplicationField field = e.TextField as ApplicationField; if (field != null) { // check whether the field is a checkbox field if ((field.TypeName == "FORMCHECKBOX")) { // create a new adapter field FormCheckBox chkb = new FormCheckBox(field); if (chkb.Enabled == false) return; // change the checked state if (field.Text == UNCHECKED) { chkb.Checked = true; chkb.Text = CHECKED; } else if (field.Text == CHECKED) { chkb.Checked = false; chkb.Text = UNCHECKED; } } } }
private void RemoveWatermarkImages(TXTextControl.TextControl textControl) { // List of images to be deleted List<TXTextControl.Image> lImagesToRemove = new List<TXTextControl.Image>(); // loop through all images and check for the Name foreach (TXTextControl.Image img in textControl1.Images) { // add watermark images to the List if (img.Name == "Watermark") lImagesToRemove.Add(img); } // remove all tagged watermark images foreach(TXTextControl.Image img in lImagesToRemove) { textControl1.Images.Remove(img); } }
// set back the EditMode private void textControl1_ImageDeselected(object sender, TXTextControl.ImageEventArgs e) { textControl1.EditMode = TXTextControl.EditMode.Edit; }
// set the EditMode to read only when a watermark is selected // to avoid the deletion private void textControl1_ImageSelected(object sender, TXTextControl.ImageEventArgs e) { if (e.Image.Name == "Watermark") textControl1.EditMode = TXTextControl.EditMode.ReadAndSelect; }
private void TextControl_ImageDeleted(object sender, TXTextControl.ImageEventArgs e) { GetSelectedObject(); }
private void TextControl_TextFrameRightClicked(object sender, TXTextControl.TextFrameEventArgs e) { GetSelectedObject(); ShowTextFrameContextMenu(); }
private void TextControl_ImageRightClicked(object sender, TXTextControl.ImageEventArgs e) { GetSelectedObject(); ShowImageContextMenu(); }
private void TextControl_TextFrameDeactivated(object sender, TXTextControl.TextFrameEventArgs e) { GetSelectedObject(); }
void SetObjectInsertionMode(TXTextControl.FrameBase obj, TXTextControl.FrameInsertionMode insMode) { if (obj == null) return; // If new insertion mode is "as character" discard previous insertion mode flags if (insMode == TXTextControl.FrameInsertionMode.AsCharacter) { obj.InsertionMode = insMode; return; } // Get current insertion mode flags TXTextControl.FrameInsertionMode insModeFlags = (obj.InsertionMode & (TXTextControl.FrameInsertionMode.FixedOnPage | TXTextControl.FrameInsertionMode.MoveWithText)); // If currently no insertion mode flags are set, set to "move with text" if (insModeFlags == (TXTextControl.FrameInsertionMode)0) { insModeFlags = TXTextControl.FrameInsertionMode.MoveWithText; } // Combine new insertion mode with current insertion mode flags obj.InsertionMode = insModeFlags | insMode; }
private void SetSelectedObjectInsertionMode(object mnuItem, TXTextControl.FrameInsertionMode insMode) { ToolStripMenuItem mi = mnuItem as ToolStripMenuItem; if ((mi == null) || mi.Checked) return; // Set new insertion mode SetObjectInsertionMode(_objSel, insMode); mi.Checked = true; }