public string KeyValueToString(string key, int indentLevel, PrintStyle style) { string output = ""; IPBXProjExpression value; if (!TryGetValue(key, out value)) { return(output); } string preComment = GetPreCommentForKey(key); if (!string.IsNullOrEmpty(preComment)) { output += "\n" + preComment + "\n"; } string tabs = ""; for (int ii = 0; ii < indentLevel; ++ii) { tabs += "\t"; } output += tabs + key; string keyComment = GetCommentForKey(key); if (!string.IsNullOrEmpty(keyComment)) { output += " " + keyComment; } output += " = "; switch (style) { case PrintStyle.Indented: output += IndentedEntry(value, indentLevel); break; case PrintStyle.Inline: default: output += InlineEntry(value); break; } output += ";\n"; string postComment = GetPostCommentForKey(key); if (!string.IsNullOrEmpty(postComment)) { output += postComment + "\n"; } return(output); }
/// <summary> /// Is this PrintheadType compatible with the argument PrintStyle? /// </summary> /// <param name="printStyle"></param> /// <returns></returns> public bool IsPrintStylePossible(PrintStyle printStyle) { foreach (PrintStyle possiblePrintStyle in _possiblePrintStylesList) { if (possiblePrintStyle == printStyle) { return(true); } } return(false); }
public void GetPrintStyle() { PrintStyle ps = ConvertUtil.GetPrintStyle("1", "1"); Assert.IsTrue(ps.IsBrifeStyle); Assert.IsTrue(ps.IsPrintInLast); ps = ConvertUtil.GetPrintStyle("", ""); Assert.False(ps.IsBrifeStyle); Assert.False(ps.IsPrintInLast); ps = ConvertUtil.GetPrintStyle("0", "0"); Assert.False(ps.IsBrifeStyle); Assert.False(ps.IsPrintInLast); }
// השיטה הנכונה static void PrintArray(int[] arr, PrintStyle printStyle) { for (int i = 0; i < arr.Length; i++) { switch (printStyle) { case PrintStyle.Space: Console.Write(arr[i] + " "); break; case PrintStyle.Tab: Console.Write(arr[i] + "\t"); break; case PrintStyle.Enter: Console.WriteLine(arr[i]); break; } } Console.WriteLine(); }
/// <summary> /// Thread safe printing call. /// </summary> /// <param name="Message">The message to print</param> /// <param name="Style">The style enum to indicate how to print</param> /// <param name="SuppressCrLf">If true, the string will be printed without a trailing cr+lf</param> private void PrintOutput(string Message, PrintStyle Style = PrintStyle.Normal, bool SuppressCrLf = false) { if (Output.InvokeRequired) { Output.Invoke(new Printer(PrintOutput), new object[] { Message, Style, SuppressCrLf }); } else { Color color; switch (Style) { case PrintStyle.Instruction: color = Color.Black; break; case PrintStyle.GalilData: color = Color.Green; break; case PrintStyle.Normal: color = Color.Blue; break; case PrintStyle.Err: color = Color.Red; break; case PrintStyle.GclibData: color = Color.Magenta; break; default: color = Color.Blue; break; }//switch Output.SelectionStart = Output.Text.Length; Output.SelectionColor = color; Output.AppendText(Message); if (!SuppressCrLf) { Output.AppendText("\r\n"); } }//invoke check }
/// <summary> /// Initializes a new instance of the <see cref="PrintOptionsForm"/> form. /// </summary> /// <param name="info">The <see cref="PrintInfo"/> object.</param> /// <param name="defaultStyle">The <see cref="PrintStyle"/> object which should be selected initially.</param> /// <param name="printContext">The <see cref="PrintContextType"/> value, determining the filter of styles which should be shown in a form.</param> public PrintOptionsDialog(PrintInfo info, PrintStyle defaultStyle, PrintContextType printContext) { InitializeComponent(); _context = printContext; _info = info; foreach (PrintStyle ps in _info.PrintStyles) { if ((_context & ps.Context) != 0) { lstStyles.Items.Add(ps); } } if (defaultStyle != null && lstStyles.Items.Count > 0) { lstStyles.SelectedItem = defaultStyle; } _hidePrivateAppointmentsInitial = HidePrivateAppointments = _info.HidePrivateAppointments; }
public PendingMessage(object message, PrintStyle printStyle, Object sender) { this.printStyle = printStyle; this.message = message; this.sender = sender; }
public PendingMessage(object message, PrintStyle printStyle) { this.printStyle = printStyle; this.message = message; sender = null; }
public byte[] SetPrintStyle(PrintStyle style) { return(new[] { AsciiTable.ESC, AsciiTable.EXCLAMATION_MARK, (byte)style }); }
/// <summary> /// Sends the specified printing style to the printer. /// </summary> /// <param name="style">The <see cref="PrintStyle"/> object to print.</param> public void Print(PrintStyle style) { Print(style, _schedule.VisibleDates[0], _schedule.VisibleDates[_schedule.VisibleDates.Count - 1]); }
/// <summary> /// 设置打印样式 /// </summary> /// <param name="style">打印样式</param> public byte[] Styles(PrintStyle style) => new[] { ASCIIControlConst.ESC, CommandConst.Chars.StyleMode, style.ToByte() };
/// <summary> /// Sends the specified printing style to the printer. /// </summary> /// <param name="style">The <see cref="PrintStyle"/> object to print.</param> /// <param name="start">The <see cref="DateTime"/> value specifying the beginning of the print range.</param> /// <param name="end">The <see cref="DateTime"/> value specifying the end of the print range.</param> public void Print(PrintStyle style, DateTime start, DateTime end) { if (style != null) { SetupPrintContext(style, start, end); InternalPrint(); } }
/// <summary> /// Opens a separate application window in which end users can preview /// the output that would be generated by the print operation. /// </summary> /// <param name="style">The <see cref="PrintStyle"/> object to preview.</param> /// <param name="start">The <see cref="DateTime"/> value specifying the beginning of the print range.</param> /// <param name="end">The <see cref="DateTime"/> value specifying the end of the print range.</param> public void Preview(PrintStyle style, DateTime start, DateTime end) { if (style != null) { SetupPrintContext(style, start, end); PreviewCurrentStyle(); } }
/* Character Commands */ public virtual byte[] SetStyles(PrintStyle style) => new byte[] { Cmd.ESC, Chars.StyleMode, (byte)style };
/// <summary> /// 设置打印样式 /// </summary> /// <param name="style">打印样式</param> public TPrinter Styles(PrintStyle style) => Write(Command.Style.Styles(style));
/* Character Commands */ public byte[] SetStyles(PrintStyle style) { return(new[] { Cmd.ESC, Chars.StyleMode, (byte)style }); }
// load specified PrintStyle into the PrintDocument control and initialize date range internal void SetupPrintContext(PrintStyle style, DateTime start, DateTime end) { LoadStyle(style); style.SetDateRangeTags(PrintDocument, start, end); }
public DirectPrinter SetStyles(PrintStyle style) { UpdateBuffer(this.Emitter.SetStyles(style)); return(this); }
public void printTextBox1(string a, PrintStyle printStyle = PrintStyle.Normal) { PrintOutput(textBox1, a, printStyle, true); }
public static void Print(this Tree tree, PrintStyle printStyle) // дерево может не вместиться в консоль, тогда будет ошибка { if (tree.Root == null) { Console.WriteLine("tree is empty"); return; } var nodes = new Queue <TreeNode>(); nodes.Enqueue(tree.Root); List <List <TreeNode> > levels = new List <List <TreeNode> >(); int height = 0; int width = 1; while (true) { var isEnd = true; levels.Add(new List <TreeNode>()); for (int i = 0; i < width; i++) { var current = nodes.Dequeue(); if (current == null) { nodes.Enqueue(null); nodes.Enqueue(null); levels[height].Add(null); continue; } else { levels[height].Add(current); if (current.Left != null) { nodes.Enqueue(current.Left); isEnd = false; } else { nodes.Enqueue(null); } if (current.Right != null) { nodes.Enqueue(current.Right); isEnd = false; } else { nodes.Enqueue(null); } } } width *= 2; height++; if (isEnd) { break; } } //Console.Clear(); if (printStyle == PrintStyle.Horisontal) { PrintHorisontal(tree, height, levels); } else if (printStyle == PrintStyle.Vertical) { PrintVertical(tree, height, levels); } else if (printStyle == PrintStyle.Simple) { PrintSimple(tree, height, levels); } else if (height < 5) { PrintHorisontal(tree, height, levels); } else if (height < 8) { PrintVertical(tree, height, levels); } else { PrintSimple(tree, height, levels); } }
/// <summary> /// Loads style definition to C1PrintDocument control. /// </summary> /// <param name="style">The <see cref="PrintStyle"/> for loading into print document object.</param> public void LoadStyle(PrintStyle style) { if (style.Load(PrintDocument)) { CurrentStyle = style; AddScheduleReferences(); } }