Click here to Skip to main content
15,889,863 members
Everything / Multimedia / GDI

GDI

GDI

Great Reads

by Paul M Watt
Guide to understanding how to create and use regions with the WIN32 SDK
by Shao Voon Wong
Tracing GDI Leaks with Windows Debugger
by Hans Dietrich
XBreadCrumbBar is a windowless non-MFC class that allows you to display a breadcrumb trail as HTML text, with support for web links and APP: links.
by Keith Rule
Create visually complex, yet programmatically simple, non-rectangular GUIs

Latest Articles

by Shao Voon Wong
Tracing GDI Leaks with Windows Debugger
by Andy De Filippo
Render Rich Text with GDI+ by tapping into the power of API hooking
by AdventureDriver
Creating a optionally sheared mirrored image from a source image in a collage
by David O'Neil
Everybody Loves the Mandelbrot Set! Here's a browser for it!

All Articles

Sort by Title

GDI 

27 Mar 2007 by vishalkmehta
This article demonstrates how to leverage the power of images and inheritance to achieve a "skinned" look for your Windows applications.
24 Jan 2005 by darkoman
An article on creating 2D animated charts using Windows GDI.
20 Jul 2012 by Dr. Vinayak Ashok Bharadi
Two dimensional Fast Fourier Transform of an image in C#.
14 Apr 2014 by auralius manurung
An article on designing your own robot simulator
8 Oct 2009 by Anthony Mushrow
Create and edit 2D maps using tiles
1 Apr 2019 by veen_rp
Smooth a 2D polyline through interpolation (Catmull-Rom) or approximation (Chaikin)
18 Mar 2011 by darkoman
This article is about the 3D software rendering engine.
17 Feb 2009 by MikeTheDwarf
Helper class to display 3D data
7 Apr 2016 by The Zakies
Part 3 of a tutorial to show a graphics program using C# using GDI and SVG drag and drop and delete objects
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.
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
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
7 Jun 2016 by The Zakies
[tut4] how to draw lines & to draw different types on end shapes like rectangle and circle using C#
19 Apr 2005 by Itay Sagui
Introduction to the basic idea of the particle systems, and how to create basic effects such as explosions and water fountains.
18 Feb 2010 by see1see
A practice of using Windows GDI and Winsock.
27 Aug 2003 by ucc801
A cool GDI pattern brush tool with C++ source code. You can create a new office XP style pattern fill mode quickly.
8 May 2008 by Davidwu
A Cool Vista Sidebar Gadget Style CPUInfo Animate Control! (Fixed)
6 May 2005 by Naveen Karamchetti
Creation of a custom drawing application based on the .NET Panel class.
24 May 2007 by Nicolas Bonamy
A grid to display and edit properties of objects (as in Visual Studio)
9 Apr 2002 by Paul M Watt
Guide to understand the three different types of clipping regions, and how they relate to the Device Context
6 Feb 2013 by Jarno Burger
A managed wrapper around FreeFrame, to give your video frames some cool effects
29 Dec 2010 by yonken
A multi-select tree control that is based on Richard's implementation
29 Nov 2010 by ShivamShukla
How to retain the drawn line while drawing another,while mouse move,as InvalidateRect() is repainting the window every time. PLZ Please Help me as soon as possible.
29 Nov 2010 by Alain Rist
See the Scribble MFC sample[^].cheers,AR
29 Nov 2010 by KingsGambit
You can store the start and end points of previous lines and re-draw previous and new lines.
13 Jul 2011 by Albert Holguin
Invalidate() should only be called when the particular window needs to be redrawn. Maybe you're calling it when you shouldn't be called. In general, the paint routines will only be called when windows determines there's been a change to your drawing context area, either by a window being...
10 Dec 2007 by Mohammed Abd Alla
This is a simple class that can view scroll and zoom pictures
16 Jan 2016 by Mathew_wwx
This tip will introduce a library written in C++ that wraps up a 2d polygon triangulation algorithm with time complexity of O(N*logN), the algorithm works on both self-intersected and non self-intersected polygons.
21 Dec 2009 by P.Sandgren
A simple custom progressbar.
28 Dec 2009 by Aric Wang
Just a simple digital LCD class and do not use an external bitmap.You can use and change it.
5 Aug 2003 by BadJerry
Drawing HTML text onto a device context
8 Sep 2006 by Polymorpher
Animate and control sprites using GDI+.
21 May 2014 by Javad Taheri (drjackool)
Hi,I have a question about memory device context (MemDC),When creating a memory DC using CreateCompatibleDC(...) & CreateBitmap(...), the actual data (bitmap associated with DC) where is saved,in the main memory OR video card memory? and if in the main memory the raster operations (such...
21 May 2014 by Richard MacCutchan
A memory DC is just that, a piece of memory. It is only when you copy that to an actual device DC that the video card and GPU become involved.
21 May 2014 by CPallini
Some info here: "Comparing Direct2D and GDI Hardware Acceleration"[^].
25 Jan 2010 by yingkou
Recently Having Readen Code About How to Show BMP By Operating Pixel,Idon't understand codes about Parameter(lpBits).Code As...
25 Jan 2010 by #realJSOP
You're allocating memory for the image. In order to do that, you need to allocate memory for each pixel and the desired color depth of that image. That's what the 32*32*5 does.
25 Jan 2010 by yingkou
To Above:>In order to do that, you need to allocate memory for each pixel> and the desired color depth of that image. That's what the 32*32*5 does.Could You Tell Me How Much Is That Image(32*32?) and The depth Is 5?
25 Jan 2010 by Graham Breach
It isn't very easy to understand why from the context, but the 32*32*5 looks like it is allocating extra memory after the bitmap for use as something else. From the variable name, I would guess it is for 5 32*32 "characters".The 512*512 will be the size of the bitmap itself, using a 8-bit...
18 Aug 2011 by Dave Franco
Adding Lightbox effect to Winform Applications
20 Jun 2007 by Stefan Kuhr
Adding Aero Glass to Windows applications while keeping them backwards-compatible with legacy Windows versions
18 Jun 2016 by Patrik Mlekuž
Image Control for viewing most common image formats with advanced features included (Import Image, Preview, Resize, Position, Pan, Zoom, Export Image, Extract Resource Icon).
12 Dec 2009 by rb.karanam
As I said earlier, what I was thinking is pretty vague. I know that we can mask the data by coding the masking logic within the application itself. However, I wish to push that logic down to the Display drivers level using GDI prgramming etc. To explain, lets a say I have one existing...
11 Dec 2009 by AspDotNetDev
Of course. You have to get the data from somewhere before you display it (unless the user types it). Just mask it by replacing each character with an asterisk, for example. Or, if the user is typing it, you can use a texbox with masking enabled. And you can conditionally enable or disable the...
12 Dec 2009 by rb.karanam
As I said earlier, what I was thinking is pretty vague. I know that we can mask the data by coding the masking logic within the application itself. However, I wish to push that logic down to the Display drivers level using GDI prgramming etc. To explain, lets a say I have one existing...
17 Jan 2010 by RamchaAng
Hi Ramesh,I'm also searching for the answer to that problem... how to alter content to be displayed on screen at the device driver level.Have you found an answer to that problem yet? Maybe we can share some ideas with each other. Pls contact me soon.Thanks, Ramcha
17 Jan 2010 by Christian Graus
wrote:Now without modifying that existing application, I would like to deploy it one call center assoicate's machine, yet not allowing the callcenter associate to view the SSN. At the same time, if the same application is deployed on any other authorized employee's machine, the SSN should be...
18 Jan 2010 by RamchaAng
Hi ChristianI am also working on this problem. The aim is to create a data masking software which works on all kinds of documents n applications. To do this we should first capture the text to be displayed on screen.This can be done using API's at the driver level. Here I believe we...
18 Jan 2010 by avinash2010
Hey ppl, yea... I have been on this for quite sometime now and as you said I believe this can be cracked at the device drivers level only. We can use API(lang dependent or independent) for extracting the desired text which need to be provided to the device drivers. Coding at...
1 Mar 2010 by rb.karanam
Did anyone get any help or some direction towards the solution .. I am still doing same research and am no where.
19 Jun 2007 by lano1106
Exploring the MFC GDI classes' inner working and proposing an alternative
5 Oct 2009 by Jeff J Anderson
An alpha channel composited form for image based Window frames
22 Dec 2007 by YangXiaoWang
An apple style docking bar implemented by eGui lib
11 May 2010 by Gustavo Ricardi
A Remote Desktop software built on AJAX, JSON and HTML5
4 Oct 2003 by Terry O'Nolley
An article using GDI to create a scalable periodic table of the elements
17 Apr 2000 by Anton Stuck
A class that provides some simple, yet spectacular window animation effects. Try the demo!
28 Jan 2015 by syed shanu
Animated Image Slide Show for Winforms using C#
17 Jul 2010 by Hoang Khanh Nguyen
A highly object-oriented ListView control with varying-height items and support of complex data types
11 Jun 2012 by Iron-Eagle
Hello!I am trying to draw text string to string with openGL. I generate string to texture and then I draw the texture. Despite the fact that I setting ANTIALIASED_QUALITY fonts still pixelate and ugly.ExampleHere is the code I use: HFONT m_font =...
11 Jun 2012 by nv3
First check whether your font "Compress" allows anti-aliasing, e.g. being a TrueType font.The operating system also plays a role in the game. The MSDN documentation of the LOGFONT structure contains the following hint:Windows 95 Plus!, Windows 98/Me: The display must greater than 8-bit...
12 Jun 2012 by Iron-Eagle
Everything works fine. It was another bug in our system. Thanks everyone, sorry.
1 Dec 2007 by darkoman
An article on a simple but efficient method to do antialiasing using plain Windows GDI
6 Nov 2007 by .Suchit
Generating smooth lines with antialiasing; sample code for animation is included
17 Apr 2003 by Barretto VN
Article on changing screen resolution
20 May 2002 by Jason Henderson
Draw and animate ASCII characters to a window using this COM object.
11 Jun 2009 by brochpirate
Audio player designed specifically for listening to audio books
14 Aug 2014 by Jamie Nordmeyer
A class to make working with LOGFONTs easier
19 Nov 1999 by Maximilian Pasternak
3 Oct 2009 by Daniel Vaughan
Banishing String Literals from XAML Resource References
11 Jan 2003 by Barretto VN
An article showing methods of screen capture
5 Aug 2015 by sreeyush sudhakaran
VB.NET code for Base64 Encoding and Decoding of Image files
25 Jun 2012 by codiemorgan
Basics for setting up a 2D Game using GDI+, Renderloop, and Threading. And a few tips.
18 Mar 2010 by Mohammad Elsheimy
Which is better, to use BeginPaint/EndPaint, or to use GetDC/ReleaseDC?
14 May 2010 by 23_444
I need to invalidate different areas on a screen at the same time (occurring in the same function).I could invoke the InvalidateRect(&rc) for each area:InvalidateRect(&rc);InvalidateRect(&rc2);or I could create a region and add the rectangles to the region and then use...
15 May 2010 by Richard MacCutchan
23_444 wrote:I'm not convinced ... that WM_PAINT is firing for each call.You are correct, these calls tend to get collected together and then the app gets a single WM_PAINT message for an accumulation of more than one of the invalidated regions. As to the advantages of doing it this way,...
26 Dec 2011 by zoyobar
Binding and Handling JSON Field In jQuery Repeater
16 Nov 2004 by peterchen
Using boost, we can write "almost perfect" wrappers for GDI and other resource handles, in a few lines of code.
3 Jul 2012 by jiazhiqiang
LOGFONT LogFont; CFont * pCurFont=GetFont();//Dialog's Font if(!pCurFont) return; pCurFont->GetLogFont(&LogFont); LogFont.lfWeight=(bBold?FW_BOLD:FW_NORMAL); CFont font; font.CreateFontIndirect(&LogFont); pWndSel->SetFont(&font);I have a Button in Dialog,When I first Setfont()...
4 Jul 2012 by Code-o-mat
I belive the problem is that you are giving your button a font that is "stored" in a local variable.Quote: CFont font; font.CreateFontIndirect(&LogFont); pWndSel->SetFont(&font);-when font goes out of scope, its destructor deletes the font resource. When the button gets redrawn, it will...
26 Oct 2011 by chx101B
Hello. I have a project that I haven't started yet as I am looking for a plotting library.If there's any out there(lightweight and re-destributable) I'd be happy to use it.It can also be a GDI wrapper.All I need it to do is be able to draw two axes and a key representing the...
26 Oct 2011 by Espen Harlinn
I guess that by plotting you are thinging about a chart (and not something more sinister :) )There is one project here on CP that may suit you:A flexible charting library for .NET[^][Updated for c]Cairo is a 2D graphics library with support for multiple output...
26 Oct 2011 by markkuk
PLplot[^] or MathGL[^]
15 Dec 2011 by shynet
Stream a live camera video stream or single images between applications using the TCP protocol.
18 Sep 2021 by Storm Kiernan
This code is giving me problems: private void SaveBMP(Bitmap bmp) { bmp.Save(_project.MapFilePath); }This line throws a generic GDI+ error.bmp.Save(_project.MapFilePath);Any ideas?quote:It means that the file path points to an image that...
16 Jan 2010 by Christian Graus
It means that the file path points to an image that has already been opened in GDI+. You need to be careful to close your images when you are done with them. There's tons of info on this on the web, but that's the core of all the info you'll find. Bugs in GDI+ cause it to hold a file open,...
30 Oct 2011 by Storm Kiernan
The solution was to do:private void SaveBMP(ref Bitmap bmp) // now 'ref' parameter{ try { bmp.Save(_project.MapFilePath); } catch { Bitmap bitmap = new Bitmap(bmp.Width, bmp.Height, bmp.PixelFormat); Graphics...
17 Jan 2010 by Christian Graus
Sure - that means that the image that was being held open, was the one that you were working with, which is not surprising.
16 Apr 2014 by SMPS LLC
public static void SaveJpeg(string path, Image img, int quality){EncoderParameter qualityParam= new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);ImageCodecInfo jpegCodec= GetEncoderInfo(@"image/jpeg");EncoderParameters encoderParams= new...
10 Apr 2015 by hisham ahmed
Bitmap newBmp = new Bitmap(bmp);bmp.Dispose();newBmp.Save("yourPath");MessageBox.Show("Saved");
29 Nov 2014 by Umut Comlekcioglu
Hi everyone,I'm developing new software for me. But I have a little problem. When I wanna get the String Width, already I use that code;float aa = pe.Graphics.MeasureString("PROGRAMMING", Font).Width;But this value is not correct. When I test that line with that...
29 Nov 2014 by DamithSL
try with TextRenderer.MeasureText Method[^] sample code : String text1 = "Measure this text"; Font arialBold = new Font("Arial", 12.0F); Size textSize = TextRenderer.MeasureText(text1, arialBold); TextRenderer.DrawText(e.Graphics, text1, arialBold, new...
29 Nov 2014 by BillWoodruff
Using the default 'MeasureString and 'DrawString: leading-space and trailing-space may be automatically added when the string is rendered:"The MeasureString method is designed for use with individual strings and includes a small amount of extra space before and after the string to allow for...
22 Nov 2011 by Pete O'Hanlon
At the end of the setvibration line, you don't have a semi colon. You need to add one so that it looks like the following:if (yourmum = buttonState.pressed) setvibration(playerindex.me,1,69); // This line needs the semi colon,.else { redIntensity++; }Next, you terminate the...
22 Nov 2011 by :)9/11
if (yourmum = buttonState.pressed) setvibration(playerindex.me,1,69)else { fatness++; }if (fatCountingUp > 300kg); (setBiggestLoserShow = true);else { (setBiggestLoserShow = MEGAtrue); }if (codDisc = broken); (YouDumpGirlfriend);else { ...
30 Jun 2008 by Giawa
Implements a Rubber Rectangle in C#.
28 Jun 2014 by AlwaysLearningNewStuff
I have printing code that draws grid on the paper.Grid has 4 columns, and they have equal horizontal length. Height of the cell is tenth of the paper size. Total number of rows is unknown but I know for a fact that there will be at least one row.Each cell has same physical size-> width...
29 Jun 2014 by CPallini
Quote:The only thing that crossed my mind was to create "dummy font", see if the example text can fit into cell, and then adjust it's size if the test failsThat's a feasible approach indeed. But what do you mean with 'dummy' font? You need to know in advance the exact font you are going to use,...