Click here to Skip to main content
14,979,508 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 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.
by Angelo Cresta
An extension of "A control to display pie charts with highly customizable formatting" from mattsj1984 that also renders doughnut.
by Baradzenka Aleh
One of the easiest ways to animate images for your program
by gggustafson
Revises an earlier implementation of the Gradient Color Picker

All Articles

Sort by Score

GDI+ 

Please Sign up or sign in to vote.
9 May 2012
Josh Smith
A task-oriented review of an animation library and the application which uses it
Please Sign up or sign in to vote.
15 Jul 2018
Ajcek84
Open source library for music engraving in desktop, mobile and web applications
Please Sign up or sign in to vote.
27 Apr 2016
Clayton Rumley
There are those who think I am crazy, and this just might be the proof.
Please Sign up or sign in to vote.
16 Aug 2007
Volynsky Alex
Part 2 in a series of articles on a two-player mathematical game of strategy
Please Sign up or sign in to vote.
10 Apr 2013
gggustafson
This article introduces the reader to the steps taken to create a user control that displays a circular indeterminate progress control.
Please Sign up or sign in to vote.
1 Feb 2017
Mr. xieguigang 谢桂纲
How to build my own 3D graphics engine from ZERO step by step
Please Sign up or sign in to vote.
21 Aug 2019
Johnny J.
Easily add image cropping to your desktop application
Please Sign up or sign in to vote.
16 Apr 2007
Matt (D) Wilson
A simple command-line utility that validates XML files, implemented using MSXML via the VOLE COM/Automation driver library
Please Sign up or sign in to vote.
2 Feb 2013
Ron Beyer
A WinForms line control that works how you would expect one to.
Please Sign up or sign in to vote.
15 Feb 2013
Dread_Sharp
How to build an easy plugin system with C# which only takes about 30 lines of code!
Please Sign up or sign in to vote.
29 Jun 2009
Michael Dunn
Create custom tasks in your app's jump list on Windows 7
Please Sign up or sign in to vote.
8 Oct 2009
Syed Hasan Hyder
This article focuses on internal supply chain management systems visibility via chart reports, and provides assessment apparatus to manage and monitor activities spawned during business processes, hence paves the way for timely and precise business decisions.
Please Sign up or sign in to vote.
30 Sep 2009
Fiwel
Different ways to apply image filters.
Please Sign up or sign in to vote.
25 Jan 2013
FatCatProgrammer
StarReport: WPF-less GDI+.NET report component.
Please Sign up or sign in to vote.
12 Dec 2008
Iain Clarke, Warrior Programmer
A flexible easily overridable combo-box-alike control for choosing from a 2D array of options
Please Sign up or sign in to vote.
12 May 2009
YLS CS
Cubic Bezier Spline Curves constructed and used in Image Curve adjustment
Please Sign up or sign in to vote.
6 May 2009
SprinterDave, Huisheng Chen
Parse and extract APNG frames to each PNG file
Please Sign up or sign in to vote.
18 Dec 2012
Lars [Large] Werner
Windows has built inn support for a lot of keyboard languages, this class makes it possible to extract that info in an easy manner and present it to screen.
Please Sign up or sign in to vote.
30 Mar 2015
SSDiver2112
Interactive Design Time Control Overlays to make editing custom controls easier.
Please Sign up or sign in to vote.
5 Jul 2013
Johnny J.
A sample owner-drawn ComboBox
Please Sign up or sign in to vote.
29 Jun 2016
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
Please Sign up or sign in to vote.
11 Apr 2016
Martin Mitáš
Direct2D or GDI+? Perhaps both, with a help of the right library.
Please Sign up or sign in to vote.
23 Aug 2008
legcsabi
How to hide UI elements of a FontDialog (e.g., Font Size).
Please Sign up or sign in to vote.
20 Mar 2013
Terence Wallace
A VB.NET implemenation of using delegates and threading for game loops.
Please Sign up or sign in to vote.
29 Jul 2013
Ordiales
When no XP support is necessary. Better Icon structure arrises and easy conversion is allowed.
Please Sign up or sign in to vote.
25 Aug 2014
Anoop Kr Sharma
In this Tip/Trick, I am going to show How to create Simple Paint Application in C#
Please Sign up or sign in to vote.
2 Jun 2015
Johnny J.
A custom drawn TrackBar that looks like the one in the classic Winamp skin
Please Sign up or sign in to vote.
14 Jun 2021
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.
Please Sign up or sign in to vote.
17 Jul 2007
Miran.Uhan
Grayscale and color scale filters.
Please Sign up or sign in to vote.
27 May 2013
Sergey Alexandrovich Kryukov
I can give you a simple idea: this is very difficult, nearly impossible.I can tell, because I have a very long experience working with photo editing, using different software, including very best products. Many people are very impressed with background removal/replacement feature. But I was...
Please Sign up or sign in to vote.
20 Apr 2011
Manfred Rudolf Bihy
Check if the cursors coordinates (as a Point type) lie within in that region.Pont point = ...; //Set mouse coordinates here.GraphicsPath path = ...; // Create your path here.if(path.IsVisible(point)) ... // Check if mouse coordinates are within pathRegards,-MRB
Please Sign up or sign in to vote.
5 Jul 2012
Matthias Böhnke
Bug Fixes for Reading Barcodes from an Image - III
Please Sign up or sign in to vote.
13 Aug 2012
gggustafson
This article discusses two lessons learned during the development of a mobile application.
Please Sign up or sign in to vote.
25 Jan 2015
syed shanu
XBAR and Range Chart using C#
Please Sign up or sign in to vote.
7 Aug 2016
Sonne170
Preserving alpha channel drawing transparent PNGs
Please Sign up or sign in to vote.
22 Aug 2012
wborgsm
How to draw muliline formatted text on a System.Drawing.Graphics object.
Please Sign up or sign in to vote.
24 Jun 2015
Khaled Abdelhamid
Drawing on a web page on the fly using GDI+ and Flood-Fill Technique
Please Sign up or sign in to vote.
2 Nov 2015
Farhad Reza
We will design two interesting characters in this tip. The first one is Code Project Bob sticker and the second one is Magpie bird which is the national bird of Bangladesh.
Please Sign up or sign in to vote.
21 May 2020
Patrick Eckler
Updated AForge.NET Version 2.2.6
Please Sign up or sign in to vote.
11 Apr 2010
Mohammad Elsheimy
Give the user the flexibility to design his sheet, report, bill, invoice, whatever.
Please Sign up or sign in to vote.
6 Oct 2010
guidebee
Code example on how to draw enhanced graphics 2D pictures on Windows Mobile
Please Sign up or sign in to vote.
20 Apr 2011
Henry Minute
As Manfred has said, convert your Path to a Region and use the Region.IsVisible(Point)[^] method.
Please Sign up or sign in to vote.
5 Jun 2011
georgezou1000
2 alternatives  
When BMP image is very large image (1700 x 1700), PixelFormat becomes 0.[Thanks for all the reply - The problem is solved by parser the bmp myself.]
Please Sign up or sign in to vote.
9 Jul 2011
DaveAuld
There is a technical blog article on the subject;Face Recognition Project: Introduction To Face Recognition[^]
Please Sign up or sign in to vote.
2 Jan 2012
Style-7
Must be:if( post.x >= nodeX[j]-5 && post.x = nodeY[j]-5 && post.y
Please Sign up or sign in to vote.
29 Jan 2012
Richard James Moss
This post describes how to create a GroupBox control similar to those used in Microsoft Outlook
Please Sign up or sign in to vote.
21 May 2012
Sergey Alexandrovich Kryukov
You can improve the speed and also simplify your development by not using the class PictireBox. This class is helpful in some simplest situations, when you need to show some static picture, or maybe change it sometimes. When you try to do something dynamic, interactive, animated, etc, this class...
Please Sign up or sign in to vote.
16 Jun 2012
Dave Kreskowiak
You don't need the Panel at all.Create your own DGV class by inheriting from it, then override the OnPaint method with something like:Public Class MyDGV Inherits DataGridView Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs) ...
Please Sign up or sign in to vote.
6 Nov 2013
enhzflep
Okay then, well where to begin?I looked at this problem from a bunch of angles, I must've pondered and tried 1/2 a dozen combinations of approaches, but I think I've found one that is workable.Basically, the idea is to do all the drawing on the dialog/window itself and then use button...
Please Sign up or sign in to vote.
15 May 2014
a_pess
Image File Format
Please Sign up or sign in to vote.
19 Sep 2020
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.
Please Sign up or sign in to vote.
9 Mar 2016
The Zakies
C++ / CLI into to using C++ CLI and using GDI library
Please Sign up or sign in to vote.
8 May 2009
Thomas Scheelhardt
Provides an implementation of an ImageButton that will grey out when disabled
Please Sign up or sign in to vote.
17 Dec 2009
0x3c0
This depends on how far you are through the process. If you've got the image of the cheque stored on the computer, then you simply use Image.FromFile to load it in, get a Graphics instance using Graphics.FromImage, then use the Graphics.RotateTransform[^] method.From there you can either...
Please Sign up or sign in to vote.
3 Mar 2010
tolw
I'm not sure why you are using a timer to draw, but if it is a circle you want, and for some reason you do not want to use the Graphics::DrawEllipse methot, than you should deffinately look at parametric equations first (Click[^])I refuse to give you a redy to use code, as I think you can...
Please Sign up or sign in to vote.
3 May 2010
micahs
Making Cross Domain jQuery AJAX Calls
Please Sign up or sign in to vote.
18 May 2010
William Winner
You can also programmatically add event hooks. You can write your event handler, so in this case the shell isprivate void panel_Paint(object sender, PaintEventArgs e){}Then, whenever you add a new panel to the form, you add an event handler to that panel like so:Panel newPanel =...
Please Sign up or sign in to vote.
13 Dec 2010
johannesnestler
You have to copy the color palette too! dstImage.Palette = source.Palette;Btw. you should fix your pointers when using unsafe code!http://msdn.microsoft.com/en-us/library/f58wzh21(VS.80).aspx[^]I used the following version of your snippet:public static unsafe Bitmap...
Please Sign up or sign in to vote.
6 Jan 2011
Tefik Becirovic
They do not need to worry about a rotation because all transformation will be added after the path creating: // Create a RoundedRectangle: GraphicsPath path = RoundedRectangle.Create(20, 20, 100, 100, 15); // Draw the created RoundedRectangle: ...
Please Sign up or sign in to vote.
26 Jan 2011
Nish Nishant
Typically this is done using the Bitmap.MakeTransparent method.Example here: http://msdn.microsoft.com/en-us/library/8517ckds.aspx[^][Update]-------------Relevant thread on S.O.:http://stackoverflow.com/questions/388677/can-you-make-an-alpha-transparent-png-with-c[^]
Please Sign up or sign in to vote.
9 Sep 2011
a_pess
Turn an image to a ColorPicker.
Please Sign up or sign in to vote.
25 Sep 2011
Philippe Mori
The line if(color = 255,255,255) probably does do what you think it does.First, in C++, operator = is assignment operator and not equality operator.Second, in C++, a comma allows multiple expressions when normally one expression is expected and the result is taken from the rightmost...
Please Sign up or sign in to vote.
2 Jan 2012
Jochen Arndt
Try this and think about the logical operators:if(post.x>=nodeX[j]-5 && post.x=nodeY[j]-5 && post.y
Please Sign up or sign in to vote.
4 Jan 2012
XSON-NEON
2 alternatives  
Hello everyone.First of all, sorry for my bad english.Using:Visual Studio 2005Visual Basic.NETI'm developing a small Media Player, an application which can play most popular music formats, and can view some image formats.I have my custom control (called BtnEx) that inherits...
Please Sign up or sign in to vote.
19 Jun 2012
MuhtarQong
There is no a way to draw 16bppGrayScale bitmap directly using GDI+.Because you can not get Graphics object from Format16bppGrayScale image. Namely: Bitmap bitmap = new Bitmap(256, 256, PixelFormat.Format16bppGrayScale); Graphics g =...
Please Sign up or sign in to vote.
5 Jul 2012
Prasad_Kulkarni
GDI stands for Graphic Device Interface.Windows GDI+ is a class-based API for C/C++ programmers. It enables applications to use graphics and formatted text on both the video display and the printer. Applications based on the Microsoft Win32 API do not access graphics hardware directly....
Please Sign up or sign in to vote.
9 Jul 2012
armagedescu
First you need to open the right theme from the current skin:hThm = OpenThemeData(hWnd, L"WINDOW");After that you may draw the needed thing with DrawThemeBackground,DrawThemeBackground( hThm, hDC, WP_CAPTION, CS_ACTIVE, &rc, 0 );
Please Sign up or sign in to vote.
20 Feb 2013
Richard MacCutchan
You are recursively calling the Fill method without ever checking if you have reached any of the edges of the picture.
Please Sign up or sign in to vote.
17 Mar 2013
Sergey Alexandrovich Kryukov
You don't really need to represent a string as a graphic path for proper transform. Transformations are done using...
Please Sign up or sign in to vote.
28 May 2013
Talking Dotnet
How to execute/run multiple Ajax requests simultaneously
Please Sign up or sign in to vote.
17 Oct 2013
AlwaysLearningNewStuff
4 alternatives  
INTRODUCTION AND RELEVANT INFORMATION:FORMER TITTLE OF THE QUESTION:Window produces flicker-like ( slow repainting-like ) effect when resizedI have a complex painting to implement in my main window’s WM_PAINT handler. I have submitted a link to the picture that describes it,...
Please Sign up or sign in to vote.
3 Dec 2013
Sergey Alexandrovich Kryukov
Flicker can be in part caused by the Windows message WM_ERASEBKGND which you can handle to do nothing, as explained here: http://stackoverflow.com/questions/2473799/gdi-double-buffering-in-c[^] (see answer 3).A widely used "brute-force" way of removing flicker is the use of optimized double...
Please Sign up or sign in to vote.
24 Sep 2014
Tero Koistinen
I know this is late, but for persons struggling with same problem, you could try to set FillMode of path to FillMode.Winding like so:...clipPath.FillMode = FillMode.Winding;e.Graphics.SetClip(clipPath, CombineMode.Exclude);
Please Sign up or sign in to vote.
13 Dec 2014
Afzaal Ahmad Zeeshan
The first step would be to create the Graphics object to work for the drawing. You cannot draw directly, you are required to create a Bitmap, and use the Graphics object to create different things on it. You can create your own Bitmap, by passing your pictureBox (Image) to it, and make the...
Please Sign up or sign in to vote.
28 Sep 2015
Farhad Reza
This tip describes the use of GDI+ with F# language through Flag design.
Please Sign up or sign in to vote.
11 Dec 2015
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[^]
Please Sign up or sign in to vote.
19 Feb 2016
Sergey Alexandrovich Kryukov
I eccentially gave you the answer in my last comment, the one with "A-C-B" and "X-C-Z" angles. Before you clarify your problem, I can give you a solution for the simple roulette you are trying to depict, a flat roulette.Here is the idea. As it seems that you have no problems with rendering...
Please Sign up or sign in to vote.
27 Mar 2016
Sascha Lefèvre
Quote:Others say that although this is important, they don't actually do much in terms of memory issues.When not using using-statements the CLR eventually comes around to cleaning up those objects but there's no guarantee on when this will happen. So it can lead to inconsistent behaviour. When...
Please Sign up or sign in to vote.
29 Jan 2018
Shao Voon Wong
Fixing Inconsistent Stroke Width of Chinese Characters
Please Sign up or sign in to vote.
20 Jun 2014
Virendra Kulkarni
Steps to implement the “Fit picture to fill the shape” option in PowerPoint like applications using GDI+
Please Sign up or sign in to vote.
2 Sep 2008
Uri91
1 alternative  
Hello,I'm a high-school student seeking to learn about 3D programming. I have experience with C# and C++, OOP and more.I don't have any intentions of making high-grade stuff with 3D, but I do want to learn something that I might use in the...
Please Sign up or sign in to vote.
2 Sep 2008
John_Adams
Hi,I would suggest you to visit the following links to know the difference between WPF, DIRECTX and XNA.http://forums.xna.com/forums/t/5278.aspx[^]http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=257213&SiteID=1[^]Hope this helps ...
Please Sign up or sign in to vote.
4 Dec 2009
Christian Graus
wrote:the only thing that i found is GDI+ programming but it seems so difficult.GDI+ is how all controls are drawn. It's your only option. You need to make your controls owner drawn and write GDI+ code to draw them as you desire them to look. There's tons of articles here on Code Project...
Please Sign up or sign in to vote.
4 Dec 2009
Abhinav S
If you are looking at starting your project from scratch, you could use WPF or Silverlight instead of winforms. These provide awesome control styling and customization features.
Please Sign up or sign in to vote.
7 Oct 2011
Rick Shaub
Maybe you could try using the original image and calling TranslateTransform(). The code would look something like this (Warning: not tested): float width = bitmap->GetWidth()* Scale;float height = bitmap->GetHeight()* Scale; Graphics* graphics = new...
Please Sign up or sign in to vote.
9 Jan 2010
Christian Graus
Two things:1 - the framework ALWAYS creates a Bitmap, even if you ask for an Image instance. At least, it does in .NET.2 - If your core issue is one of speed, the only possible explanation I can see is that you're leaking memory. The GDI+ system does NOT make copies that are somehow...
Please Sign up or sign in to vote.
10 Jan 2010
Christian Graus
I don't really understand - why do you even need to do this ? A bmp is uncompressed, but a gif, a jpeg, a bmp, etc, all take the same format when they have been loaded in memory.What do you mean 'have no effect' ? Does the image not get saved ? Is it not a bitmap ? If you had a 24 bit image...
Please Sign up or sign in to vote.
10 Jan 2010
Christian Graus
Please edit your post instead of posting answers that are really questions.Have you stepped through the code in your debugger ? Is a file created at all ? Is your resource loading properly ? I would start by replacing your current handle to save with one you load from disc, of the same file....
Please Sign up or sign in to vote.
28 Jan 2010
Elof Wecksell
3 alternatives  
Hi there fellow coders!I've ran into a GDI+ problem. I'm coding C# on .NET Framework 3.5. The problem I'm having is slow response in my application when drawing with my own-developed graphics tools. I'm drawing via the MouseMove events of a Control and the CreateGraphics() method on the...
Please Sign up or sign in to vote.
29 May 2010
vbn1antu
3 alternatives  
Hello Sir, I am Vinay From India. I have a problem in my project user interface that i have created office 2007 like interface.Every thing is similar to office 2007 without using paint event of any control nor ribbon controls. I have started creating office 2007 controls from scratch but...
Please Sign up or sign in to vote.
22 Jun 2010
OriginalGriff
I've never tried a 136MB TIF, but I have dealt with BMP and JPG files that are much larger than that without problems. Edit your existing code, and show us the method that the exception is occurring in - enclose it with the "code block" widget to preserve the formatting.
Please Sign up or sign in to vote.
22 Jun 2010
Sandeep Mewara
ephrem33 wrote:a .tif image of 136MB sizeThats a big one! I would suggest you to transform into lighter image type and then try to use it. Further, large images like these would be difficult to save and retrieve. Otherwise, have a look at this thread, sounds similar thing with...
Please Sign up or sign in to vote.
22 Jun 2010
Ryan McBeth
I agree with Sandeep. I wrote a camera driver for Windows CE once. Most of my experience with images comes from Windows CE / Mobile, so I can't fully speak for exactly what is going on in Win32, but I would assume that there are similarities. That image is really getting loaded twice...
Please Sign up or sign in to vote.
31 Aug 2010
helianthus87
Do you asking about some math to calculate angle between 2 vectors to check the arc? You mentioned about 3 points and i asume there is something like this:[how do i see this]then you need to calculate angle or check dot product between 2 vectors and according to result you will be able...
Please Sign up or sign in to vote.
17 Sep 2010
CDP1802
A quick search on Google(!) led me to this article here:Adding GIF-animation using GDI+[^]
Please Sign up or sign in to vote.
5 Oct 2010
ely_bob
Use XNA, this has all the stuff that you need without going into the 3d portion of the API..and in the long run if you want to do things like sparkles, music, explosions.. or whatever else to augment your game you would have easy access to that stuff through XNA.GDI, and it pains me to...
Please Sign up or sign in to vote.
4 Nov 2010
tlillys
1 alternative  
I'm attempting to extend an unmanaged VC++ 6.0 OCX that uses GDI for displaying images and drawing simple graphical elements - lines, points, and rectangles. I am trying to add translucent polygons on top of these elements. Based on articles found here, I believe I've made the code GDI+...
Please Sign up or sign in to vote.
24 Nov 2010
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.
Please Sign up or sign in to vote.
2 Dec 2010
Emilio Garavaglia
"Provide me the solution" seems implying there must be one and only. But the question is strange, since it mixed up two distinct aspects.Drawing on a bitmap is something that happens in memory, and has no relation with the action of invalidate(), whose purpose is to force the window manager...
Please Sign up or sign in to vote.
3 Dec 2010
xenotron
The window does not have a persistent canvas/bitmap associated with its surface. The system can overwrite a protion of your window on the screen any time, and it can call you any time with a WM_PAINT to ask you to redraw the 'destroyed' part of the window image on the screen.The drawing...
Please Sign up or sign in to vote.
4 Dec 2010
Bezawit
3 alternatives  
Hi guys. I am using a UserControl to load a .tif file on it. After that I am using the GDI API to draw lines and rectangles on top of the Image loaded into the UserControl. So far that is working fine. But the thing is, when ever I draw a new Rectangle/Line on on the UserControl, the UserControl...
Please Sign up or sign in to vote.
13 Dec 2010
Akinola Falola
1 alternative  
public Bitmap Background(Bitmap source) { width = source.Width; height = source.Height; BitmapData srcData = source.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, source.PixelFormat); byte*...
Please Sign up or sign in to vote.
28 Mar 2011
jgui
1 alternative  
In the following article:Finding a Bitmap contained inside another BitmapThere is GDI+ method to load bitmap before use of LockBits funtion. We ant to use only PixelFormat24bppRGB because then we want LockBits to determine pixels of bitmap. It works pretty well, when we use .bmp image as...
Please Sign up or sign in to vote.
28 Mar 2011
OriginalGriff
The first thing that springs to mind is that you are using the wrong numbers: you have decalared a bitmap that is 16 pixels by 16 pixels, but you are drawing outside the bitmap area: pixels 0-16 inclusive.This shouldn't cause a problem though, the extras should be outside the clipping region...
Please Sign up or sign in to vote.
2 Apr 2011
Hans Dietrich
You need to do the drawing in the OnPaint() handler.
Please Sign up or sign in to vote.
20 Apr 2011
Sergey Alexandrovich Kryukov
All other answers are not quite correct. They only help to define visible area or process mouse events in a special way. The ultimate solution is this:Use Windows API SetWindowRgn on a button HWND. It will shape a buttons Windows to a region in all aspects, not just visual, but the mouse...
Please Sign up or sign in to vote.
4 May 2011
OriginalGriff
Well, you could start by looking at the way you tell the Paint method what it has to draw.Since you have to tell it something, that something is what you need to save.How to save it? Can't say - without knowing at least something about what you are drawing from, and what media you have...
Please Sign up or sign in to vote.
8 May 2011
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...
Please Sign up or sign in to vote.
9 Jul 2011
thatraja
Addition to Dave's answer.Found a bunch in CPHuman Emotion Detection from Image[^]Pupil or Eyeball Detection and Extraction by C# from eye image[^]Face Detection in C#[^]Face and Eyes Detection Using OpenCV[^]Efficient Face Detection Algorithm using Viola Jones method[^]Face...
Please Sign up or sign in to vote.
10 Aug 2011
Emilio Garavaglia
This seems written to answer your question ...Using GDI+ with MFC or native C/C++[^]
Please Sign up or sign in to vote.
2 Sep 2011
BillWoodruff
There's a great resource here on CP[^], "CircleControl - A Circular Motion Control" by Graham Wilson that shows how to create 'circular' controls.I am sure you can study his code and adapt his geometric calculations to use when you need to scale up and reposition your clock-numbers.best,...
Please Sign up or sign in to vote.
8 Oct 2011
johannesnestler
Hi John,I think you shouldn't do it like this. You create a Graphics object out of your picture and then redraw the picture to the same object, this is why you still see the "old" pictures (they are still on the graphics). I'd avoid the problem like this: just remove the complete cloning and...
Please Sign up or sign in to vote.
10 Oct 2011
Anthony Mushrow
GDI+ is using matrices internally to sort out your transformations. So you need to be careful which order you do them in, for example if you had a sphere which you moved and then rotated it would be like the earth moving around the sun, if you rotated then moved it would be like the earth...
Please Sign up or sign in to vote.
10 Oct 2011
Manfred Rudolf Bihy
Hi John,after the RotateTransform and ScaleTransform call the graphics context will apply the appropriate transformations before drawing anything. Since you specified the point where to draw along with the DrawImage method, this is the point the image will be rotated around. To do the moving...
Please Sign up or sign in to vote.
12 Oct 2011
OriginalGriff
There are a couple of ways to avoid this, but they depend on where you are doing the drawing. Are you using the Paint event? If not, why not? It even provides you with the required Graphics object!If you are using the paint event, then try setting the DoubleBuffered property of the container...
Please Sign up or sign in to vote.
30 Nov 2011
Manoj K Bhoir
Try the following link :A Vector Type for C#Or Check following Code :VB.Net Code :Public Shared Function ON_3dVectorAngle(ByVal v0 As On3dVector, ByVal v1 As On3dVector) _ As Double ' Unitize the input vectors v0.Unitize() v1.Unitize() Dim dot As Double =...
Please Sign up or sign in to vote.
4 Jan 2012
Sergey Alexandrovich Kryukov
Please do some sanity check of all of three parameters of the call: image (should be valid, not null), matching positive width and height. This is hard to do under debugger as Design mode is involved. To investigate the situation, you can use the class System.Diagnostics.EventLog, see...
Please Sign up or sign in to vote.
9 Feb 2012
Sergey Alexandrovich Kryukov
This is not a question. However, if your problem is that you don't like the quality of the picture which you enlarge, I can answer. Can you keep a secret? Listen then: there is no such thing as miracle.[EDIT] A reply to the follow-up discussion.They graphics should be vector in this...
Please Sign up or sign in to vote.
9 Mar 2012
Grigory Avdyushin
Short description how to create a sexy badge for windows 7 taskbar
Please Sign up or sign in to vote.
13 Apr 2012
Misol1
1 alternative  
Hello all, We started to encounter a bizzare problem with TAdvGlassButton buttons from TMS Software under Delphi2007. Sometimes they simply do not show, and if so, then all of them, across whole application. The point is, that the buttons are there, they react to events (you have to know...
Please Sign up or sign in to vote.
14 Apr 2012
Mike Hankey
That's a tricky one but I believe it's in the interpolation mode you are using.On the form I enable DoubleBuffering andf commented out the Interpolation mode and it seems to have fixed the problem.
Please Sign up or sign in to vote.
9 Jul 2012
Trak4Net
I think it might have something to do with how you are getting your graphics object. Using the graphics object from the paint eventargs has different results than using this.CreateGraphics. If you do NOT enable visual styles for the application then the results are the same. ...
Please Sign up or sign in to vote.
10 Jul 2012
olivewarbler
1 alternative  
I'm writing a custom control that contains some text that I want to put an outline on it using this code:e.Graphics.DrawPath(New Pen(New SolidBrush(OutlineColor), OutlineSize), TextPath)But when the outline is rendered, it has lines jutting out some of the letters and I don't know how to...
Please Sign up or sign in to vote.
10 Jul 2012
olivewarbler
I found an answer! If I set the pen's linejoin property to round, they disappear!
Please Sign up or sign in to vote.
15 Jul 2012
Trak4Net
I did something similar years ago. Here was a comment I left in my code, plus a bit of the code. Hope this is helpful...'ok now its 1:20AM and I figured out that the reason they have to be applied in reverse is because that is the order (BGRA) Dim r, g, b As Integer b =...
Please Sign up or sign in to vote.
13 Jul 2012
OriginalGriff
It can be done, but not using standard text and font methods.You would have to create each character as an animation and display that - font based characters are "there" or "not there" - they do not have a concept of stroke order which is what you would need.
Please Sign up or sign in to vote.
17 Jul 2012
Trak4Net
Ok this is fully functioning and tested by outputting stored pixels back out and verified image is correct. Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ComparePixelReads() End Sub ''' ''' Compares the...
Please Sign up or sign in to vote.
26 Jul 2012
Dave Kreskowiak
You're not painting an image to a Bitmap object. You're painting the image to the screen inside the bounds of the PictureBox control.The Graphics class has a method, FromImage, which will return a Graphics object that can be used to draw to the Bitmap instance you create. Dim myImage...
Please Sign up or sign in to vote.
26 Jul 2012
enhzflep
Okay, here you go. I can't explain the code, since I'm not familiar with .NET and have just cobbled this together using the ode code copied from here: How to: Create a Bitmap at Run Time[^]I have a form, with one button and one PictureBox. It's called PictureBox1aPublic Class Form1...
Please Sign up or sign in to vote.
7 Nov 2012
Jochen Arndt
Using comments the problem has been clarified and I will give a summary here as solution.The Invalid Parameter error code 2 indicates that one or more of the DrawString() parameters are invalid. So they must be checked. Many GDI+ plus objects are constructed with parameters. Because...
Please Sign up or sign in to vote.
25 Nov 2012
Sergey Alexandrovich Kryukov
Try to use pen width less or equal to zero. It will work as you wanted, representing the metaphor of "infinitely thin" lines while scaling.—SA
Please Sign up or sign in to vote.
9 Dec 2012
Sergey Alexandrovich Kryukov
I assume you know how to draw the curves but have a problem with drawing on bitmaps. Here is how you do it: you create a bitmap, obtain and instance of the System.Drawing.Graphics for this bitmap, and use it for drawing. Something like:int width = //...int height =...
Please Sign up or sign in to vote.
9 Dec 2012
Sergey Alexandrovich Kryukov
There is no such thing as "force" to run something to "run on a single process". Processes are totally under your control. If you don't create a process, it is not created by anything by itself. And using GC is not recommended.Your "without going too much into assemblies and stuff like that"...
Please Sign up or sign in to vote.
29 Dec 2012
Christian Graus
Looks OK. But it's not really that great a 'boost', esp if your image was 24 bit to start with ( the other 8 bits are not used ).Unless you're using a Commodore 64, or using GDI+ for things it's not good for ( i.e. games ), this won't really speed things up much.
Please Sign up or sign in to vote.
15 Jan 2013
Sergey Alexandrovich Kryukov
Please see my comment to the question. There is no "merge", there is disjunction, conjunction, etc.Here is my advice. Go step by step in finer detail. For that, don't use combine mode, but perform explicit operations on region objects. Disjunction is done using the Union methods, conjunction...
Please Sign up or sign in to vote.
21 Feb 2013
DidiKunz
Save a 32-Bit RGBA-Bitmap in the Truevision Targa Format
Please Sign up or sign in to vote.
3 Mar 2013
Sergey Alexandrovich Kryukov
Thank you for clarification. I think you already almost have a good solution.The only concern I would have is having some paths the be recreated on paint. It's clear that it's not needed. You can pre-create some "library of shapes" in the form of some paths and store these objects as some...
Please Sign up or sign in to vote.
30 Apr 2013
YDaoust
If you need to be able to perform a single Undo after a series of changes, saving the whole image is good enough. It can even be the best solution if changes are numerous. (A list of changed pixels is less compact as you need to store the coordinates as well as the old argb).If you wand to...
Please Sign up or sign in to vote.
28 May 2013
Ugly Moe
1 alternative  
I am writing code to retrieve image data from OpenGL into a GDI+ Bitmap. While doing so I ran into something odd.Given the following definitions: Gdiplus::BitmapData bmData;Gdiplus::Rect gRect(0, 0, 1225, 753);The following call returns a stride of 4900 in...
Please Sign up or sign in to vote.
5 Jun 2013
YvesDaoust
Deepak,let us start with your statement that you can classify the pixels as being background (in your example the white ones, that you painted red) or not background.The effect along edges is indeed awful because of the sharp decision background/not background. To achieve better results,...
Please Sign up or sign in to vote.
25 Jun 2013
CPallini
You may achieve such kind of 'movement' by re-drawing continuosly (you might, for instance use a timer) at the same position, a different portion of your string.Suppose you have the string "hello world!", you may go on as follows:TimeString at X position0hello world!1ello world!2llo...
Please Sign up or sign in to vote.
25 Jun 2013
nv3
I would place an owner draw static control in your dialog or your main window. In the DrawItem function I would draw the text with a calculated starting point.At first the x-component of the starting point is the right border of your client area. As time progresses you would move the...
Please Sign up or sign in to vote.
15 Oct 2013
KarstenK
Drawing is "heavy lifting" so you should optimize your drawing code, by using global or static Images and image information.Consider a global MemDC in which are booth images (at different coordinates) and other optimizations. ;-)
Please Sign up or sign in to vote.
19 Oct 2013
Captain Price
In your window procedure, change this line at the top:Image image(L".\\resources\\BG.emf"), image1(L".\\resources\\RGF.png");to this:static Image image(L".\\resources\\BG.emf"), image1(L".\\resources\\RGF.png");Then debug your program, open Task Manager and see the difference...
Please Sign up or sign in to vote.
19 Oct 2013
enhzflep
Hi, there are a number of different issues with your ccode - all of which degrade performance in one way or another.When I first tried your program, I resized it continuously for about 20 seconds then logo1 and logo2 dissapeared! Combined with your question this led me to suspect gdi leaks...
Please Sign up or sign in to vote.
22 Oct 2013
OriginalGriff
A quick check with your code in the paint event of a panel gives we the 180 working fine - but I can't use your DrawRectangle.GetNormalizedRectangle method because I don't have it, so I used TranslateTransform instead: g.TranslateTransform(myDrawingPanel.Width,...
Please Sign up or sign in to vote.
29 Oct 2013
Sergey Alexandrovich Kryukov
You can use System.Drawing.Graphics.Transform:http://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspx[^],http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.aspx[^].The idea is changing transform back and forth as you go from one draw primitive...
Please Sign up or sign in to vote.
31 Oct 2013
Ron Beyer
Because Graphics.Transform returns a copy of the transformation matrix, not the matrix being used. In order to do what you want, you would need to do something like this:'Inside your loope.Graphics.Transform = e.Graphics.Transform.RotateAt(5 ...)But you would want to save your...
Please Sign up or sign in to vote.
5 Dec 2013
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...
Please Sign up or sign in to vote.
12 Dec 2013
OriginalGriff
That's about this close >
Please Sign up or sign in to vote.
14 Feb 2014
stevehoang
Don't forget to call DeleteEnhMetaFile, otherwise the file will be locked by the application
Please Sign up or sign in to vote.
1 Mar 2014
davidbakin
I think the clue is that 4900 is not divisible by 8 but 4904 is. I suspect that the reason is that GDI+, when using PixelFormat32bppPARGB, is chosing a representation - including stride - that is closer to that expected by some lower level API or manipulation, giving better efficiency overall...
Please Sign up or sign in to vote.
16 Jun 2014
Richard MacCutchan
Take a look at GDI Drawing and Printing[^].
Please Sign up or sign in to vote.
16 Jun 2014
Richard MacCutchan
I have discovered that the issue is to do with the default unit settings in the Graphics class, as described in http://msdn.microsoft.com/en-us/library/ms535812(v=vs.85).aspx[^]You need to use the following line of code to set it to pixels.g.SetPageUnit(UnitPixel);That now works in XPS...
Please Sign up or sign in to vote.
29 Nov 2014
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...
Please Sign up or sign in to vote.
9 Dec 2014
Dave Kreskowiak
OK, everyone is focused on the Pen. That's not the problem in the code you posted.Well, there is one small problem where you're not disposing the Pen before your app terminates. This will lead to a handle leak and eventually break Window but you have to run this app over and over again,...
Please Sign up or sign in to vote.
28 Apr 2015
Sergey Alexandrovich Kryukov
Before starting to deal with any runtime issues, throw out this code and write it in human way. Look at the two first lines inside the implementation of LoadImgFromGDIP: you call LoadLibrary again and again with the same DLL. This is not yet a reason for some runtime failures, but this is more...
Please Sign up or sign in to vote.
13 Dec 2015
Member 10412197
2 alternatives  
I'm currently making a node diagram control for Winforms, the control inherits from the Container class. The control can contain nodes, and a node is basically just an "empty" class with properties, so nodes are handled by the control (drawn, moved, etc).My control needs to support zooming...
Please Sign up or sign in to vote.
9 Apr 2019
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...
Please Sign up or sign in to vote.
23 May 2019
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...
Please Sign up or sign in to vote.
12 Jul 2019
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[^]
Please Sign up or sign in to vote.
23 Oct 2009
cjbarth
Tool to magnify a screen including layered windows and transparency. Useful for media centers.
Please Sign up or sign in to vote.
30 Nov 2009
Christian Graus
You can't draw it as you need it, you need to store it and show it. GDI+ is not efficient for real time stuff.
Please Sign up or sign in to vote.
30 Nov 2009
happydebug
I do store it and then show it,But as the width of the glow increase it will take me too much time to achieve that!!!Can you show me something more detailed!
Please Sign up or sign in to vote.
30 Nov 2009
AspDotNetDev
How slow does it render and how fast do you want it to render?
Please Sign up or sign in to vote.
30 Nov 2009
happydebug
A 10 pixel width glow effect will take me about 200ms!!!How can I improve that!
Please Sign up or sign in to vote.
30 Nov 2009
AspDotNetDev
You could always make a pixel shader to perform the glow effect on the GPU, but GDI+ doesn't support pixel shaders as far as I know. DirectX supports pixel shaders though.
Please Sign up or sign in to vote.
30 Nov 2009
happydebug
I will make a string path and then call drawpath several times! The function of drawpath takes too much time to excute itself!I have tried other ways,but they just don't make sense!!
Please Sign up or sign in to vote.
30 Nov 2009
AspDotNetDev
Well, if you want an algorithmic solution, you could try something I call a "voronoi gradient". Basically, you start with a set of pixels (in this case, they would be the rendered text). You then spawn "bots" from each of those pixels (and those bots remember the pixel they started on as their...
Please Sign up or sign in to vote.
30 Nov 2009
AspDotNetDev
Oh, and to add to my previous answer, there is a faster and more flexible way of doing things.Render each character you plan on using (say, a-z, 0-9, plus puncuation) using the largest glow you expect to use. Split up colors into arrays based on their intensity (using the method I described...
Please Sign up or sign in to vote.
30 Nov 2009
happydebug
Okay! I get to think over about that!Thanks, you make get a new idea!A solution!!!
Please Sign up or sign in to vote.
4 Dec 2009
Sam Rad
2 alternatives  
Hi everyoneI am novice and i would like to customize .NET Controls style and appearance but no success yet. I don't want to use third party controls.the only thing that i found is GDI+ programming but it seems so difficult. for example i want to create a button with inner shadow on...
Please Sign up or sign in to vote.
11 Dec 2009
balasubramaniyan94
1 alternative  
What manner of arcane magic must I invoke to determine how many bits are in each pixel of a BMP image, and also divine its color code format (whether it is a gray-scale image or an RGB image)?
Please Sign up or sign in to vote.
13 Dec 2009
Naruki
Here, let me Google that for you[^].
Please Sign up or sign in to vote.
17 Dec 2009
aswathstorm
3 alternatives  
Hi guys, this is my first ever question in this forum.My problem is, we are developing a cheque printing software; for that, we are placing the cheque in the printer at an angle of 90 degrees (because of the paper size). To correct this, I need to print the cheque in the tilted angle of 90...
Please Sign up or sign in to vote.
29 Dec 2009
moroshko
2 alternatives  
Hello,I created a new C# Windows Application in Visual Studio 2008, and added a Panel (from the Toolbox) to the Form.But, I don't see the MouseWheel event of the Panel.Panel derives from Control, which does has the MouseWheel event.So why Panel does not have the MouseWheel event...
Please Sign up or sign in to vote.
29 Dec 2009
lw@zi
That is because Panel is used as a container and it does not gets focussed. Only the controls inside it get focus. So, if you have a Panel in a form and do a MouseWheel on panel, form's event will be fired and not the Panels.In case any of the control inside panel has focus, it's mouse wheel...
Please Sign up or sign in to vote.
29 Dec 2009
moroshko
I understand !Thank you for the great answer !
Please Sign up or sign in to vote.
29 Dec 2009
moroshko
5 alternatives  
Hi,I would like to write a program that enable user to draw geometric shapes like circles, triangles, rectangles and so on.I would like also to be able to drag and drop or resize a shape that was previously drawn.1) I thought to draw the shapes inside a Panel. Does it seems reasonable...
Please Sign up or sign in to vote.
30 Dec 2009
moroshko
Hi,Thank you for the link, but all I want is to understand the idea rather than reading a lot of code.I do have some experience with drawing graphics in GDI+.At this point I just want to understand the idea of resizing/moving a circle for example.After I draw a circle, it becomes a part...
Please Sign up or sign in to vote.
30 Dec 2009
AspDotNetDev
Typically, you would store each shape in memory and each time a new shape is added, you redraw all those shapes to a new bitmap (and discard the old one).To detect which shape a mouse is over, the simple way is to check which shapes it collides with at that pixel, then select the top most...
Please Sign up or sign in to vote.
31 Dec 2009
moroshko
Hi,Regarding the pseudo-bitmap: Suppose I add 1 circle. In order to add this info to the pseudo-bitmap, I need to know all the pixels this circle takes.What is the best way to find all these pixels ?Thanks !
Please Sign up or sign in to vote.
1 Jan 2010
AspDotNetDev
Each pseudo-pixel could store a class that has a property that stores the shape that drew that pixel (that class could also store other information about that pixel, such as z-index, if need be). Draw the shapes from the back to the front, so shapes on top overwrite shapes below them. When a...
Please Sign up or sign in to vote.
7 Jan 2010
Rick Shaub
Is using a PictureBox control out of the question? Because you can set the Image property equal to the Bitmap and set the PictureBox's SizeMode property to PictureBoxSizeMode.Zoom. Then you can just resize the PictureBox and the Bitmap will automatically resize and maintain its aspect ratio. ...
Please Sign up or sign in to vote.
7 Jan 2010
Sogeking74
>>Maybe you could try using the original image and calling TranslateTransform()I tried your suggestion. It didn't work. Tried something similar to that code, but all was futile. And also is seems that you can't draw image itself that way. Had to make another Bitmap to make it work somehow....
Please Sign up or sign in to vote.
7 Jan 2010
Rick Shaub
Maybe Image::GetThumbnailImage http://msdn.microsoft.com/en-us/library/ms535394(VS.85).aspx[^] will help.
Please Sign up or sign in to vote.
7 Jan 2010
Sogeking74
Image::GetThum...
Please Sign up or sign in to vote.
8 Jan 2010
Rick Shaub
I found another example here[^]. This may help you, although it looks very similar to your solution:Draw in a Graphics object associated with a new Bitmap: class BitmapEx : public Bitmap {public:inline Bitmap* StretchClone(INT nWidth, INT nHeight);public:virtual...
Please Sign up or sign in to vote.
8 Jan 2010
Sogeking74
I used this method for creating resized image in the past. It does not work as well =(.
Please Sign up or sign in to vote.
8 Jan 2010
Rick Shaub
Have you tried using the Image class instead of the Bitmap class? You may be adding uneeded overhead by converting a jpg to a bitmap and then resizing it.[Edit]I mean replacing all instances of Bitmap with Image, not just in the resize step.
Please Sign up or sign in to vote.
9 Jan 2010
Sogeking74
Tried it just now. No effect at all.upd:Back then I tried all possible options.
Please Sign up or sign in to vote.
9 Jan 2010
Sogeking74
Thanks Christian Graus)I really didn't try to save file. Just thought that it is something abnormal to do, though knew it could help in my issue and so it did.I still can't figure out what the problem. I don't see any difference between bitmap, loaded from file and a bitmap that was created...
Please Sign up or sign in to vote.
10 Jan 2010
zhouyujt
2 alternatives  
my project have a bitmap.but the bitmap is too big.i want it small.so i change the bitmap format from bmp to gif.than i add this gif to my project as a source.when my program is runing,i want change the picture format from gif to bmp agan.i write a function like tihs:BOOL...
Please Sign up or sign in to vote.
28 Jan 2010
Christian Graus
Elof Wecksell wrote:Im sorry, I've tried your solutions but it still is slow in response. Then you've probably hit the limits of GDI+ and need to use XNA, etc, yes. you could try using WPF, that gives you DirectX for free, kind of.
Please Sign up or sign in to vote.
8 Feb 2010
hkproj
2 alternatives  
Hi,a few days ago I saw an article (on the Codeproject's homepage) talking about processing an answers sheet (where answers are marked)..I cannot find it...Can you help me?Thank you.
Please Sign up or sign in to vote.
8 Feb 2010
Richard MacCutchan
You will need to go to the Articles page and search for it. You could start by scanning the latest articles first, if it was new within the last week.[edit]modified following note from Smithers-Jones[/edit]
Please Sign up or sign in to vote.
8 Feb 2010
Smithers-Jones
Richard, I doubt, that it was a new article, since this was hkproj's first contribution here and therefore he can't see unapproved articles.
Please Sign up or sign in to vote.
10 Feb 2010
Christian Graus
There is no built in support for this, AFAIK, I do believe there's a .NET sample on CP that does it, .NET uses GDI+, so perhaps you can look at that for more info on how to add support for it.
Please Sign up or sign in to vote.
11 Feb 2010
Aneev S
Thank you for the reply.But I'm sorry that i was not able to find the .NET sample. Anyway i'll explain my requirement in more detail.Currently I have a set of Images, say 10, which are stored as code stream. I would like to save these images as animated gif file, so that i can play back it...
Please Sign up or sign in to vote.
22 Feb 2010
Aneev S
3 alternatives  
Hi All,I'm trying to develop an application that saves a pixel information as bitmap file using VS2008 ( vc++ ). Currently, i have a byte buffer containing pixel data, which is in 1 bit per pixel format. The width and column of the image is 512 x 512. I used Lockbits() method to create the...
Please Sign up or sign in to vote.
19 Feb 2010
Christian Graus
Aneev S wrote:But the problem is that, from the bitmap it seems that some data has been lost and image is not clear.I assume you saved it as a jpg. The jpg file format does that.
Please Sign up or sign in to vote.
19 Feb 2010
AspDotNetDev
Show the code you used to create & save the BMP. It is common that the functions used to reduce the BPP will dither the image, which is likely what you are interpreting as "lost data".
Please Sign up or sign in to vote.
22 Feb 2010
Eugen Podsypalnikov
I would create and save the bitmap as following :) :... HBITMAP hBMP = CreateDIBSection(..);... CImage cImage; cImage.Attach(hBMP); cImage.Save(..);...
Please Sign up or sign in to vote.
24 Feb 2010
happydebug
1 alternative  
Refer to the title!I try to achieve that in any way I know!But none of them effects!
Please Sign up or sign in to vote.
24 Feb 2010
Gonzoox
SO, show us what you have tried, and we will take it from there
Please Sign up or sign in to vote.
25 Feb 2010
happydebug
1 alternative  
It seems that GDI+ can get the line space of the output text but can not set it!Is it right?
Please Sign up or sign in to vote.
25 Feb 2010
Richard MacCutchan
happydebug wrote:It seems that GDI+ can get the line space of the output text but can not set it!Is it right?These values depend on the font size so are set when you select a font into the DC (Device Context) that you are working on. However you are free to write your text anywhere within...
Please Sign up or sign in to vote.
9 Mar 2010
fjparisIII
How to use GDI+ code in a WPF application for lossless JPEG image rotation
Please Sign up or sign in to vote.
26 Apr 2010
galextudor
2 alternatives  
Ok, so I have a method inside which I cannot use This.close for it always crashes. The main operational block of the method is lower. Inside my method, all other things are mainly declarations or calls to other methods. Any ideas?for (int i = 0; i
Please Sign up or sign in to vote.
25 Apr 2010
Jordy "Kaiwa" Ruiter
You are talking about this.Close() and all but I don't see it anywhere in your code. Add more code if you want people to give you good awnsers. As for the gbmp this is your graphics stuff. Are you disposing it correctly before this.close() occurs?
Please Sign up or sign in to vote.
25 Apr 2010
Christian Graus
Do you open any bitmap files anywhere in your code ( jpg/png/etc ) ? That's usually where a problem causes the generic error.
Please Sign up or sign in to vote.
26 Apr 2010
dandanzhang000
1 alternative  
I need to draw a string on a png,but there is a problem,please help
Please Sign up or sign in to vote.
30 May 2010
Henry Minute
If you have in fact done as you say without using the paint event of any of the controls, then you have done very well.Unfortunately I do not know of any way to do what you want without overriding/using the paint event.
Please Sign up or sign in to vote.
30 May 2010
Abhinav S
You may need to build another control that simulates this "push" event. You could use some sort of a ToggleButton.
Please Sign up or sign in to vote.
30 May 2010
#realJSOP
Without seeing your code, we can't possibly help you beyond stating the obvious - "you're doing something wrong, or not doing something yo should be doing".
Please Sign up or sign in to vote.
30 Aug 2019
ephrem33
4 alternatives  
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...
Please Sign up or sign in to vote.
24 Jun 2010
lw@zi
The namespace is in PresentationCore.dll. You need to add reference to that.
Please Sign up or sign in to vote.
7 Jul 2010
Christian Graus
What makes you think you can 'only lock bits for a bitmap' ? Once it's loaded, it IS A bitmap, you think GDI+ keeps a jpeg in memory ? You're creating a bitmap from an image in memory. Are you sure that it contains JPEG data ? Why not load that info when you load the image and store it in memory ?
Please Sign up or sign in to vote.
31 Aug 2010
Christian Graus
There are articles on how to grab the screen. To grab a movie of the screen, you need to grab the screen over and over again and then turn those frames into a movie, basically.
Please Sign up or sign in to vote.
1 Sep 2010
HassBlass
2 alternatives  
how to draw arc ("real-time" like in CAD) from 3 points - precisely, how check (from cursor)it arc will be clockwise or counter-clockwiseUPDATE:http://a.imageshack.us/img230/2429/arcs.gifi know how to draw arc like this, but i dont know how to find when mouse cross the segment...
Please Sign up or sign in to vote.
31 Aug 2010
Christian Graus
you work out if it's clockwise or counterclockwise from the relative position of the points, surely ?
Please Sign up or sign in to vote.
10 Sep 2010
norrisMiou
1 alternative  
Hi !I sought much, but without success.I have a rounded rectangle made with a GraphicsPath and I want to have an inner bevel like in Photoshop.I can easilly drawing an "inner shadow" effect using a PathGradientBrush.The inner shadow is a good effect, but have only one color.Nobody on...
Please Sign up or sign in to vote.
10 Sep 2010
Chris Trelawny-Ross
There are two things to take into account when drawing bevels:1. the "lighting effect" behaves one way on the upper left half of the object, and the other way on the lower right half (brightening the UL, darkening the LR).2. you need multiple, nested, similar paths, that are inset from...
Please Sign up or sign in to vote.
17 Sep 2010
red_moon
1 alternative  
How to draw an animated image (e.g. gif, cursor) on a Graphics object in .Net ?
Please Sign up or sign in to vote.
4 Oct 2010
Martin Hinchy
1 alternative  
I'm converting a custom MFC control from GDI+ to Direct2D. The control sits on a dialog which has a bitmap background. I need to capture the portion of the dialog background which sits under the control so that I can render the background in the control's OnPaint() function. Is there a way to...
Please Sign up or sign in to vote.
5 Oct 2010
lrroberb
3 alternatives  
Hi,I want to program a simple card game in VB.NET. When I first did it in 2003 (In regular VB) I used PictureBox. But now a want a bit more advanced version were cards can rotate. The more I look into the subject the more I get confused. GDI is more advanced but does not have rotation....
Please Sign up or sign in to vote.
6 Oct 2010
Martin Hinchy
Ok, finally got this working. For anyone else who is interested, here are the steps required to capture the image from a device context and render it into a Direct2D render target. In my case I wanted to capture the image from an MFC CDialogEx dialog window that had a bitmap background.The...
Please Sign up or sign in to vote.
4 Nov 2010
Nish Nishant
Pardon me if you've already done this, but have you initialized GDI+ with a call to GdiplusStartup?
Please Sign up or sign in to vote.
27 Nov 2010
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
Please Sign up or sign in to vote.
2 Dec 2010
User 7429338
When you call invalidate(), a WM_PAINT message is sent.In your OnPaint[^]function, you can then do whatever is needed to redraw the picture (using the graphics class if you wish).
Please Sign up or sign in to vote.
3 Dec 2010
CRayGoodwin
Custom windows control that mimics Windows 7 diming & asynchronous aero progress animation
Please Sign up or sign in to vote.
4 Dec 2010
JOAT-MON
You could override the OnPaintBackground() function to control what/when it does its painting. Here[^] is a link to the MSDN, there is a note to inheritors about not calling the base.
Please Sign up or sign in to vote.
5 Dec 2010
Toli Cuturicu
Well, there are already 2 layers on every Control: the one painted by OnPaint and the one painted by OnPaintBackground. So, you can simply load your Image as the Control's BackgroundImage and draw all the other stuff in OnPaint.
Please Sign up or sign in to vote.
22 Dec 2010
transoft
1 alternative  
Hi, I have a question about using "GraphicsPath.AddArc". There is no problem to draw an arc when bound rectangle is not rotated. Path.AddArc( Center.getX(), Center.getY(), Radius, Radius, startAngle, sweepAngle );But when the rectangle is rotated with an angle, the arc will...
Please Sign up or sign in to vote.
23 Dec 2010
transoft
1 alternative  
Hi, I know an arc's CENTER, START and END points and its radius. How can I convert these parameters to GDI + GraphicsPath AddArc's parameters?Public Sub AddArc ( _ rect As Rectangle, _ startAngle As Single, _ sweepAngle As Single _)I tried a lot of times without any...
Please Sign up or sign in to vote.
23 Dec 2010
Richard MacCutchan
Quote: "I tried a lot of times without any luck."Tried what exactly? Unless you explain what your code actually does and what errors you get nobody can guess what your problem is.Have you checked the MSDN documentation here[^]?
Please Sign up or sign in to vote.
19 Jan 2011
reza assar
7 alternatives  
Hi all!I recently created a control that will zoom in and out of an image and will scroll on it (something like on google earth), but I cannot get a smooth rendering when it begins to animate.By the way I used a for-loop for changing parameters and then refresh or invalidate a piece of...
Please Sign up or sign in to vote.
19 Jan 2011
reza assar
i did all of thesebut i want more some thing more than double bufferingthis line of code in OnPaint method make computer to its knees e.Graphics.DrawImage(Picture, ClientRectangle, rect, GraphicsUnit.Pixel);i should refresh all the screen for zoom in/out (am i right?)and it should...
Please Sign up or sign in to vote.
19 Jan 2011
Anthony Mushrow
If your having trouble with the speed of your rendering so that the animation looks jumpy, you can use XNA to render onto that panel. It's a little more effort rendering everything with textures and 2D quads but the end result is worth it.But simply put create a panel that you want to render...
Please Sign up or sign in to vote.
19 Jan 2011
reza assar
i am using vs2008 .net framework 3.5 sp3 but here is no reference for microsoft.xna.framework. or something like that.so should i download "Microsoft XNA Game Studio 3.1"? u know it tokes 73mb!!! this means 24 hour downloading for me (in this desert) :-Dhow can i have only xna dlls and just...
Please Sign up or sign in to vote.
23 Jan 2011
reza assar
dear Nijboer & Harlinn & Genius and others1) i should animate the zoom in/out (not only drawing the zoomed image) because "boss said" :sigh: 2) i used Timer because thread managing was hard to implement for me (i am sill working on it but it *should be thread safe *using Invoke and...
Please Sign up or sign in to vote.
26 Jan 2011
heinrich4J
1 alternative  
Hianybody have a idea how to create a drawing in vb picturebox?The images must save as png and background must be transparent.Kind regardsH
Please Sign up or sign in to vote.
9 Feb 2011
mr.dot
2 alternatives  
I use GDI+ in my MFC Application.When I debug it, the output window of VS2008 displays the below information:First-chance exception at 0x4aee65a7 (GdiPlus.dll) in SkinMgr.exe: 0xC0000005: Access violation writing location 0x014a1044Such messages fulfills the output window, but it runs...
Please Sign up or sign in to vote.
17 Feb 2011
deepak_rai
2 alternatives  
Hi,I am developing one software in which user can subtract the background from photo. Photo may be anything typically a persons or group photos.I am successfully able to remove the background from the photo.My issue is:My logic is able to differentiate the person from a photo. But in...
Please Sign up or sign in to vote.
28 Mar 2011
Dave Kreskowiak
You're creating new Pens on every iteration of a loop, but never disposing them. This is a serious resource leak. You should be creating a SINGLE Pen object for each color you want to use, use those throughout your drawing routine, then Dispose them.Better yet, on the startup of your app,...
Please Sign up or sign in to vote.
2 Apr 2011
nbd09
2 alternatives  
i have made a software to draw lines by mouse(Lineto) it is a mfc program based on cview and a sdi but whenever i resize or minimize my window all the drawing in the window is erasedhow can i stop it may be some onpaint event to retain the drawingplz help
Please Sign up or sign in to vote.
2 Apr 2011
mbue
1.) you should never paint outside a paint message.2.) you should store your data (bitmap or point-list).3.) you should handle the erase and the paint messages.4.) draw your lines (or whatelse) onpaint message.5.) to paint into a bitmap is very simple but limited to the bitmap size...
Please Sign up or sign in to vote.
17 Apr 2011
CDP1802
There is a little more to alpha blending than just setting the alpha values in some color values. The unexplained behavior you described may be the result of using another blending strategy (the default of the graphics device) than you expect. I don't usually have much to do with this in...
Please Sign up or sign in to vote.
20 Apr 2011
Groulien
4 alternatives  
Hello everyone,I am looking for a method to check if my cursor is currently over a specific draw so it can be highlighted.Let's say this is may shape: ___________ / //__________/As you can obviously see, there's a bit of spare space (buttons are usually straight...
Please Sign up or sign in to vote.
23 Apr 2011
AngelLoose
1 alternative  
I want save the information of the graphics that i paint. And it can show when the windows show again. Most are Irregular graphics. Please Help me !Thanks!I want to save the drawn into the DataBase ,so Next time i opening the window that i can see what i drawn and drawn where!
Please Sign up or sign in to vote.
12 May 2011
AngelLoose
1 alternative  
我想做一个绘图,要求绘制的每...