当前位置: 首页>>代码示例>>C#>>正文


C# Altaxo.SetData方法代码示例

本文整理汇总了C#中Altaxo.SetData方法的典型用法代码示例。如果您正苦于以下问题:C# Altaxo.SetData方法的具体用法?C# Altaxo.SetData怎么用?C# Altaxo.SetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Altaxo的用法示例。


在下文中一共展示了Altaxo.SetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteAsciiToClipBoardIfOnlyPropertyCellsSelected

		/// <summary>
		/// Writes ASCII to the clipboard if only property cells are selected.
		/// </summary>
		/// <param name="dg">The worksheet controller</param>
		/// <param name="dao">The clipboard data object</param>
		protected static void WriteAsciiToClipBoardIfOnlyPropertyCellsSelected(IWorksheetController dg, Altaxo.Gui.IClipboardSetDataObject dao)
		{
			// columns are selected
			DataTable dt = dg.DataTable;
			Altaxo.Collections.AscendingIntegerCollection selCols = dg.SelectedPropertyColumns;
			Altaxo.Collections.AscendingIntegerCollection selRows = dg.SelectedPropertyRows;
			if (selRows.Count == 0)
			{
				selRows = new Altaxo.Collections.AscendingIntegerCollection();
				selRows.AddRange(0, dg.DataTable.PropertyRowCount);
			}

			System.IO.StringWriter str = new System.IO.StringWriter();
			for (int i = 0; i < selRows.Count; i++)
			{
				for (int j = 0; j < selCols.Count; j++)
				{
					str.Write(dt.PropertyColumns[selCols[j]][selRows[i]].ToString());
					if (j < selCols.Count - 1)
						str.Write(";");
					else
						str.WriteLine();
				}
			}
			dao.SetCommaSeparatedValues(str.ToString());

			// now also as tab separated text
			System.IO.StringWriter sw = new System.IO.StringWriter();

			for (int i = 0; i < selRows.Count; i++)
			{
				for (int j = 0; j < selCols.Count; j++)
				{
					sw.Write(dt.PropertyColumns[selCols[j]][selRows[i]].ToString());
					if (j < selCols.Count - 1)
						sw.Write("\t");
					else
						sw.WriteLine();
				}
			}
			dao.SetData(typeof(string), sw.ToString());
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:47,代码来源:EditCommands.cs

示例2: WriteAsciiToClipBoardIfDataCellsSelected

		/// <summary>
		/// Writes ASCII to the clipboard if data cells are selected.
		/// </summary>
		/// <param name="dt">The data table.</param>
		/// <param name="selCols">Selected data columns.</param>
		/// <param name="selRows">Selected data rows.</param>
		/// <param name="selPropCols">Selected property columns.</param>
		/// <param name="dao">The clipboard data object</param>
		public static void WriteAsciiToClipBoardIfDataCellsSelected(
			DataTable dt,
			Altaxo.Collections.AscendingIntegerCollection selCols,
			Altaxo.Collections.AscendingIntegerCollection selRows,
			Altaxo.Collections.AscendingIntegerCollection selPropCols,
			Altaxo.Gui.IClipboardSetDataObject dao)
		{
			if (selCols.Count == 0)
			{
				selCols = new Altaxo.Collections.AscendingIntegerCollection();
				selCols.AddRange(0, dt.DataColumnCount);
			}

			if (selRows.Count == 0)
			{
				selRows = new Altaxo.Collections.AscendingIntegerCollection();
				int nRows = 0; // count the rows since they are maybe less than in the hole worksheet
				for (int i = 0; i < selCols.Count; i++)
				{
					nRows = System.Math.Max(nRows, dt[selCols[i]].Count);
				}
				selRows.AddRange(0, nRows);
			}

			System.IO.StringWriter str = new System.IO.StringWriter();
			for (int i = 0; i < selPropCols.Count; i++)
			{
				for (int j = 0; j < selCols.Count; j++)
				{
					str.Write(dt.PropertyColumns[selPropCols[i]][selCols[j]].ToString());
					if (j < selCols.Count - 1)
						str.Write(";");
					else
						str.WriteLine();
				}
			}

			for (int i = 0; i < selRows.Count; i++)
			{
				for (int j = 0; j < selCols.Count; j++)
				{
					str.Write(dt.DataColumns[selCols[j]][selRows[i]].ToString());
					if (j < selCols.Count - 1)
						str.Write(";");
					else
						str.WriteLine();
				}
			}
			dao.SetCommaSeparatedValues(str.ToString());

			// now also as tab separated text
			System.IO.StringWriter sw = new System.IO.StringWriter();

			for (int i = 0; i < selPropCols.Count; i++)
			{
				for (int j = 0; j < selCols.Count; j++)
				{
					str.Write(dt.PropertyColumns[selPropCols[i]][selCols[j]].ToString());
					if (j < selCols.Count - 1)
						str.Write("\t");
					else
						str.WriteLine();
				}
			}
			for (int i = 0; i < selRows.Count; i++)
			{
				for (int j = 0; j < selCols.Count; j++)
				{
					sw.Write(dt.DataColumns[selCols[j]][selRows[i]].ToString());
					if (j < selCols.Count - 1)
						sw.Write("\t");
					else
						sw.WriteLine();
				}
			}
			dao.SetData(typeof(string), sw.ToString());
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:85,代码来源:EditCommands.cs


注:本文中的Altaxo.SetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。