Click here to Skip to main content
15,886,724 members
Everything / Multimedia / GDI+

GDI+

GDI+

Great Reads

by Josh Smith
A task-oriented review of an animation library and the application which uses it
by Ajcek84
Open source library for music engraving in desktop, mobile and web applications
by Clayton Rumley
There are those who think I am crazy, and this just might be the proof.
by Volynsky Alex
Part 2 in a series of articles on a two-player mathematical game of strategy

Latest Articles

by spidergeuse
Manipulate WinForms controls to make a simple jigsaw puzzle
by Andy De Filippo
A simple technique to quickly port hatch effects from Gdiplus to SkiaSharp
by Andy De Filippo
Render Rich Text with GDI+ by tapping into the power of API hooking
by Yang Kok Wah
A tool to generate face images and animated gif files for different angles and lighting using only a single face image. Also includes Face Matcher using Microsoft Face API.

All Articles

Sort by Updated

GDI+ 

5 Mar 2023 by spidergeuse
Manipulate WinForms controls to make a simple jigsaw puzzle
28 Dec 2022 by Andy De Filippo
A simple technique to quickly port hatch effects from Gdiplus to SkiaSharp
14 Oct 2022 by Andy De Filippo
Render Rich Text with GDI+ by tapping into the power of API hooking
6 Sep 2022 by OriginalGriff
Don't post this under Quick Answers - if you got the code from an article, then there is a forum at the bottom which allows you to talk to the author directly. The rest of us have no idea which of hundreds of thousands of articles you are talking...
6 Sep 2022 by Tony Springs
I can't figure out how you "Build the control" without having the .dll file. Moving the animation control to my new project does not work. thank you for your help. Tony What I have tried: I am trying to use the Animation Control to create...
25 May 2022 by thehapiii
Hi there. I'm searching for an algorithm that can remove a range of defined colors from images with high accuracy .For i want it to be fast,the pointers must be used. Can anyone help me out? I have tried the following piece of code, but it's not...
19 Mar 2022 by Yang Kok Wah
A tool to generate face images and animated gif files for different angles and lighting using only a single face image. Also includes Face Matcher using Microsoft Face API.
9 Dec 2021 by Andy De Filippo
Draw a shape-like editor implementing the use of anchors to resize and rotate a selection rectangle
13 Sep 2021 by Member 12827762
I wanted a region which was the union of 2 elliptical areas, slightly displaced from each other. When I added both these ellipses to a GraphicsPath, then the region constructed from this path excluded the intersection of the 2 ellipses, which...
14 Jun 2021 by gggustafson
This article revises an earlier revision of the Gradient Color Picker (V2). The incentive for the revision was a reader request for a larger number of initial color choices.
14 Apr 2021 by Angelo Cresta
An extension of "A control to display pie charts with highly customizable formatting" from mattsj1984 that also renders doughnut.
1 Apr 2021 by Aleh Baradzenka
One of the easiest ways to animate images for your program
28 Mar 2021 by gggustafson
Revises an earlier implementation of the Gradient Color Picker
16 Feb 2021 by practicalDeveloper
A custom drawn keyboard usercontrol and TextBox with keyboard popup
8 Feb 2021 by Mohssine EL HARFI
2D Game Engine + Network Library + Path finding + Windows GUI + Mouse Event handler "ALL-IN-ONE"
24 Oct 2020 by Harsha T, Amarnath S, S Mahesh Reddy
A simple viewer of images stored in the DICOM 3.0 File Format (C#). The file should have raw pixel data, uncompressed. Window Level functionality is also provided.
19 Sep 2020 by sdancer75
A graphical time line editor to help you create and prototype animations. It is useful for adjusting variables and checking out how the effects change over time with keyframing and easing/twining functions.
15 Aug 2020 by Mohammad Dehghan
Creating special 'Graphics' objects to draw anywhere on your window, including non-client area
17 Jul 2020 by honey the codewitch
Add a flexible knob control to your .NET projects
21 May 2020 by Patrick Eckler
Updated AForge.NET Version 2.2.6
2 Nov 2019 by Alaa Ben Fatma
Use your skills as a designer to create gorgeous control
9 Oct 2019 by garfieldzf
I have a large .tiff,about 2.2G, I want to change it to png or jpg in C#/GDI+,but when I load it,it throws "Parameter is valid","Array dimensions exceeded supported range". What I have tried: I try it like this: byte[] buffer = null; using (FileStream fs = new FileStream(file,...
9 Oct 2019 by OriginalGriff
You can't: Creating a File Mapping Object - Windows applications | Microsoft Docs[^] Quote: The size of a file mapping object that is backed by a named file is limited by disk space. The size of a file view is limited to the largest available contiguous block of unreserved virtual memory. This...
27 Sep 2019 by Member 14605311
I'd like to completely control modern color laser printer (which supports BitBlt) - to be able to print at any point=dot (say 600DPI) any of only 8 really available colors: Cyan Magenta Yellow blacK C+M=Blue C+Y=Green M+Y=Red (8th - white), bypassing both color-conversion and dithering...
27 Sep 2019 by steveb
Printer has been abstracted away into the device context decades ago. So you write/draw to the printer in the exact same manner as you do it to the screen. You just use the 'Printer HDC' instead of 'Display HDC'. All the rectangles and coordinates will be that of the printer HDC. Just look up...
23 Sep 2019 by Terence Wallace
A continuing series demonstration of Finite State Machines (FSM) where agents inhabit a small town called WestWorld.
30 Aug 2019 by ephrem33
I am trying to display a .tif image of 136MB size. But Image.FromFile(...) keeps on throwing out of memory exception I manually increased the size of the virtual memory to around 4GB but to no avail. I have checked image file to make sure that it is not corrupted and I can see the image...
21 Aug 2019 by Johnny J.
Easily add image cropping to your desktop application
12 Jul 2019 by RickZeeland
Assuming you are using Winforms, there is no easy way to do this, but here is a CodeProject article that uses a UserControl to do this: How to skin scrollbars for Panels, in C#[^] And also: Enhanced Scrollbar[^]
12 Jul 2019 by Member 14315994
I wants to change my style of scrollbar in panel c# like the scrollbar of Visual Studio 2012 . Please if anyone can be help me and give me the code ,don't rate. and thank you. What I have tried: ...
23 May 2019 by Member 14430889
Dear All: i am new, i just start to learn draw shape with vs2012 c++ and Gdiplus about 5 weeks, i create a simple project to test, but when i draw polygon finish, i cannot delete any polygon which i selected from canvas, it not so easy like to delete a rectangle or a ellipse, only delete the...
23 May 2019 by Richard MacCutchan
You should do all your painting/drawing to the screen in the function that handles the WM_PAINT message. Each time this function is called it should redraw all the shapes. When a shape is deleted you just remove it from the list of items to draw, and then call InvalidateRect to force a repaint...
13 Apr 2019 by nogChoco
LineNumbers that dock to a RichTextBox or show as an overlay on top of it
9 Apr 2019 by Le Khai Hoan
How to convert code xaml below to C#(GDI+). PLease> Thanks
9 Apr 2019 by Gerry Schmitz
You got "rectangles" and "path geometry" (a bunch of lines). Use the equivalent in GDI+. Pens, Lines, and Rectangles in GDI+ | Microsoft Docs[^]
9 Apr 2019 by Le Khai Hoan
T dont have a tool ! And i dont know line commands of xaml to c#.
9 Apr 2019 by Dave Kreskowiak
All this does is create a surface to draw on and starts drawing a bunch of stuff on it. You're going to have to convert this code by hand if you want to do it in Windows Forms. It's going to take a control to draw on, like a Panel, and a ton of drawing commands, like Graphics.DrawRectangle and...
28 Feb 2019 by SSDiver2112
A custom Panel that creates a glow effect around a child control or a drop shadow when it receives focus
3 Dec 2018 by RickZeeland
Found a solution that also works when the Windows text size is not set to the default 100%, the PictureBox and other controls must be placed in a Panel: Bitmap printscreen = new Bitmap(panel1.Bounds.Width, panel1.Bounds.Height); panel1.DrawToBitmap(printscreen,...
2 Dec 2018 by mmbguide
hello I have a "PictureBox" with an image and a "Button" control which has been added to "PictureBox" controls. Now I want to save image of "PictureBox" with image which has been created from Button Appearance(Graphic + Text + ...) and save all as an single image. how can I change Object's...
2 Dec 2018 by mmbguide
thank you. I found following guide: Control.DrawToBitmap(Bitmap, Rectangle) Method (System.Windows.Forms) | Microsoft Docs[^]
2 Dec 2018 by OriginalGriff
An Image is a picture which is displayed in a Picture box, is all - any other controls you add to the PictureBox.Controls collection aren't actually drawn on the Image at all, they are drawn on the screen (or other Graphics context used to displaying the PictureBox) but do not in any way, shape,...
2 Dec 2018 by Richard MacCutchan
See Screen capture[^]
18 Nov 2018 by XTAL256
Hello, I have some code that uses GDI+ to convert an icon to grayscale*. However, when transparency (i.e. alpha channel) is involved, the resulting icon seems to use pre-multiplied alpha - rather than normal alpha - making the transparent pixels look darker. * Create GDI+ Bitmap from HICON,...
7 Oct 2018 by Mojtaba Hosseini
A graphical binary tree. Features: add, remove, or search for a node. Recursive algorithm has been used
13 Aug 2018 by Shao Voon Wong
How to draw a text with an outline
13 Aug 2018 by Shao Voon Wong
19 Jul 2018 by Ajcek84
WinForms library containing the IncipitViewer control for drawing musical notes
15 Jul 2018 by Ajcek84
Open source library for music engraving in desktop, mobile and web applications
27 Jun 2018 by Member 10193953
If HatchStyle is Horizontal, can I give Hatch interval or rotation angle? I tried searching, but I did not find any related issues. Below is the code I used. Source Code: GraphicsPath gPath = new GraphicsPath(); gPath.AddEllipse(DrawX, DrawY, DrawWidth, DrawHeight); GraphicsPath gPath =...
6 Apr 2018 by Richard MacCutchan
You need to capture the mouse button down, mouse move and mouse button up notifications. At each move you store the x and y co-ordinates, then when the mouse is released you can redraw the rectangle using the new co-ordinates. See Mouse Input Notifications (Windows)[^]
6 Apr 2018 by Member 13594414
I draw multiple rectangles on picturebox image . i want to resize that all rectangles using mouse in c# . Can anyone help me .. Thank You What I have tried: public List listRec = new List(); Graphics g; //private Graphics g; Point startPos; Point currentPos; bool drawing;...
23 Mar 2018 by KarstenK
There is some interpolation like dithering of the bits which got set. When you want pixel precise output you must take the resolution into account and round all data like your y to an full integer. Often are special bitmaps used to avoid this mess. When lines are in some angle the output must...
23 Mar 2018 by SteveK2
Can someone explain how GDI+ coordinates work? I’m migrating a large MFC/C++ gdi-drawing program to use gdi+. The simplest way to get going was to create a Gdiplus::graphics object from a DC I’d already initialised, then move each element of drawing across in turn - taking care not to switch...
11 Mar 2018 by nina4ever
to avoid GDI+ error, i used Microsoft Windows Imaging Components (WIC) instead. here is a good page with code to split and merge tiff Speed up Tiff file processing with Microsoft Windows Imaging Components (WIC) and here is the splitting method : public static void SPlitTiffWIC(string...
11 Mar 2018 by nina4ever
Dear all, i use the following code in a web application (ASP.NET/C#) to split a tiff image: public void SplitTiffImage(string inputFilePath, EncoderValue format) { try{ using (FileStream fs = new FileStream(inputFilePath, FileMode.Open, FileAccess.Read) ) ...
10 Mar 2018 by dkamble 10358990
general error occured at GDI+ , this error raise due image file references not closed properly and you are trying create or open same image. there for close image references at end of function. by calling Garbage collector. disposing image object .
17 Feb 2018 by Harold Quintero Pineda
I hope you can help me. Event MouseDown ''' ''' Overwrites the MouseDown event of the base class of the control. ''' ''' Protected Overrides Sub OnMouseDown(e As MouseEventArgs) ' 'The current position of the...
17 Feb 2018 by Harold Quintero Pineda
Good afternoon everyone, the truth I've made head to this, but I do not know what to do. You see, I'm trying to create a control to draw with GDI + Engineering graphics (I'm a Civil Engineer), and everything went fine until the following happens: * When trying to make Zoom or Pan with respect...
17 Feb 2018 by phil.o
Wild guess: you could try to set the focus to the control before the first pan/zoom. yourControl.Focus()
2 Feb 2018 by RickZeeland
This is an alternative for "Beveled Panel with Shadow Effect"
29 Jan 2018 by Shao Voon Wong
Fixing Inconsistent Stroke Width of Chinese Characters
21 Jan 2018 by RickZeeland
This is an alternative for "RoundedButton Control - Demystifying DrawArc"
11 Jan 2018 by Jesusfan
Create a draggable, proper splash screen in DotNet, with gradient transparency!
8 Jan 2018 by morzel
Couple of seconds to process a one megapixel picture… what the hell?
8 Jan 2018 by morzel
Using GetPixel or SetPixel for all but tiniest images is a terrible idea. Stop using these methods and make your code over 300 times faster!
21 Oct 2017 by OriginalGriff
We can't solve it for you - we don't have any access to your coe or data, both of which are needed to solve this. So, its going to be up to you. Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what...
20 Oct 2017 by NoviceCoder871987
I have a weird issue with Dialog box on Windows XP it doesn't draw correctly, The listview doesn't redraw unless i do some thing that forces repaints like clicking on the size boarders then the listview show. But if i move the application somewhere on screen it goes hidden again. This picture...
20 Oct 2017 by NoviceCoder871987
Issue is fixed by using SetParent on listview and the parent set is the main dialog and when switching between tabs using SetParent to return the parent of listview to the sub dialog so the code still hide it with ShowWindow. Now the Listview always show on top. No flickering. Very good.
3 Oct 2017 by Member 13443626
Where can i find value for EncoderSaveAsCMYK? As well the others one. Thanks. What I have tried: Searching it in documentation on msdn.
3 Oct 2017 by Richard MacCutchan
Image Encoder Constants (Windows)[^]
4 Sep 2017 by Scott Page
FreeCal is a free 100% .NET suite of utilities and instrument drivers for controlling multiple instruments in a Test and Measurement environment.
12 Aug 2017 by fwloveme
Now I have a picturebox in a window form,and I placed many buttons on the picturebox.I have accomplished of changing the picture size by sliding the Mouse middle button,but I don't know how to make all buttons change together with picturebox,including button's location and size. Who can give me...
12 Aug 2017 by Kornfeld Eliyahu Peter
Manage WinForm controls using the Anchor and Dock properties - TechRepublic[^]
8 Aug 2017 by practicalDeveloper
A panel that has rounded borders, gradients, edges/bevels and a shadow
14 Jul 2017 by Member 11346124
I find .Net Theme Created using GDI+. i am looking for Creating theme using GDI+ C++. where can i find tutorial. i Googled it but i only find draw line and such which are not i am looking for or i guess i need tutorial or help. Any suggestion or guide highly appreciated! ThanksWhat...
14 Jul 2017 by KarstenK
At first a theme is an installation package with some defined content. Her you find the Theme File Format described from Microsoft. Developing an own theme is a big task. I think the basics are handled in the in the outstanding article Custom Controls in Win32 API: Visual Styles and some good...
15 Feb 2017 by Cynnie Jia
Re paste a complete code:private void Adjust(Bitmap pBitmap, params int[] pValues) {Prepare(pValues); BitmapData pBitmapData = pBitmap.LockBits( new Rectangle(0, 0, pBitmap.Width, pBitmap.Height), ImageLockMode.ReadWrite, ...
14 Feb 2017 by Jochen Arndt
Note that the BitmapData.Stride Property (System.Drawing.Imaging)[^] will be negative with bottom-up bitmaps. So you have to use the absolute value:int iStride = Math.Abs(pBitmapData.Stride);byte[] pData = new byte[iStride * pBitmapData.Height];int iOffset = iStride - pBitmapData.Width *...
13 Feb 2017 by trident99
GT is a compact, efficient, and customizable graphical user interface (GUI) library for the Windows environment.
1 Feb 2017 by Mr. xieguigang 谢桂纲
How to build my own 3D graphics engine from ZERO step by step
12 Jan 2017 by Dean Feng
Use common panel and GDI+ to achieve a magnifier effect of image in winform.
12 Jan 2017 by hari19113
This article shows how to create a Pie chart using the Graphics class in C#.
26 Dec 2016 by xuyunhai20160827
I met a question about the efficiency of GDI+.There are several variables and methods as below:1.points, such as A(Represents a coordinate point, such as X Y Z), B, C, D, E, etc.2 List named Cmd1, used to add points by thread3.paint method, in this method, the set of points...
6 Dec 2016 by cambalinho
i have these code for save a gif file: friend std::ostream& operator
6 Dec 2016 by KarstenK
You must set the transparent color in the original picture or in the encoder if possible.I found another solution on MSDN.
11 Nov 2016 by 5everin
This isn't really a coding question, more me trying to understand why the below is happening. Though if someone can provide a solution that would be fantastic.I've written a screensaver using Winforms and GDI+ that draws shapes to a manually controlled buffer then renders the finished image...
11 Nov 2016 by Dave Kreskowiak
Instead of making a hole through the form, take a screen shot of the Desktop and then use that as the first image you paint on your form, then paint your other graphics on top of it. No transparency needed at all.
4 Nov 2016 by Mr. xieguigang 谢桂纲
.NET language Canvas control for Interactive visualizing network data.
30 Oct 2016 by Shao Voon Wong
Prototype SIMD vectorized code effortlessly.
28 Sep 2016 by chiona
So I've been working on an unmanaged C++ 2D MFC system in Visual Studio 2013 using GDI+ (Document View architecture). I need simple shapes shaded from each vertex of the shape - either a triangle with a color in each corner, blending those colors to the interior, or a rectangle doing the...
25 Aug 2016 by Mr. xieguigang 谢桂纲
Manhattan plot in VisualBasic, application of the cross platform VisualBasic in the data science
23 Aug 2016 by Alaa Ben Fatma
Inherits the awesome style of Visual Studio's TabControl for better exploiting
7 Aug 2016 by ANKIT KHOKHAR
Hello, I am creating a cad application to create pettern draft. But this thing(draw) is new to me so i dont kown how can i achive this.I want to create a vertical hexagonal grid and map each hex with index. Then i draw a straight line from top to bottom then user can edit that line by...
7 Aug 2016 by User 9149614
Preserving alpha channel drawing transparent PNGs
15 Jul 2016 by andalmeida
3 Jul 2016 by The Zakies
we will continue the functionality of the hand tool with having a navigator panel which works as a map, we will also have a red rectangle which tells the user where he is actually viewing inside the whole form, also it can be moved to pan the form
1 Jul 2016 by Yang Kok Wah
Use of GDI+ Matrix class to perform image transformation.
29 Jun 2016 by The Zakies
we would create Hand_tool to pan through the drawing form, and we would use a custom cursor of open and closed hands
24 Jun 2016 by The Zakies
in this tut we will create a technique to enable the user to control points within a drawn line, by drawing circles around points of the line , when the user clicks a circle he would control the corresponding point.