gdi

Transparent top-level windows

I would like to create a top-level (i.e., not WS_CHILD) window with transparency. However, I don't want it to be a simple mask, where a given pixel is either fully transparent or fully opaque. And I don't want it to be such that the entire window has some alpha level to it. Rather, I'd want the window to essentially be entirely transp...

.Net equivalent for ScaleHeight and Scalewidth

Basically what I am trying to do is make my drawing job easier. Back in the days of VB6 there was something called Scalewidth and Scaleheight and I could set them to custom values. Ex. 100. Then when I needed to draw a point at the center of the available space i would just draw it at 50,50. Is there any way in .Net that I can get si...

How do I use large bitmaps in .NET?

Hello! I'm trying to write a light-weight image viewing application. However, there are system memory limitations with .NET. When trying to load large bitmaps (9000 x 9000 px or larger, 24-bit), I get a System.OutOfMemoryException. This is on a Windows 2000 PC with 2GB of RAM (of which 1.3GB is used up). It also takes a lot of time to ...

Get DeviceContext of Entire Screen with Multiple Montiors

I need to draw a line (with the mouse) over everything with C#. I can get a Graphics object of the desktop window by using P/Invoke: DesktopGraphics = Graphics.FromHdc(GetDC(IntPtr.Zero)); However, anything I draw using this graphics object is only showing on the left monitor, and nothing on the right monitor. It doesn't fail or anythi...

JPEG 2000 support in C#.NET

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.. ...

Equivalent of MM_ISOTROPIC mapping mode in Gdi+

I have some C++/GDI drawing code that uses the isotropic mapping mode. I have a large object model with lots of drawing code that I'm trying to reuse in a C# project to draw to an in memory bitmap. I'm having problems setting up the System.Graphics object properly to produce the same picture. Is there any way of setting up the equival...

GDI performance on Windows mobile or CE device

I have a Windows CE application that uses a lot of vector graphics and in places is quite slow. I'm currently using GDI for rendering via a bitmap for flicker free refreshes. Typically, I'm windowing in on part of a large 3d map. On some devices (e.g. 166mhz SH4), this gets slow with 3-5 second refresh times for big datasets. My ques...

Is it possible to convert an ASP.NET control to a picture on the fly?

In ASP.NET, If I have an multi-line text box (or even a 3rd party rich text box), can I convert its content to a picture during postback? By convert I mean to keep the format & content in the picture. For example, I have a rich edit box, end user can add fancy text font and symbols directly on it, once they hit "submit", is there a way...

Force screen redraw after drawing to screen's DC C++

I'm creating a Windows Mobile custom SIP and as the user presses or "hovers" over a button on the keyboard I draw it's corresponding selected image (iPhone-esque) to the screen's DC using ::GetDC(NULL). It is developed in Win32 C++. My problem is that I can never get the screen to repaint itself, erasing the previously drawn key. I'v...

Graphics.FromHwnd(IntPtr.Zero) returns null, why?

I'm currently investigating a problem with a 3rd party component (DevExpress) in my application. My issue is quite similar to this one DevExpress KB article. I get the same exception with more less the same stacktrace. So I used .NET Reflector to find out, what may be null in this scenario, and the only object which is a candiate to be n...

Correct value for hWnd parameter of BeginPaint?

I am trying to make a Visual C++ 2008 program that plots some data in a Window. I have read from various places the correct way to do this is to override WndProc. So I made a Windows Forms Application in Visual C++ 2008 Express Edition, and I added this code to Form1.h, but it won't compile: public: [System::Security::Permissions...

Disable antialiasing for a specific GDI device context

I'm using a third party library to render an image to a GDI DC and I need to ensure that any text is rendered without any smoothing/antialiasing so that I can convert the image to a predefined palette with indexed colors. The third party library i'm using for rendering doesn't support this and just renders text as per the current window...

How do I determine if a DIB is bottom-up or top-down ?

If I create a DIB using CreateDIBSection(), I can specify wether it should be top-down or bottom-up by setting the biHeight field of the BITMAPINFOHEADER struct to a negative or positive value. However, if i call GetObject() on such a bitmap to fill a DIBSECTION structure, then both the dsBm.bmHeight and dsBmih.biHeight seem to be always...

Implementation details of GDI clipping

Consider the following code snippet: HRGN clip = ::CreateRectRgn(50, 50, 100, 100); ::SelectClipRgn(context, clip); ::Rectangle(context, 0, 0, 50, 50); Is Microsoft's clipping implementation intelligent enough to return immediately from the call to Rectangle without attempting to draw anything? I suspect it probably is but have been u...

Any way to get a BITMAPV5HEADER out of a Bitmap object in C#

Is there any way to get a BITMAPV5HEADER out of a Bitmap object in C#? Or just get the values that are in their? I need to get some ColorSpace information out of a bitmap and can't see a way to do this in C#. ...

GetGuiResource for whole system

Hi, I'm trying to add the info from GetGuiResources to the exception handling system of my application. Getting the values for the current process is not a big deal, but I would like to add the values for the whole system as well. So I tried: foreach (Process p in Process.GetProcesses()) { gdiHandles += GetGuiResources(p.Handle, 0)...

Get Thumbnail of background window

I'm trying to get thumbnail pictures of windows that are not visible. Here's the code I have so far BOOL CALLBACK WindowProc(HWND hWnd, LPARAM lParam) { RECT WindRect; GetWindowRect(hWnd, &WindRect) CurrentScreenShot->Next = new ScreenShotList(); CurrentScreenShot = CurrentScreenShot->Next; HDC SourceDC = GetDC(hWn...

How to create a custom GDI device?

Is it possible to create a custom GDI device in user mode? The idea is to create a device context (HDC) which we can pass to an opaque component, so that when the component calls GDI functions like TextOut we can get the actual text string. ...

How Can I intercept high level GDI draw commands ?

Hello guys, I'm trying to make a application that allows remote access to other applications (running on different machines). The idea is to make give users transparent accesso to certain applications, I've basically two options: Application Streaming Intercepting draw command and reproduce them in the client (of course, the input i...

Raster Operator to use for MaskBlt

I'm trying to use the GDI MaskBlt command to draw an image with transparency: http://msdn.microsoft.com/en-us/library/dd145047(VS.85).aspx I can't seem to find anything in the documentation about what raster operator to use for the obvious use case: a sort of MAKEROP4(SRCCOPY, DSTCOPY) - blitting where the mask is 1, and leaving the des...