Questions tagged [system.drawing]

System.Drawing is a namespace of the .NET framework. It provides access to GDI+ basic graphics functionality.

System.Drawing is a namespace of the .NET framework. It provides access to GDI+ basic graphics functionality.

Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. For a supported alternative, see Windows Imaging Components.

References

1129 questions
21
votes
2 answers

how to draw a line on a image?

i want to draw a line on a bmp image which is pass into a method using drawline method in C# public void DrawLineInt(Bitmap bmp) { Pen blackPen = new Pen(Color.Black, 3); int x1 = 100; int y1 = 100; int x2 = 500; int y2 = 100; // Draw line to…
user1150071
  • 285
  • 1
  • 2
  • 9
20
votes
1 answer

Outline text with System.Drawing?

I have the following code. Is there an easy way to put an outline on the text I am writing? var imageEncoder = Encoder.Quality; var imageEncoderParameters = new EncoderParameters(1); imageEncoderParameters.Param[0] = new…
Brian David Berman
  • 7,514
  • 26
  • 77
  • 144
20
votes
3 answers

How to set multiple FontStyles when instantiating a font?

In looking at the constructors for the System.Drawing.Font class there is a parameter to pass in one of the FontStyles defined in the System.Drawing.FontStyle enum. ie. Bold Italic Regular Underline and there are boolean properties…
etoisarobot
  • 7,684
  • 15
  • 54
  • 83
20
votes
3 answers

Compare two Color objects

This is VS2010 and .NET 4.0. I'm trying to compare two System.Drawing.Color objects. The value of mStartColor.ToArgb() is 16777215. The value of Color.Transparent.ToArgb() is 16777215. The value of mStartColor <> Color.Transparent is True. How is…
dotNET
  • 33,414
  • 24
  • 162
  • 251
19
votes
6 answers

Capture screen on server desktop session

I have developed a GUI test framework that does integrationtesting of our company website on a scheduled basis. When something fails, it'll take a screenshot of the desktop, among other things. This runs unattended on a logged in user on a dedicated…
Silas Hansen
  • 1,669
  • 2
  • 17
  • 23
19
votes
5 answers

Dynamically resizing font to fit space while using Graphics.DrawString

Does anyone have a tip whereas you could dynamically resize a font to fit a specific area? For example, I have an 800x110 rectangle and I want to fill it with the max size font that would support the entire string I'm trying to display. Bitmap…
farina
  • 3,486
  • 6
  • 32
  • 44
18
votes
1 answer

Heatmap style gradients in .NET

I am trying to create a heat map with gradients that look similar to this: This image shows three points and the gradients blend nicely together. Here is what I am currently doing in my drawing function: public void DrawGradient(int x, int y,…
Jon Kump
  • 574
  • 7
  • 19
18
votes
2 answers

How to avoid bitmap out of memory when working on very large image for ie: 10.000.000 pixel and above

Currently i'm working on a system that load a very large image, with minimum width x heigh >= 10.000.000 pixel. But the ratio of the user's upload image usually do not match our requirement ratio so i have to crop it to proper ratio, but when using…
thinh.lam
  • 288
  • 4
  • 10
18
votes
1 answer

Can't reference system.drawing.dll

i'm trying to resize images with ImageResizer, but keep getting a compilation error "Error 1 The type 'System.Drawing.Bitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing" Searching…
KristianMedK
  • 1,659
  • 6
  • 24
  • 52
17
votes
5 answers

System.Drawing in Windows or ASP.NET services

According to MSDN, it is not a particularly good idea to use classes within the System.Drawing namespace in a Windows Service or ASP.NET Service. Now I am developing a class library which might need to access this particular namespace (for measuring…
Tamas Czinege
  • 118,853
  • 40
  • 150
  • 176
16
votes
1 answer

Screen capture with C# and Remote Desktop problems

I have a C sharp console application that captures a screenshot of a MS Word document several times. It works great, but when I place this application on a remote windows XP machine it works fine whilst I am remoted in i.e. my remote desktop is…
Kay
  • 845
  • 7
  • 21
  • 33
16
votes
3 answers

How to open a multi-frame TIFF imageformat image in .NET 2.0?

Image.FromFile(@"path\filename.tif") or Image.FromStream(memoryStream) both produce image objects with only one frame even though the source is a multi-frame TIFF file. How do you load an image file that retains these frames? The tiffs are saved…
mirezus
  • 13,892
  • 11
  • 37
  • 42
16
votes
3 answers

OutOfMemoryException: Out of memory - System.Drawing.Graphics.FromImage

I get Out of Memory exception when using System.Drawing.Graphics.FromImage (using latest versions of .NET software on Windows 2012 server), ONLY on a very few specific image files. Most of the time the code works fine. Typical answers to above…
Mike
  • 214
  • 1
  • 3
  • 13
16
votes
3 answers

Silverlight 4.0: How to convert byte[] to image?

public Image Base64ToImage(string base64String) { // Convert Base64 String to byte[] byte[] imageBytes = Convert.FromBase64String(base64String); MemoryStream ms = new MemoryStream(imageBytes, 0, …
xscape
  • 3,318
  • 9
  • 45
  • 86
16
votes
1 answer

Can I "draw"/create an image with a given text with powershell?

I just wondered if it would be possible to create a small, simple jpg, png, gif with a given Text in powershell: e.g: a small square, 250px × 61px, yellow background and black text on it: "Test" Can I do this with "System.Drawing.Image"? Thanks
icnivad
  • 2,231
  • 8
  • 29
  • 35
1
2
3
75 76