gdi+

GDI+ A generic error … Attempting to save file

天大地大妈咪最大 提交于 2019-12-14 03:58:41
问题 I've been learning quite a bit from everyone here, however I've come across a problem which I'm having trouble finding an answer to. While attempting to save an image which has been uploaded using AsyncFileUpload I'm receiving the following error: A generic error occurred in GDI+. I've done quite a bit of Googling and it seems that the most likely issue is permissions related. I've tried allowing write/modify for Network and Network_Serice. Later attempted allowing it for the environment user

Fastest way to draw an overlay on an image in windows forms

荒凉一梦 提交于 2019-12-14 03:58:06
问题 What is the fastest way to draw an on an image in .net? I'm trying to draw an image on top of another image that have in a windows form control. I know that when I try to draw it directly using loops it takes an Eon. Options I have heard tossed around are GDI+, Direct Draw, or DX10. I start with a bitmap of a fixed size and after applying 3+ overlays, layers, to it before it is assigned to a form object. Thanks, 回答1: If your overlays are images (perhaps PNG images with transparency), then the

Convert a 24 bit in memory image to indexed color

空扰寡人 提交于 2019-12-14 02:12:42
问题 I have an image that I have created in memory as Format24bppRgb. I save this as a PNG and it is 24kb. If I save the same image with photoshop as a 24bit PNG it comes to about the same size, but if i save it as an 8bit PNG with only 32 colors it goes down to 5kb. How can I create an indexed version of a PNG file using C# / GDI+ / System.Drawing ? I'm having a hard time finding any answers to this question that don't just apply to grayscale images or require an external library. is it not

Draw the shape on the Button click

我只是一个虾纸丫 提交于 2019-12-13 23:07:29
问题 I create a Windows Forms application and I want to draw a shape on the Button click. How can I call Form_Paint on the Button_Click event? 回答1: Here's a quick example that stores each "shape" as a GraphicsPath in a class level List. Each path is drawn using the supplied Graphics in the Paint() event of the form. A random rectangle is added to the List<> with each button click and Refresh() is called against the form to force it to redraw itself: public partial class Form1 : Form { public Form1

How initialize Direct2D renderer into GDI context from managed code for older version of .NET Framework

有些话、适合烂在心里 提交于 2019-12-13 20:19:31
问题 Given a legacy desktop application in Windows Form , managed code (a mix of C# and VB projects) running on .NET Framework 3.5 (which can't be migrated to newer .NET for reasons beyond the scope of this question), how GRADUALLY transition the code from GDI+ to Direct2D ? Or possibly to Direct3D? Another constraint is that the resulting application work on Windows 7 , but we will migrate to Windows 8 or Windows 10 if that is the only way to get this to work. (The impetus is bugs in GDI+

GDI+ generic error : memory leak using VB.NET

北城以北 提交于 2019-12-13 19:15:14
问题 I got a memory leak problem with my code, using images with VB.NET and WPF. Even if I dispose my bitmap objects, the memory doesn't stop growing. Here is my code Dim imageB As New ImageBrush imageB.ImageSource = Me.GetImageSource(My.Resources.checkImage) My.Resources.checkImage.Dispose() Me.mainCanvas.Background = imageB and here is the method GetImageSource(): Public Function GetImageSource(ByVal bmp As System.Drawing.Bitmap) As ImageSource Dim imageSource As BitmapSource Dim hbitmap As

Resizing a Rectangle while dragging on Windows Form

拜拜、爱过 提交于 2019-12-13 16:14:50
问题 I have a Rectangle Drawn on top of my Windows Form and I want to resize it using one of the handles provided ! Rectangle areaRect = new Rectangle(100,100, 300, 300); Bool dragging = false; Point ptOld = new Point(0, 0); protected override void OnPaint(PaintEventArgs e) { Graphics dcPaint = e.Graphics; dcPaint.DrawRectangle(rectPen, areaRect); } protected override void OnMouseDown(MouseEventArgs e) { ptOld = new Point(e.X, e.Y); dragging = true; } protected override void OnMouseMove

Add accent marks with custom colors in .Net's RichTextBox

 ̄綄美尐妖づ 提交于 2019-12-13 15:25:35
问题 Using the Text property of a WinForms' RichTextBox, you can show a letter with an accent above it, in a way that the letter is one character, and the accent is another one. I.e., also visually it looks like one character, it actually consists of two. In Unicode terms, the letter is called a 'base character', while the accent is called 'combining diacritical mark'. I have tried to show a normal black letter with an accent in different color above it (lets say red). Here is the code in VB: 'Box

GDI - How to create and fill bitmap?

允我心安 提交于 2019-12-13 07:15:11
问题 Someone can give me short explanation how to create bitmap runtime using GDI/GDI+ and to fill it with color ? Thanks in advance. 回答1: CreateBitmap , CreateCompatibleBitmap or CreateDIBSection (in case you want access to raw underlying data bits) CreateCompatibleDC SelectObject the bitmap into created device context FillRect or friends on the device context, and the painting takes place on your selected bitmap (there are options there: standard brushes for black and white, having RGB on hands

C# GDI+ generic error / external exception after saving multiple images

点点圈 提交于 2019-12-13 00:41:54
问题 I have a little console application in C# that takes a pair of pictures from a folder (containing a few hundred images) in .jpg-format, merges them to one picture and stores the result as .tif in another folder. This process is repeated for all pictures in the source folder. It works fine for a few loop iterations, but then I get an unhandled external exception with an GDI+ generic error (the inner exception is null) when trying to save the result. As I create new files for storing and as it