Click here to Skip to main content
15,891,513 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 Updated

GDI 

28 Jul 2006 by #realJSOP
Copy a bitmap over a portion of another bitmap
17 Jan 2010 by #realJSOP
Don't use MS Shell Dlg for your font. Select a specific font (and I recommend selecting one that comes with a standard Windows install). I use Arial (I like it better than MS San Serif).EDIT =============I don't understand why this was voted a 3. You may not LIKE the answer, but it's...
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.
18 Apr 2010 by #realJSOP
Check out rent-a-coder. They have people there that love working for almost nothing.
30 Nov 2010 by #realJSOP
Look at the scribble sample project provided by microsoft.
30 Nov 2011 by #realJSOP
I think what you're asking is impossible, and even if it wasn't, it's most likely against the AutoCAD EULA.Beyond all of that, a toolbar is just a control. You won't necessarily get the code that supports it just because you can display the actual toolbar.
16 Dec 2011 by #realJSOP
That's certainly possible. I'm doing something like that in an app I'm writing, and I'll try to formulate an answer you can actually use.In my case, I created a custom control derived from the Panel control. I then overrode the Paint method, and put code in to draw an image in the specified...
6 Nov 2007 by .Suchit
Generating smooth lines with antialiasing; sample code for animation is included
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...
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 { ...
20 Apr 2010 by @Intersect☺™
Try to clean your DC before you change your resolution. It will produce a great effect I believe.
31 Jul 2005 by _Asif_
Article that helps writing SQL in XML to provide better support
12 Jul 2013 by Abdelrahman Ismaeel Hegazy
Save image map portions for any image for later using in web or in printing using an image.
3 Dec 2009 by Abhishek Sur
I think this would help : http://chiragrdarji.wordpress.com/2008/05/09/generate-image-from-text-using-c-or-convert-text-in-to-image-using-c/[^]:thumbsup:
11 Apr 2022 by AdventureDriver
Creating a optionally sheared mirrored image from a source image in a collage
2 Apr 2012 by ajaiisnow
Hai, my requirement is to draw a line over a bitmap loaded into memory. i am working in WinCE. The code i wrote is like this, HGDIOBJ hPrevObj = 0; HGDIOBJ hPrevObj1 = 0; BOOL bStat = 0; dwError = ::GetLastError(); hDCMem =...
2 Nov 2019 by Alaa Ben Fatma
Use your skills as a designer to create gorgeous control
23 Aug 2016 by Alaa Ben Fatma
Inherits the awesome style of Visual Studio's TabControl for better exploiting
29 Nov 2010 by Alain Rist
See the Scribble MFC sample[^].cheers,AR
8 May 2011 by Alain Rist
Hi Quy,The Gdiplus::Bitmap object by itself produces no new data, it is just a connector to the relevant codec and the Gdiplus::Image data (your IStream). When you succesfully call pBitmap->GetHBITMAP(Color(0,0,0),&hBitmap); the Gdiplus::Image data are read (from your IStream) and a...
1 May 2011 by alan kitching
How can I get Win Explorer to show my MFC Doc/View document 32x32 Icon at full size...? IE: not reduced on a white background with "folded-corner document" outline...? I'm using C++ and Visual Studio. It seems the MFC architecture creates this reduced-form icon automatically, as it does with...
21 Jun 2011 by Albert Holguin
Well, you did tag it appropriately, the WinGDI would allow you to do that.There are plenty of articles here at CP:http://www.codeproject.com/KB/GDI/[^]
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...
14 Feb 2005 by Alberto_Martinez
Very addictive game that demonstrates some GDI, sound, and 100% solvable puzzle creation (from all the testing so far).
23 Mar 2011 by Albin Abel
This demostrates fitting an image to the picturebox extend, zoom and move by transforming the picturebox device context/ graphics
16 Mar 2011 by Albin Abel
Like HTML images, we can have clickable areas in a picturebox of windows application
28 Jul 2001 by Ales Krajnc
An include file that allows you to specify colors by name instead of RGB value
28 Aug 2009 by Alex Blekhman
A simple Calendar utility that demonstrates basic Shell extensibility techniques: desk band, tray notification icon, locales.
15 Jan 2004 by Alex Kolesnichenko
CDC descendant with double buffering abilities
25 Jul 2018 by Alexandru Matei
Shows an alternative to GetCharABCWidths and GetCharABCWidthsFloat
15 Aug 2010 by aliveli
Hi.I want to make a virtual keyboard on windows ce. So i'm creating about 40 buttons on a window dynamically. Everything is ok but when i want to show the window i can watch every button drawing by one by. I want to show all page at once and all buttons at the same time. How can i do it? Thanks.
23 Nov 2009 by alleyes
Trying to create a simple DIB from performing a GlobalAlloc on a size of data, locking the data sing GlobalLock and returning a handle to the data, casted to a BITMAPINFO type. Using a loop to fill the bit data. The purpose of this is to create a test for an app that captures images from an ActiveX
4 Nov 2013 by AlwaysLearningNewStuff
INTRODUCTION AND RELEVANT INFORMATION:I have implemented complex painting of the main window’s background and its child static controls.The link to this picture shows how it looks:http://pbrd.co/1cx8DHd[^]Static controls have SS_NOTIFY style, which is important to mention, as certain...
10 Nov 2013 by AlwaysLearningNewStuff
INTRODUCTION AND RELEVANT INFORMATION:I want to create a static control with gradient background.I want to do it the following way:Create the gradient at the main window’s background, and then place transparent static control on top of that background.To do that, I have created...
5 Dec 2013 by AlwaysLearningNewStuff
INTRODUCTION AND RELEVANT INFORMATION:I have a complex painting to implement in my main window’s WM_PAINT handler.I have submitted a picture bellow to illustrate it:http://pbrd.co/18fNYYp[^]Main window has static controls, instead of buttons, which have style SS_NOTIFY.When...
5 Dec 2013 by AlwaysLearningNewStuff
The problem was in SetWindowPos API.I am quoting the developer who helped me to solve this problem:" When the main window is resized the WM_SIZE handler moves the static child windows.When a child window is moved, Windows automatically copies the client area of the child control from...
17 Dec 2013 by AlwaysLearningNewStuff
INTRODUCTION AND RELEVANT INFORMATION:I have a complex painting to implement in my main window’s WM_PAINT handler.I have submitted a picture bellow to illustrate it:http://pbrd.co/18fNYYp[^]Main window has static controls, instead of buttons, which have style SS_NOTIFY.When user...
18 Dec 2013 by AlwaysLearningNewStuff
INTRODUCTION AND RELEVANT INFORMATION:The original project I work on has small memory leaks, so I have decided to perform a small test so I can detect what could cause them.I have created a Win32 project using Visual Studio wizard. I haven't added anything, I have just left it as it was...
18 Dec 2013 by AlwaysLearningNewStuff
I do not wish to steal other people's credits so I post here a link to the answer that I think explains really well what is the problem:http://stackoverflow.com/questions/20664677/default-win32-project-has-constant-number-of-memory-leaks[^]
14 Jun 2014 by AlwaysLearningNewStuff
I am learning to use print property sheet so I can start learning printing by drawing a rectangle on the paper.My problem is that I do not have a printer, and am testing the results by printing to XPS file and MS Office OneNote 2007. I am drawing the rectangle with this code snippet ://...
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...
27 Jan 2014 by Amazing LED Display
High Performance Method for Capturing Screen
6 Feb 2000 by Amir Zalzberg
How to create a window with holes in it
13 Sep 2012 by amsga
HiJust a quick question, do I need to delete an object if it is called from SelectStockObject?Msdn doesn't say much about whether or not I should delete it.
21 Jun 2011 by Ananda_mr
Dear all, I need to write a program to create a rectangle on desktop, which will selects any portion of the desktop (It may include complete screen) and then I need to capture that portion. I know about capturing, but I don't which windows APIs I need to use to draw selection...
21 Jun 2011 by Ananda_mr
Hi all, Thanks for your solutions.....I got a code to draw a rectangle by tracking mouse messages. I need to know how to handle mouse or keyboard messages posted by mouse movement anywhere on desktop even if it is on other windows. Only I know how to handle messages specific to a window....
24 Jun 2011 by Ananda_mr
Dear all, I wrote code to capture screen (1024 * 786 resolution) using both GDI and DirectX, but I am doing a performance test, both GetDIBits (GDI) and GetFrontBufferdata(DirectX) taking more time ~600ms and also CPU utilization is around 17%. I am doubt about whether APIs are too slow...
21 Jul 2011 by Ananda_mr
Dear sir,I read about hooks and related documentation. I am developing a screen capture application, I used GDI and Direct3D methods, now I am using polling method to capture screen. But this is affecting system performance. I am searching for a solution to know a way to learn active desktop...
10 Aug 2011 by Ananda_mr
Dear sir,I am working on Desktop Sharing. I need a way to capture mouse pointer coordinates at server side and to duplicate similar mouse at client side, this mouse pointer should be independent of client side computer local mouse actions. I know some APIs to get screen coordinates of global...
11 Aug 2011 by Ananda_mr
Dear Paul Heil and vivek511,This will help me to do in capture side. How can I create a similar cursor at remote machine within a windows with this information got at sender machine.Anand
28 Jan 2011 by andrew_dk
Hi,In windows explorer if you hold the left mouse button down and move it around the window a blue translucent selection marquee appears. As you move the mouse around the marquee grows and all items touched by or inside the marquee are selected. I was wondering if anyone had any idea on how to...
17 Sep 2004 by Andrzej Markowski
An owner-draw bitmap button and a frame for the caption bar, in one class.
13 Oct 2011 by André Kraak
Perhaps this article[^] can help you determine the cause.
14 Oct 2022 by Andy De Filippo
Render Rich Text with GDI+ by tapping into the power of API hooking
27 Jan 2003 by Aniket Nayak
24 Nov 1999 by Anneke Sicherer-Roetman
CAutoPen Class - a CPen that is correctly destroyed
30 Nov 2010 by anonymous1310
Hi, I am developing a Ms Paint like application in MFC ,but I am having problem like i am not able to retain the drawn shape,as the window is getting repainted after invalidate is getting called,Please help me as I am kind a beginner in MFC .
8 Oct 2009 by Anthony Mushrow
Create and edit 2D maps using tiles
17 Apr 2000 by Anton Stuck
A class that provides some simple, yet spectacular window animation effects. Try the demo!
11 Nov 2009 by AntounPG
Send E-mail via Application with an HTML editor and a drawer to draw your own attachments and send them immediately.
3 Oct 2008 by Ardavan Sharifi
in this Article we following how to dynamic validation data with defind validation type and use of regular expression
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.
23 Nov 2009 by AspDotNetDev
Sounds like you want to manually recreate a bitmap at the byte level. It's feasible; I once did that in high school when working with QuickBasic. You just need to review the file format (which is really simple) and get to coding: http://en.wikipedia.org/wiki/BMP_file_format
5 Dec 2009 by AspDotNetDev
Check out "Bitonal (TIFF) Image Converter for .NET". You can create a "bitonal" (i.e., monochrome) image from a byte array. How you fill that array with color data is up to you. You can load it from a bitonal file (you can also get the byte array data from an image) or you could draw a 32-bit...
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...
26 Feb 2009 by auralius manurung
A reusable class for drawing a simple graph
14 Apr 2014 by auralius manurung
An article on designing your own robot simulator
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...
19 Sep 2020 by Avtem
So i'm trying to create a digit clock using only WinAPI with C++ (see the screenshot)[^] Function drawDash() is called 7 times to draw one digit. i use Timer which redraws the digits every 100 milliseconds. Everything looks fine, but for...
5 Aug 2003 by BadJerry
Drawing HTML text onto a device context
14 Sep 2011 by barneyman
the HWND you get passed is maximised over all monitors ...you're probably better off creating a child window per monitor during the WM_CREATE call if you want separate draw images
17 Aug 2002 by Barretto VN
11 Jan 2003 by Barretto VN
An article showing methods of screen capture
17 Apr 2003 by Barretto VN
Article on changing screen resolution
14 Dec 1999 by Bernd Wißler
Demonstrates how to use an animated gif stored in your resource file as an animated cursor
9 Nov 2010 by Bezawit
Hi guys. I am trying to save 2D graphics shapes that were drawn on a UserControl. I mean, it is like Microsoft's paint application where the user can create different shapes like rectangles, lines and then save it to a file in their PC. They can later come to that file and open it. I am...
3 Jan 2011 by Bezawit
Hi guys, I'm trying to simulate a rectangle that moves with a velocity of V from point A to point B. The two points are connected through a line that I draw by overriding the OnPaint method of a Form. The thing that looks like a challenge to me is how to set when the location of the...
27 Jan 2011 by Bezawit
Hi. I am using a UserControl to display a picture. My application has a Zoom In/Zoom Out feature. I can press the Zoom Out button any number of times and the background code I write will make sure that the left side of the picture would not leave the left side of the UserControl it is drawn...
2 Jun 2008 by Bharath NS
Multithreaded GUI solution for starvation in Dining Philosopher problem
2 Aug 2010 by Bhavin Jagad
Create an SDI application that incorporates the following objecthierarchy.CVeiw
6 Aug 2010 by Bhavin Jagad
Hello Every one,i Want to create Grid smiler to the MS Excel.My required feature are:1)resizing cell(S)/Colum(s)/Row(s)2)selecting row(s),Colum(s),single cell and cell matrix.I need Help for the,1. Which data Structure is correct for the cell??2. How to change appearance of...
4 Oct 2010 by Bhavin Jagad
i want to create rectangle in which user can specify round/rect and for rounded corner radius can be specifiede.gi want Gradient rectangle of size 200 X 200 with Top-Left corner rounded with 10 unit round ellipse,same way top-right corner with 15 unit round ellipse,Bottom-Left...
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...
8 May 2018 by BillWoodruff
Like this one 🗲 or this one 🗱 or 🌩 ... these are characters in the Windows Webdings font: [^]. You can easily scale these up, and take a screen shot, and then create ... whatever. Or, you can take a Label Control whose text is the symbol, set its 'BackColor to 'Transparent, and then set its...
16 Aug 2004 by Bob Carboni
Code for creating transparent, blended bitmapped buttons.
11 Jun 2009 by brochpirate
Audio player designed specifically for listening to audio books
17 May 2010 by BryanWilkins
You could always put a flow control panel on your form with top down style set and add picture controls to it one at a time. You could even set auto scroll to true and that way if your picture controls are larger than the form(ie. longer from top to bottom). The scroll bar will appear...
30 Aug 2011 by CaldasGSM
Non-affine transformations, four-point distortions, or whatever you want to call it.
18 May 2013 by Captain Price
I have created a simple Win32 program which paints rectangles stored in a linked list. In the WM_PAINT message the program paints all the nodes (rectangles) in the linked list in a loop. The problem is that the program flickers a bit. I found the program is annoying to use. I am using double...
11 Jul 2004 by Catalin Stavaru
This light, yet very usable, application notifies users when new mail is received on multiple GMail (and other) accounts. Written in C++/MFC. No .NET framework, no browser instances launched, low system resource requirements!
17 Sep 2010 by CDP1802
A quick search on Google(!) led me to this article here:Adding GIF-animation using GDI+[^]
24 Nov 2010 by CDP1802
Nothing against XNA, but WPF would be better for this. A card game may need not much of a GUI, but some may be needed and that would be a pain, especially for somebody who just got started.With WPF you get the user interface and also the cards (including transformations) with far less overhead.
5 May 2014 by cdp_anhui_china
A special debugger to detect and locate GDI leaks, with source code.
18 Apr 2010 by Cedric Moonen
Well, nobody's going to make the work for you. So, if you have no knowledge in C++, I suggest that you either hire someone or start learning it yourself (buy a book for instance).Now, to give some pointers for your question, you have to separate the two tasks: reading the data from USB and...
27 Nov 2010 by Cedrickdeorange
Have a look at the cardgame starter kit on Microsoft. It might help, but at least you have the playing card pics.Hope it helpsRegards Zelacat
3 Jan 2009 by ChaoJui
To learn the usages of TrueType structures, TTPOLYGONHEADER and TTPOLYCURVE.
17 Dec 2009 by Charles Boyung
This post discusses the string truncation function for C#
25 Oct 2002 by Chen Su
Simple function to enable you to programmatically detect the user-selected font at runtime
11 Dec 2015 by CHill60
Have a look at this CP article Professional C# - Graphics with GDI+[^]There is also a reference zone[^] here on CPOr there always the M$ documentation[^]
3 Mar 2000 by Chris Becke
Notes on TrackMouseEvent, and SetCapture on Win32