jjzjj

PHPExcel_Shared_Drawing

全部标签

c# - 将 System.Windows.Media.ImageSource 转换为 System.Drawing.Bitmap

如何在C#中将System.Windows.Media.ImageSource转换为System.Drawing.Bitmap? 最佳答案 它是较旧的OP,但对于其他一些人来说仍然可以派上用场,因为在没有dll互操作或剪贴板hack的情况下找到更干净的解决方案需要一些时间。这对我有用,您可以在保存到文件或rtf流之前使用pngencoder来削减图像大小privateSystem.Drawing.ImageImageWpfToGDI(System.Windows.Media.ImageSourceimage){MemoryStrea

c# - Visual Studio : How to manage code shared between projects

这可能以前发布过,但我不确定要查找哪些搜索词!快速解释。我有几个项目之间共享的代码。此代码本身仍在进行中。问题是每当我需要更新此代码时,我不想重复3次,这将成为一场噩梦。有没有办法将它添加到项目中,而无需将其复制到项目文件夹中?即我希望共享类作为链接到我的3个项目中C:\coderepository\sharedclass.cs不是\eachproject\bin\sharedclass.cs我是否必须将其创建为自己的库项目?如果编译器可以将其编译为“外部”代码,那就更好了。干杯。 最佳答案 正如其他人所说,您只需在解决方案资源管理

c# - 如何创建从 System.Drawing.Bitmap 对象开始的 iTextSharp.text.Image 对象?

我是iTextSharp(iText的C#版本)的新手:我有这样的东西:System.Drawing.Bitmapbitmap=(System.Drawing.Bitmap)ChartHelper.GetPdfChart((int)currentVuln.UrgencyRating*10);iTextSharp.text.Imageimg=iTextSharp.text.Image.GetInstance(bitmap);vulnerabilityDetailsTable.AddCell(newPdfPCell(img){Border=PdfPCell.RIGHT_BORDER,Bor

c# - 从 System.Drawing.Image.RawFormat 获取 ImageFormat

此代码在尝试调用Image.Save(MemoryStream,ImageFormat)时失败。我得到异常:aValuecannotbenull.Parametername:encoder"ImageFormatformat=generatedImage.RawFormatasImageFormat;image.ImageData=generatedImage.Save(format);如果我直接传入ImageFormat对象,它会起作用,例如ImageFormat.Jpeg.将rawformat转换为ImageFormat的最佳方法是什么(最好不要使用switch语句或大量if语句)

c# - 在 AWS Lambda 上使用 System.Drawing.Common NuGet 包时无法加载 DLL 'libdl'

我们有一个缩略图生成器lambda函数,我正在尝试将其更新到.NETCore2.0,但在使用Microsoft的System.Drawing.CommonNuGet包时遇到以下错误:TypeInitializationExceptionThetypeinitializerfor'Gdip'threwanexception.atSystem.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32width,Int32height,Int32stride,Int32format,HandleRefscan0,IntPtr

c# - 如何将 System.Drawing.font 转换为 System.Windows.Media.Fonts 或 TypeFace?

如何将System.Drawing.Font转换为System.Windows.Media.Fonts或TypeFace?或者如何从System.Drawing.Font的实例生成System.Windows.Media.Fonts或TypeFace的实例? 最佳答案 你不能实例化Media.Fonts,但我认为你可以得到一个Media.FontFamily这就是我实现它的方法。usingSystem.Drawing;usingMedia=System.Windows.Media;Fontfont=newFont(newSystem

c# - 质量和压缩与 system.drawing.imaging 之间的区别?

我对ASP.NET中的图像处理完全陌生。我非常熟悉Photoshop,并且在某种程度上了解图像魔术。我试图找出质量和压缩之间的区别,因为其他应用倾向于将它们视为相同。对于system.drawing.imaging,有质量和压缩设置。http://msdn.microsoft.com/en-us/library/system.drawing.imaging.encoder.quality.aspx读取:“质量类别指定图像的压缩级别。”http://msdn.microsoft.com/en-us/library/bb882583.aspx阅读:“质量级别0对应最大压缩,质量级别100对

c# - 如何 XmlSerialize System.Drawing.Font 类

System.Drawing.Font类不是XML可序列化的,因为它没有默认(空)构造函数。尽管如此,是否有一些解决方法或替代方法来序列化Font? 最佳答案 编辑:我根据Regent更新了代码建议使用FontConverter,同时保留将SerializableFont用作常规Font的能力。publicclassSerializableFont{publicSerializableFont(){FontValue=null;}publicSerializableFont(Fontfont){FontValue=font;}[Xm

用make_shared防止复制构建

我有一个经理类,允许客户端通过两种方法添加组件:一个没有参数,即默认构造组件,而另一个则采用了rvalue(应允许客户端使用组件的自定义构造函数)。这是我想到的代码:templatestd::shared_ptrAddComponent(){returnAddComponent(TComponent{this});}templatestd::shared_ptrAddComponent(constTComponent&&obj){autoptr=std::make_shared(obj);vec.push_back(ptr);returnptr;}我的问题是std::make_shared始终

c# - 从 System.Drawing.Imaging.ImageFormat (C#) 获取扩展

对于任何给定的System.Drawing.Imaging.ImageFormat是否可以获得扩展?(C#)例子:System.Drawing.Imaging.ImageFormat.Tiff->.tifSystem.Drawing.Imaging.ImageFormat.Jpeg->.jpg...这可以作为查找表轻松完成,但想知道.Net中是否有任何内容。 最佳答案 我现在找到了3种方法来做到这一点,其中,最后2种是等效的。所有都是扩展方法,并打算以“.foo”的形式产生扩展staticclassImageFormatUtils{