gdi+

How to write to a (Bitmap?) image buffer for faster GDI+ displays?

余生长醉 提交于 2019-12-03 22:57:29
问题 Using C++ and .net I have a stream of data I want to display as a scrolling image. Each time I get some new data I want to add it as a new row (128x1 pixels) and scroll the previous contents to one side. My first stab at the problem involved rendering the entire data set each time I got a new row. This worked, but was far too slow, so I'm thinking it might make more sense to write to a buffer of some sort (a bitmap maybe?). The problem is that I can't see how I can do that; Graphic objects

Analog Clock - Draw clocks arm over a Label

点点圈 提交于 2019-12-03 21:56:48
问题 I'm using WinForms to create a clock. The problem is the clocks hand is going under my panel/label. I tried to paint the hand on top of my panel/label but I wasn't successful. I also tried moving my panel/label to the back and the hand to the front and that didn't work well either. I also tried doing something like this panel_digital_Timer.Parent = pictureBox1 which made a transparent panel. How can i move the clocks hand in front of my panel/label? public partial class Form1 : Form { private

how to draw constantly changing graphics

廉价感情. 提交于 2019-12-03 20:52:47
Have not done this before ( except in java , look how Steve McLeod fixed it), so obviously I suck at it. Here 64 pixels around current mouse position get drawn little bigger on a form. Problem is, that it's 'kind of' to slow, and I have no idea where to start fixing. Besides that, I made a timer thread, that constantly calls update graphics when it's finished and a little fps like text, to show really how fast things are drawn. Image example: (Image is from letter 'a' in "IntelliTrace" in Microsoft VS2010) Source example: using System; using System.Collections.Generic; using System

Capture screenshot of hidden desktop

风流意气都作罢 提交于 2019-12-03 20:07:18
问题 I am using virtual desktops on Windows using simple app that i coded myself in C++, i was wondering if there is way to capture screenshot of secondary/hidden desktop ? I know that i can do SwitchDesktop -> capture screenshot -> SwitchDesktop, but it doesnt sound like good solution.... Maybe i run some window in the hidden desktop, to get its hwnd and SOMEHOW to use it to capture the entire screen ? I have run Spy++ but seems it not finding windows that dont belong to currently active desktop.

ASP.NET creating thumbnails server side

拥有回忆 提交于 2019-12-03 16:36:21
It look desceptively easy to use System.Drawing to create thumbnails in your ASP.NET application. But MSDN tells you : Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. I'm seeing intermittented 'out of memory' errors within this type of GDI+ code. I'm beginning to suspect this is the cause. How ARE people doing server side image manipulation? Can anyone recommend any

Shorten a line by a number of pixels

我的未来我决定 提交于 2019-12-03 16:34:22
问题 I'm drawing a custom diagram of business objects using .NET GDI+. Among other things, the diagram consists of several lines that are connecting the objects. In a particular scenario, I need to shorten a line by a specific number of pixels, let's say 10 pixels, i.e. find the point on the line that lies 10 pixels before the end point of the line. Imagine a circle with radius r = 10 pixels, and a line with start point (x1, y1) and end point (x2, y2). The circle is centered at the end point of

Using GDI+, what's the easiest approach to align text (drawn in several different fonts) along a common baseline?

北慕城南 提交于 2019-12-03 14:10:33
My problem: I'm currently working on a custom user control which displays pieces of text (each with a potentially different font) on one line. I'd like to align all those bits of text exactly along a common baseline. For example: Hello, I am George. ------------------------------ <- all text aligns to a common baseline ^ ^ ^ | | | Courier Arial Times <- font used for a particular bit of text 20pt 40pt 30pt Because I haven't found any GDI+ functionality to do this directly, I came up with my own method (outlined below). However: I wonder if there really isn't an easier way to get this done? My

c# DrawString - measure bounding boxes for each character

不羁的心 提交于 2019-12-03 13:11:50
Before I pass a string to Graphics.DrawString(), I'd like to know exactly where each character will be - not just it's offset and width, but its exact bound box with ascent/descent figured in so that I can do collision detection at the character level rather than using the entire line-height that Graphics.MeasureString() is giving me. I can't seem to find any examples for this that accurately return the bounding box for each character. How can this be done in c#/GDI+ ? Ideally, I'd like to get each of the gray Rectangles as in this image: I don't think it's possible to accurately measure

Is GDI+ just a layer on top of GDI, or something new?

丶灬走出姿态 提交于 2019-12-03 12:22:57
When GDI+ came out, I remember all the brouhaha about how it was the "new, faster, better" way to display stuff in Windows. But everytime I looked at it, it seemed to me that it was really just a COM wrapper around GDI. Is that true? Or is GDI+ really an independent graphical library that simply shares some paradigms with GDI? Personally, I'm not sure how it could be independent, but I never saw a definite statement one way or another. Ian Boyd Many GDI functions are accelerated by the graphics hardware, and some GDI+ routines may use GDI underneath. But most of GDI+ is independant of GDI. An

A Generic Error occurred in GDI+ when calling Bitmap.GetHicon

两盒软妹~` 提交于 2019-12-03 12:20:49
问题 Why I'm getting "A Generic Error occurred in GDI+" Exception ? IntPtr hicon = tempBitmap.GetHicon(); Icon bitmapIcon = Icon.FromHandle(hicon); return bitmapIcon; The error occurred when my application has been running for more than 30 minutes. (I am converting System.Drawing.Bitmap to System.Drawing.Icon every second) 回答1: That's caused by a handle leak. You can diagnose the leak with TaskMgr.exe, Processes tab. View + Select Columns and tick Handles, GDI Objects and USER Objects. Observe