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


C# Metafile.Clone方法代码示例

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


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

示例1: GetImageFromParams

        private static Image GetImageFromParams(object pict, IntPtr handle, int pictype, IntPtr paletteHandle, int width,
		                                        int height)
        {
            switch (pictype)
            {
                case -1:
                    return null;

                case 0:
                    return null;

                case 1:
                    return Image.FromHbitmap(handle, paletteHandle);

                case 2:
                    {
                        var wmfHeader = new WmfPlaceableFileHeader();
                        wmfHeader.BboxRight = (short) width;
                        wmfHeader.BboxBottom = (short) height;
                        var metafile = new Metafile(handle, wmfHeader, false);
                        return (Image) RuntimeHelpers.GetObjectValue(metafile.Clone());
                    }
                case 4:
                    {
                        var metafile2 = new Metafile(handle, false);
                        return (Image) RuntimeHelpers.GetObjectValue(metafile2.Clone());
                    }
            }
            throw new Exception("AXUnknownImage");
        }
开发者ID:baens,项目名称:Esri2011,代码行数:30,代码来源:BitmapUtil.cs

示例2: Metafile_String

		public void Metafile_String ()
		{
			string filename = getInFile (WmfPlaceable);
			Metafile mf = new Metafile (filename);
			Metafile clone = (Metafile) mf.Clone ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:MetafileTest.cs

示例3: TryPasteEnhancedMetafile

        //*************************************************************************
        //  Method: TryPasteEnhancedMetafile()
        //
        /// <summary>
        /// Attempts to paste an enhanced metafile from the clipboard into the
        /// PictureBox.
        /// </summary>
        ///
        /// <returns>
        /// true if an enhanced metafile was pasted into the PictureBox.
        /// </returns>
        ///
        /// <remarks>
        /// If the clipboard contains an enhanced metafile, this method pastes it
        /// into the PictureBox and returns true.  Otherwise, false is returned.
        /// </remarks>
        //*************************************************************************
        public Boolean TryPasteEnhancedMetafile()
        {
            // This interop code was adapted from the following post:
            //
            // http://www.eggheadcafe.com/community/aspnet/12/10018506/
            // how-to-paste--metafile-fr.aspx
            //
            // NOTE: Do not try this non-interop technique:
            //
            //     Object oData = Clipboard.GetData(DataFormats.EnhancedMetafile);
            //
            //     if (oData != null)
            //     {
            //         System.Drawing.Imaging.Metafile oMetafile =
            //             (System.Drawing.Imaging.Metafile)oData;
            //     }
            //
            // When pasting from a chart image copied from Excel, the GetData()
            // call crashes Excel.  Although the Clipboard class reports that the
            // DataFormats.EnhancedMetafile format is available (along with
            // "Preferred DropEffect", "InShellDragLoop", and "MetaFilePict"), it
            // does not seem to be the format that the .NET Framework is expecting.
            // Using the interop technique below works properly, however.

            Boolean bReturn = false;

            if ( OpenClipboard(this.Handle) )
            {
            if ( IsClipboardFormatAvailable(CF_ENHMETAFILE) )
            {
                IntPtr oPtr = GetClipboardData(CF_ENHMETAFILE);

                if ( !oPtr.Equals( new IntPtr(0) ) )
                {
                    Metafile oMetafile = new Metafile(oPtr, true);

                    this.Image = (Metafile)oMetafile.Clone();
                    bReturn = true;
                }
            }

            CloseClipboard();
            }

            return (bReturn);
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:63,代码来源:PictureBoxPlus.cs


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