Exemple #1
0
		/// <summary>
		/// Copies the current selection of items to the clipboard.
		/// </summary>
		/// <param name="copy">true if you want data to remain on the Clipboard after this application exits; otherwise, false.</param>
		/// <param name="groups">true to copy item groups; otherwise, false.</param>
		/// <returns>true if items were successfully copied; otherwise, false.</returns>
		public bool CopyToClipboard(bool copy, bool groups)
		{
			bool result = false;

			// create clones of selected items
			ItemsAndGroups data = copySelection(this, true, groups);
			if (data == null) return false;

			// add the clones to an empty flowchart document
			FlowChart clipHelper = new FlowChart();
			if (pasteSelection(clipHelper, data, null, 0, 0))
			{
				// save the clones into a memory stream
				MemoryStream stream = new MemoryStream(40960);
				clipHelper.SaveToStream(stream, true);

				// copy the memory stream to clipboard
				Clipboard.SetDataObject(stream, copy);

				result = true;
			}
			clipHelper.Dispose();

			return result;
		}
Exemple #2
0
		/// <summary>
		/// Creates the image list with shape images using
		/// the current control settings.
		/// </summary>
		private void CreateImages()
		{
			this.ImageList = null;

			// Create the image list
			images = new ImageList();
			images.ImageSize = imageSize;
			images.TransparentColor = SystemColors.Control;

			// Create a temporary hidden flowchart object
			FlowChart chart = new FlowChart();
			chart.MeasureUnit = GraphicsUnit.Pixel;
			chart.DrawBox += this.DrawBox;

			System.Drawing.Brush back =
				new System.Drawing.SolidBrush(SystemColors.Control);

			// Populate the image list
			if (shapes == null || shapes.Length == 0)
			{
				// show all shapes
				foreach (ShapeTemplate template in ShapeTemplate.Shapes)
					createImage(template, back, chart);
			}
			else
			{
				// show specified shapes
				foreach (string id in shapes)
					createImage(ShapeTemplate.FromId(id), back, chart);
			}

			back.Dispose();
			chart.Dispose();
		}