本文整理汇总了C#中DataObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.GetType方法的具体用法?C# DataObject.GetType怎么用?C# DataObject.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertMyDataObject
public void InsertMyDataObject(DataObject dobj)
{
if (dobj == null)
return;
//-----------------------
ILockBytes pLockBytes;
int sc = CreateILockBytesOnHGlobal(IntPtr.Zero, true, out pLockBytes);
IStorage pStorage;
sc = StgCreateDocfileOnILockBytes(pLockBytes, (uint)(STGM.STGM_SHARE_EXCLUSIVE | STGM.STGM_CREATE | STGM.STGM_READWRITE), 0, out pStorage);
IOleClientSite pOleClientSite;
this.IRichEditOle.GetClientSite(out pOleClientSite);
//-----------------------
Guid guid = Marshal.GenerateGuidForType(dobj.GetType());
Guid IID_IOleObject = new Guid("{00000112-0000-0000-C000-000000000046}");
Guid IID_IDataObject = new Guid("{0000010e-0000-0000-C000-000000000046}");
Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}");
object pOleObject;
int hr = OleCreateStaticFromData(dobj, ref IID_IOleObject, (uint)OLERENDER.OLERENDER_FORMAT, ref dobj.mpFormatetc, pOleClientSite, pStorage, out pOleObject);
if (pOleObject == null)
return;
//-----------------------
//-----------------------
OleSetContainedObject(pOleObject, true);
REOBJECT reoObject = new REOBJECT();
reoObject.cp = this._richEdit.TextLength;
reoObject.clsid = guid;
reoObject.pstg = pStorage;
reoObject.poleobj = Marshal.GetIUnknownForObject(pOleObject);
reoObject.polesite = pOleClientSite;
reoObject.dvAspect = (uint)(DVASPECT.DVASPECT_CONTENT);
reoObject.dwFlags = (uint)(REOOBJECTFLAGS.REO_BELOWBASELINE | REOOBJECTFLAGS.REO_RESIZABLE);
reoObject.dwUser = 0;
this.IRichEditOle.InsertObject(reoObject);
//-----------------------
//-----------------------
Marshal.ReleaseComObject(pLockBytes);
Marshal.ReleaseComObject(pOleClientSite);
Marshal.ReleaseComObject(pStorage);
Marshal.ReleaseComObject(pOleObject);
//-----------------------
}
示例2: NHValidationRuleCollection
public NHValidationRuleCollection(DataObject parent)
{
validator = new NHibernate.Validator.Engine.ClassValidator(parent.GetType());
_parent = parent;
parent.PropertyChanged += parent_PropertyChanged;
}