gdi

Screen is flickering even when using doublebuffering

I am totally new in programming. For my first programm I tried to make a small game in c with windows api. the following code is a nearly working snake, (some bugs not fixed yet) but i cant find a working solution to fix that flickering. (I dont know double Buffering so I just took from here: [http://www.codeguru.com/forum/archive/index....

vertical text won't be bold in win32 GDI c++

I'm trying to draw vertical text in win32 GDI api. I call CreateFont() with 2700 for the angle and 900 for bold. logPxlY = ::GetDeviceCaps (c->_hdc, LOGPIXELSY); _hfont = ::CreateFont (-::MulDiv (point, logPxlY, 72), 0, angle, weight, 0, FALSE, FALSE, FALSE, 0, 0, 0, 0, FIXED_PITCH | FF_MODERN, face); where face is "Courier Ne...

Paint on panel allowing auto scroll

Hi! I'm implementing an application which want to draw lines in the panel. But the panel must be auto scrolled as it size can be expand at run time. The panel paint method I have used is as below.When I run the program it draws lines, but when I scroll down the panel the lines get crashes.How can I avoid that? private void panel1_Paint(...

Is it possible to determine the fonts Windows chooses for font-linking?

Suppose you have a string with text in two or more scripts. When you use a GDI function like TextOut, (modern versions of) Windows will do "font-linking". That is, GDI will draw what it can with your selected font and draw the rest in an appropriate font that it chooses automagically. For example, if part of your text is in English (u...

Is it valid to use HBITMAP after calling FreeLibrary ?

Hi all, I have a case where I need to load bitmap from a resource dll and release handle to it. The update mechanism may update the dll, and having it open will fail overwriting it. So lets say I have something like this: HINSTANCE hInst = LoadLibraryEx(resourceDll, NULL, LOAD_LIBRARY_AS_DATAFILE); HBITMAP hBitmap = LoadBitmap(hInst, ...

Rendering GDI components to a buffer or d3d texture

Hi, I'm trying to redirect the output of a GDI application to a buffer, preferably a d3d texture but I'll settle for a system memory buffer that I can then copy to a d3d texture. Specifically, I'm trying to get Google Chrome to render into a d3d buffer to be displayed in a d3d application. Are there any foolproof ways to do this or am...

GDI handles in a DotNET application

My pure DotNET library runs as a plugin inside an unmanaged desktop application. I've been getting a steady (though low) stream of crash reports that seem to indicate a problem with GDI handles (fonts in error messages etc. revert to the system font, display of all sorts of controls break down, massive crash shortly after). My Forms hav...

Gradient fill bitmap and CreatePatternBrush just gives black fill instead of gradient

I'm trying to create a Gradient Brush in windows mobile as follows: HBITMAP hBitmap = CreateBitmap(16, 16, 1, 16, NULL); HDC hDC = CreateCompatibleDC(NULL); HBITMAP hPrevious = SelectObject(hDC, hBitmap); TRIVERTEX vert[2]; GRADIENT_RECT gRect; //... fill in vert and gRect GradientFill(hDC, vert, 2, &gRect, 1, GRADIENT_FILL_RECT_V); Sel...

How to GetGuiResources for all system processes?

Hello, I need to measure all used GDI objects in a Windows xp system. I found a GetGuiResources(__in HANDLE hProcess, __in DWORD uiFlags) method (with the GR_GDIOBJECTS flag). I call it for the process which I get from the method GetCurrentProcess() defined in WinBase.h. I don't know how to call it for other system processes, which ...

What does the '@' mean when prefixed to Windows font face name?

With EnumFontFamiliesEx, I get two instances of some fonts, the second of which has '@' prefixed to the face name in the LOGFONT. For example, I get "MS PMincho" and "@MS PMincho". Yet for other fonts, I just get a single instance, like "Arial". What does the at-sign mean in this context? ...

VB.net trasparent control problem.

Public Class HighlightKey Inherits Control Private m_fillColor As Color = Color.White Private m_opacity As Integer = 100 Private alpha As Integer Private m_image As Image Public Sub New() SetStyle(ControlStyles.SupportsTransparentBackColor, True) SetStyle(ControlStyles.Opaque, True) Me.Ba...

Detecting ClearType-optimized fonts

Question: Is there a way to check if a given font is one of Microsoft's ClearType-optimized fonts? I guess I could simply hard-code the list of font names, since it's a relatively short list, but that seems a bit ugly. Would the font names be the same regardless of Windows' locale and language settings? Background: PuTTY looks reall...

How to clean up after myself when drawing directly to the screen

I'm drawing directly to the screen using BitBlt and GetDC(IntPtr.Zero). Is there some way to call Refresh or Invalidate on the whole screen when I'm done, so that I don't leave big chunks of paint everywhere (digitally speaking)? Update: when you draw directly to the screen like I'm doing, whatever you draw remains there until the win...

How do I capture a WinForm window to a bitmap without the caret

I've got window on a WinForm that I want to get the bitmap representation of. For this, I use the following code (where codeEditor is the control I want a bitmap representation of): public Bitmap GetBitmap( ) { IntPtr srcDC = NativeMethods.GetDC( codeEditor.Handle ) ; var bitmap = new Bitmap( codeEditor.Width, co...

image appears larger than bounding rectangle?

Hello I'm implementing a custom print preview control. One of the objects it needs to display is an image which can be several pages high and wide. I've successfully divided the image into pages and displayed them in the correct order. Each "page" is drawn within the marginbounds. (That is, each page is sized to be the same as the ma...

GDI polyline partial output when printing

I'm seeing a strange problem when calling Win32 GDI Polyline() when printing out. On screen it all looks ok, however if printing it will stop the polyline when it encounters a large value. I think this discrepency is due to the scaling for printing yielding larger POINT values. It appears as if the polyline stops drawing if it hits ...

How to get the drawn image away from the screen, when i have scrolled down the panel?

The main form has added a panel(from now called "imagePanel") to itself. The panel is automatically stretched by some elements on the top and on the left side. Autoscroll is true, so i can scroll around in the panel. Here is my problem: When i scroll down or sideways on the panel, the image is always THERE. e.g: I have scrolled down t...

Making an application draw a surface other than the desktop

Hello Im looking for a way to get an application, any application, that has been started using ShellExecuteEx or CreateProcess to draw on an offscreen surface such as a bitmap instead of drawing on the desktop, this should include any dialogs the (Open, Save, messages) that the application invokes. I am familiar with the Windows API, ...

Question about creating device-compatible bitmaps in C#

I am storing bitmap-like data in a two-dimensional int array. To convert this array into a GDI-compatible bitmap (for use with BitBlt), I am using this function: public IntPtr GetGDIBitmap(int[,] data) { int w = data.GetLength(0); int h = data.GetLength(1); IntPtr ret = IntPtr.Zero; using (Bitmap bmp = new Bitmap(w, h)...

Get DC & RC from new desktop

Hello. I create new desktop with CreateDesktop and want to get it's DC & RC. RECT deskRC; HDC deskDC; HDESK hNewDesktop = CreateDesktop(...); GetWindowRect(hNewDesktop, &deskRC); deskDC = GetDC(hNewDesktop); This returns only 0's. What's the problem? Or maybe there's another way of obtaining those values. P.S.: Deskto...