本文整理汇总了C#中IDataObject.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IDataObject.ToString方法的具体用法?C# IDataObject.ToString怎么用?C# IDataObject.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataObject
的用法示例。
在下文中一共展示了IDataObject.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatEnumerator
public FormatEnumerator(IDataObject parent, string[] formats) {
Debug.WriteLineIf(CompModSwitches.DataObject.TraceVerbose, "FormatEnumerator: Constructed: " + parent.ToString() + ", string[]" + formats.Length.ToString(CultureInfo.InvariantCulture));
this.parent = parent;
this.formats.Clear();
string bitmap = DataFormats.Bitmap;
string emf = DataFormats.EnhancedMetafile;
string text = DataFormats.Text;
string unicode = DataFormats.UnicodeText;
string standard = DataFormats.StringFormat;
string str = DataFormats.StringFormat;
if (formats != null) {
DataObject dataObject = parent as DataObject;
if (dataObject != null && dataObject.RestrictedFormats) {
if (!Clipboard.IsFormatValid(formats)) {
throw new SecurityException(SR.GetString(SR.ClipboardSecurityException));
}
}
for (int i=0; i<formats.Length; i++) {
string format = formats[i];
FORMATETC temp = new FORMATETC();
temp.cfFormat = unchecked((short)(ushort)(DataFormats.GetFormat(format).Id));
temp.dwAspect = DVASPECT.DVASPECT_CONTENT;
temp.ptd = IntPtr.Zero;
temp.lindex = -1;
if (format.Equals(bitmap)) {
temp.tymed = TYMED.TYMED_GDI;
}
else if (format.Equals(emf)) {
temp.tymed = TYMED.TYMED_ENHMF;
}
else if (format.Equals(text)
|| format.Equals(unicode)
|| format.Equals(standard)
|| format.Equals(str)
|| format.Equals(DataFormats.Rtf)
|| format.Equals(DataFormats.CommaSeparatedValue)
|| format.Equals(DataFormats.FileDrop)
|| format.Equals(CF_DEPRECATED_FILENAME)
|| format.Equals(CF_DEPRECATED_FILENAMEW)) {
temp.tymed = TYMED.TYMED_HGLOBAL;
}
else {
temp.tymed = TYMED.TYMED_HGLOBAL;
}
if (temp.tymed != 0) {
this.formats.Add(temp);
}
}
}
}
示例2: SaveObject
private int SaveObject(IDataObject instance)
{
Console.Write(string.Format(" Creating {0}", instance.ToString()));
Session.Save(instance);
Console.WriteLine(string.Format(": {0}", instance.Id));
return instance.Id;
}
示例3: DeleteObject
private void DeleteObject(IDataObject instance)
{
Console.WriteLine(string.Format(" Deleting {0}: {1}", instance.ToString(),
instance.Id));
Session.Delete(instance);
}