gdi

Cutting paper ("feed and cut") with GDI?

Many printers have a "feed and cut" or "cut paper" command (I'm talking about POS - printers here). Since using POS.NET is not always possible (horrific driver incompatibilities) and GDI can do so much more, we would like to utilize the paper cutter also when printing using GDI. Is there a way to do so? Possibly when issuing EndDocumen...

Problem with CreateDC and wglMakeCurrent

PIXELFORMATDESCRIPTOR pfd = { /* otherwise fine for a window with 32-bit color */ }; HDC hDC = CreateDC(TEXT("Display"),NULL,NULL,NULL); // always OK int ipf = ChoosePixelFormat(hDC, // always OK SetPixelFormat(hDC,ipf, // always OK HGLRC hRC = wglCreateContext(hDC); // always OK wglMakeCurrent(hDC,hRC); // ! read error: 0xbaadf03...

Change background color of another program from C++ program

I'm trying to change the background color of a program I did NOT write. Looking at it with Spy++ I can see that the main class is "ThunderRT6FormDC". One of its children has the class "ThunderRT6Frame". Inside ThunderRT6Frame there are a bunch of ThunderRT6CommandButtons. I want to change the background color behind the buttons. I trie...

Use of a memory device context

As I read the memory device context is used to select a DDB object from the memory and draw on it. Now what i'm trying to do is; select a bitmap object and draw a line on it, would it work that way? void OnDraw(HDC hDC) { RECT wnd; GetClientRect(m_hWnd, &wnd); HDC memDC = CreateCompatibleDC ( hDC ); ...

c# radial gradient brush effect in GDI and winforms

Dear All, I have created a c# windows application and written 75% of the code. The program allows the user to create a flow chart, and will shade the flow chart shapes according to their status. I wanted them to become 3d buttons such as from the website Webdesign.org Rather than create a PNG for each button, I wanted to create the...

GDI+ Paint Queue Problem

Hello, comrades) I've found some interesting behavior of Invalidate method in multithreaded applications. I hope you could help me with a problem... I experience troubles while trying to invalidate different controls at one time: while they're identical, one succesfully repaints itself, but another - not. Here is an example: I have a f...

Draw in mspaint programatically

if you get the window handle, would there be any possible way to draw something using GDI functions or send paint data to window? ...

Draw on DeviceContext from COLORREF[]

Hi, I have a pointer to a COLORREF buffer, something like: COLORREF* buf = new COLORREF[x*y]; A subroutine fills this buffer with color-information. Each COLORREF represents one pixel. Now I want to draw this buffer to a device context. My current approach works, but is pretty slow (== ~200ms per drawing, depending on the size of th...

how to make the graphicsline as a selectable object

I want to create an application which the user is able to manipulate the line he draw. Something like Deleting the line or Selecting it. How should I do that? Thanks in advance I managed to do it using a hard coded rectangle. But I don't still have an idea how to do it using the drawLine() Can I use drawPath to do the hit test? Here...

Determine the X-radius & Y-radius of an ellipse

Hi, I need to determine the X-radius & Y-radius of an ellipse give the major & minor radius and I couldn't find any way how to do it. I have following inputs: Center Point Start Point Major Radius Minor Radius So, My question is how to create the ellipse rect that should be passed to GDI api i.e. DrawEllipse to draw the ellipse. T...

Grid of 30 x 30 buttons

I'm making a grid of 30 x 30 buttons with BS_BITMAP representing some numeric value which can be set by clicking on buttons. so should I go creating 900 buttons on a window and or GDI would help to do something same? Any ideas on setting a row of some column in a grid to some values? would I need a multidimensional array of window handl...

HBRUSH to RGB value

Can you get the RGB value from HBRUSH or from brush id? for example: I'm looking for GRAY_BRUSH in RGB value. ...

Prevent default click event (WinAPI)

I'm making a color dropper tool and while this tool is active, when the user clicks or taps I only want it to run my mouse event, not anything else,so while this tool is running,if the user clicks the start orb, it should not open the start menu (or if the user clicks anything else). How could I do this? Thanks ...

AND two bitmaps in C#

Hi all, I'm trying to AND two bitmaps like this: [DllImport("gdi32.dll")] public static extern int SetROP2(IntPtr hDC, int nDrawMode); const int SRCAND = 0x008800C6; // AND raster op. lock (g.Clip) { IntPtr pDC = g.GetHdc (); SetROP2 (pDC, SRCAND); g.Draw...

draw over opengl/D3D with GDI?

I'm wondering if it's possible to draw over an opengl/direct3D surface with GDI? and if so, how might it be done? The reason I ask is because I'm writing a simple app to draw a few things in games. Such things would all be 2D or text such as framerate info, custom crosshair, clock, etc. I know the best way is to hook in and use whateve...

direct access to pixel data in wpf 3d

Is there a lockbits equivalent of 2d in 3d in Windows Presentation Foundation to get direct pixel access ? I understand you can paint a triangle at a time: 3d for the threst of us. Wouldn't it be easier to paint in cubes instead of triangles ? (I need to paint a stack of images such as an mri sequence). ...

Fast drawing using MFC GDI

Hi All, I am creating an application which has some of the features like a CAD application has like zooming, panning etc. I have a problem regarding drawing of entities as quickly as possible. I have double buffered the drawing to make it flicker free but I am stuck in clipping the region of the drawing that is I want to draw on those e...

C# How to store Brush/Pen information in a database table

I need to store Brush/Pen information about several shapes in a database table, one row for each layer I draw. I was thinking of two schemes: BRUSH_INFO PEN_INFO SolidBrush(Color.Red) Pen(Color.Black) pros: only two colums cons: eval'd column BRUSH_INFO PARAM_B1 PARAM_B2 ... PEN_INFO PARAM_P1 PARAM_P2...

How to draw a single line using MouseMove Event

Hi guys, I'm trying to draw a single line using OnMouseMove() event. My Problem is that everytime I move the mouse It leaves a trail. I tried to use the refresh method, but when I stop moving the mouse the line is gone. I don't want the line to be drawn OnPaint();, Just want to draw it OnMouseMove(). EDIT: I'm using a transparent pan...

Pixel dilemma: Choosing the right graphics API

I want to make a sidescrolling 2D game with destructible terrain. My approach is having the terrain as a BMP and having access to each pixel. However I have a problem with choosing the right graphics API for my game. I have already considered several options: SDL I started writing the game in SDL, I had the terrain as surface which...