gdi

How to debug GDI Object Leaks?

▼魔方 西西 提交于 2019-11-26 21:26:46
问题 I'm not quite sure how to go about doing this. It is a large app, and we are having GDI object "leaks" on most of our forms. Is there a tool to help out? Is there a tutorial on how to use such a tool? Should I just start deleting code from our forms until I narrow the offender down? (there is ALOT of code). 回答1: It is pretty rare to exceed the 10,000 object limit for GDI objects only, the garbage collector will take care of them when you don't call their Dispose() method yourself. A much more

How to effectively draw on desktop in C#?

南笙酒味 提交于 2019-11-26 20:17:46
I want to draw directly on the desktop in C#. From searching a bit, I ended up using a Graphics object from the Desktop HDC (null). Then, I painted normally using this Graphics object. The problem is that my shapes get lost when any part of the screen is redrawn. I tried a While loop, but it actually ends up drawing as fast as the application can, which is not the update rate of the desktop. Normally, I would need to put my drawing code in a "OnPaint" event, but such thing does not exist for the desktop. How would I do it? Example code: https://stackoverflow.com/questions/1536141/how-to-draw

Rotate a point around another point

纵然是瞬间 提交于 2019-11-26 20:13:20
问题 I have a task to draw a specific graphic. As part of this task I need to rotate some dot's on 45 degrees. I've spent already 2 days trying to calculate a formula, but just couldn't get it right. I've been searching all over the place including this particular website, I'm getting very close, but I'm still not there. Here it is: I need to draw 4 different points I have a specific formula to calculate there position, which is out of scope of the question, but here is what I'm getting as a

C# Drawing on Panels

家住魔仙堡 提交于 2019-11-26 18:34:16
问题 I'm drawing up a day schedule and representing timeslots with panels, and appointments are yet more panels on top. The user is able to scroll up and down so that the range they can see is shifted earlier or later. When an appointment runs off the end of the visible range, I want there to be a zig-zag indicating that the appointment extends beyond the visible bounds. I've identified the case where this occurs, and I call a private function drawZigZag(Panel p, int direction); to draw it. The

JPEG 2000 support in C#.NET

£可爱£侵袭症+ 提交于 2019-11-26 12:44:47
问题 It seems that .NET can\'t open JP2 (Jpeg 2000) files using the GDI library. I\'ve searched on google but can\'t find any libraries or example code to do this. Anybody got any ideas? I don\'t really want to pay for a library to do it unless I have to.. 回答1: Seems like we can do it using FreeImage (which is free) FIBITMAP dib = FreeImage.LoadEx("test.jp2"); //save the image out to disk FreeImage.Save(FREE_IMAGE_FORMAT.FIF_JPEG, dib, "test.jpg", FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYNORMAL); //or

Problem reading JPEG Metadata (Orientation)

喜欢而已 提交于 2019-11-26 12:12:45
I've got a JPEG image which was taken on an iphone. On my desktop PC (Windows Photo Viewer, Google Chrome, etc) the orientation is incorrect. I'm working on an ASP.NET MVC 3 web application where i need to upload photos (currently using plupload). I've got some server-side code to process images, including reading EXIF data. I've tried reading the PropertyTagOrientation field in the EXIF meta data (using GDI - Image.PropertyItems ), but the field isn't present. So it's either some specific iphone meta data, or some other meta data. I've used another tool like Aurigma Photo Uploader, and it

Creating HBITMAP from memory buffer

ⅰ亾dé卋堺 提交于 2019-11-26 11:37:44
问题 I have an application which loads some blob data out of a database which can represent png formatted or raw binary data for various bitmaps and icons. This is being stored in a std::vector<unsigned char> I\'m using CImageList objects to display various images in tree views, toolbar images, etc but the problem is creating bitmaps from the data in memory are coming out fuzzy as if it\'s missing pixels when doing something like below: std::vector<unsigned char> bits; HBITMAP hbitmap =

SetPixel is too slow. Is there a faster way to draw to bitmap?

寵の児 提交于 2019-11-26 11:07:34
问题 I have a small paint program that I am working on. I am using SetPixel on a bitmap to do that drawing of lines. When the brush size gets large, like 25 pixels across there is a noticeable performance drop. I am wondering if there is a faster way to draw to a bitmap. Here is a bit of the background of the project: I am using bitmaps so that I can utilise layers, like in Photoshop or The GIMP. Lines are being drawn manually because this will eventually use graphics tablet pressure to alter the

How would I load a PNG image using Win32/GDI (no GDI+ if possible)? [closed]

戏子无情 提交于 2019-11-26 08:22:57
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 months ago . Is it possible to load a PNG from a file into an HBITMAP using Win32 GDI functions? If not, what would be the lightest solution without using external libraries (like libpng)? 回答1: You can use the Windows Imaging Component to load PNG files (on Windows XP SP2 and later). See MSDN