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


C# DataObject.GetType方法代码示例

本文整理汇总了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);
            //-----------------------
        }
开发者ID:minhnguyen31093,项目名称:Reminiscent,代码行数:56,代码来源:ExtendedRichTextBox.cs

示例2: NHValidationRuleCollection

 public NHValidationRuleCollection(DataObject parent)
 {
     validator = new NHibernate.Validator.Engine.ClassValidator(parent.GetType());
     _parent = parent;
     parent.PropertyChanged += parent_PropertyChanged;
 }
开发者ID:brendankowitz,项目名称:systembusinessobjects,代码行数:6,代码来源:NHValidationRuleCollection.cs


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