Questions tagged [system.drawing.graphics]
33 questions
3
votes
1 answer
C# add custom font by ttf
I use System.Drawing.Graphics to draw some text.
I want to add custom font for that.
In this case I have to create System.Drawing.Font.
How can I create System.Drawing.Font by using *.ttf file with custom font?

Dmitry
- 477
- 6
- 20
2
votes
1 answer
How to convert System.Drawing.Image to Microsoft.Maui.Controls.Image?
I'm using a library (spire.pdf) to extract images from a PDF file that I ask from the user.
The library returns me an array of System.Drawing.Image and I'm currently trying to figure out how to convert those to Microsoft.Maui.Controls.Image
First,…

Opi
- 183
- 2
- 12
2
votes
1 answer
Image size issue while taking a screenshot of the secondary monitor
I am trying to save a screenshot of the second monitor which has a different resolution/DPI than the primary monitor (I am not totally familiar with these terminologies so I am not very sure), this is the code that I am using:
public void…

Mohammad Ahmad
- 192
- 2
- 12
2
votes
1 answer
f# timer event graphics.LineDraw not updating form
Being new to F#, I'm trying to understand how to make graphic updates in a Form triggered by timer events.
My expectation was that the below simple routine should continue drawing new "random" lines every second.
Calling line() outside the timer…

INW
- 23
- 3
2
votes
1 answer
System.Drawing.Graphics, to draw tables?
Does anyone have any examples of using this System.Drawing.Graphics library to draw tables using DrawRectangle or DrawRectangles or any other method?
I'm trying to set up here with DrawRectangle, but it's difficult, it takes too long to do something…

Vilmar Oliveira
- 117
- 1
- 7
2
votes
2 answers
A generic error occurred in GDI+ when saving Image
I read the answer for the same question and did whatever is asked to do. I also gave the write permission to the folder for current user as mentioned in one of the previous answer but still getting this error. So Please can anyone provide me the…

Naved Ansari
- 650
- 2
- 13
- 31
1
vote
1 answer
How to convert Graphic was drawn to byte[] array in C# (byte[] will also include drawings)
I want convert Graphic was drawn to byte[] array. This code will show everybody my ideas.
Graphics newGraphics = Graphics.FromImage(image);
// Draw it
Random rnd = new Random();
Color randomColor =…

Edward Ha
- 19
- 5
1
vote
0 answers
C# 2D Drawing custom style of lines and curves
I build an application which part is also drawing into video frames. For this I am using Graphics library from System.Drawing. Drawing is working fine and is already implemented. But I also need to be able to draw straight lines with for example…

Scourrge
- 83
- 7
1
vote
0 answers
Unstable line thickness using System.Drawing.Graphics
I'm trying to draw straight vertical lines with pen width of 1. The following method draws vertical grid lines of a line chart.
public override void DrawGridLines(GDIGraphics graphics, Rectangle plotArea)
{
using (Pen pen = new…

Paviel Kraskoŭski
- 1,429
- 9
- 16
1
vote
0 answers
Infragistics controls occasionally don't render
Got a strange problem with Infragistics controls.
For the most part they work fine, but every now and again, one will fail to render at runtime and I'll see the control on the form with a Red Cross through it. The latest example is where the…

Rob Small
- 33
- 3
1
vote
0 answers
Get the pixels, which are going to be drawn by System.Drawing.Graphics
In stead of directly drawing on the screen, I first want to get the pixels which are going to get drawn. Before the drawing, I want to do something with them. So, how can I get an array of those pixels? Will I have to write my own algorithms?
I am…

AlexSavAlexandrov
- 858
- 2
- 13
- 34
1
vote
0 answers
WebBrowser Control .DrawToBitmap is printing blank white page
In my windows form I have a web page and I want to print the contents of it , either way, direct print to printer or saving bitmap and print later.
So far I have managed to get the code from internet and start saving .png files, but they all…

DareDevil
- 5,249
- 6
- 50
- 88
1
vote
1 answer
draw charts with mouse input
I am building a chart program which displays up to 12 different graphs.
All graphs should be visible at the same time
It should be possible to alter the active graph by mouse input.
I build the chart like this:
using (Graphics G =…

Blob
- 23
- 2
1
vote
2 answers
VB.NET Drawing a two pixel transparent border around an on the fly created png image?
I'm quite new to programming graphics, much less with VB so I'm running to a wall here. I've done basically all the code all I'm missing is to add a few pixels of transparent padding/border around the image and I got stuck. I looked around but the…

Paradox Code
- 148
- 2
- 14
1
vote
3 answers
Graphics over a picturebox aren't showing and if they are they flicker before disappearing
I'm working on a windows forms application and when I'm using the System.Drawing.Graphics on top of a picturebox the graphics either don't appear or appear only momentarily before disappearing.
This is the code that I'm using to set the picturebox…

Cjen1
- 1,826
- 3
- 17
- 47