Questions tagged [gdi]

Graphics Device Interface (GDI) is a device-independent, pure software graphics API under the Windows operating system for drawing graphic primitives and text. It is the underlying base used to render the Windows GUI elements.

Graphics Device Interface (GDI) is a device-independent, pure software graphics API under the Windows operating system for drawing graphic primitives and text. It is the underlying base used to render the Windows GUI elements.

More information at http://en.wikipedia.org/wiki/Graphics_Device_Interface

2158 questions
0
votes
1 answer

Win32 - Is there a way to get the margin or border size around a scrollbar?

How do you get the area between the contents displayed in the client area (say notepad) and the scrollbar. There is a slight gap / border in there. How is that determined? TIA!! Here's an example: Note part of the small "j" shows but there is a…
user3161924
  • 1,849
  • 18
  • 33
0
votes
0 answers

Win32/MFC: Why is DrawIcon drawing outside the elliptic region?

I quickly threw together a derived CButton class to make a round button using ownerdraw, but it seems the DrawIconEx function is drawing outside the region because the drawn button is square. I even tried making a copy of the region and…
user3161924
  • 1,849
  • 18
  • 33
0
votes
1 answer

How do I draw a rectangle on the desktop like UISpy/Spy++/etc..?

I'm playing around in a console application and thought it be nice if I could just popup a rectangle around areas on the desktop so I can visually see where various RECTs are. Like you see with things like UISpy, Inspect, Spy++ (drag target over…
user3161924
  • 1,849
  • 18
  • 33
0
votes
2 answers

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…
Martin Moser
  • 6,219
  • 1
  • 27
  • 41
0
votes
0 answers

MFC: strange behavior of CDC and DrawText with DT_CALCRECT?

In BeginPrinting, I calculate the printing rect like below. I rely on this to count the number of pages. CRect rect(30, -50, 200, -60); int height = pDC->DrawText(cstr, &rect, DT_EDITCONTROL | DT_WORDBREAK | DT_LEFT | DT_CALCRECT); Then in…
user180574
  • 5,681
  • 13
  • 53
  • 94
0
votes
2 answers

Capturing wrong part of the screen

I have created a small demo app which window looks as below: When I run this demo app, and press any key, I want to capture the part of the screen bitmap. The part of the screen I am interested in, is the one my window occupies, namely the content…
AlwaysLearningNewStuff
  • 2,939
  • 3
  • 31
  • 84
0
votes
1 answer

Due to invalid ValidateRgn() childs windows do not get WM_PAINT messages

I have window with Button control, to drawing I use Direct2D, important WindowProc fragments: LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { ... case WM_CREATE: HWND button = CreateWindowExW(0,…
Sonny D
  • 897
  • 9
  • 29
0
votes
1 answer

Performance difference WndProc WM_PAINT vs OnPaint

I have a custom button control where I need to do some drawing. Nothing fancy or complex, yet I notice quite a difference in performance when drawing within WndProc WM_PAINT and drawing within the OnPaint event. When I draw in OnPaint I do not get…
user13523921
0
votes
0 answers

c# dispose user control from the panel and GDI

I have many user control when i click on my menus button it shows that user control i want but i was looking on GDI objects on the task manager i found that when i go to another user control the GDI not released and not dispose it is my code for…
noobpro
  • 1
  • 2
0
votes
1 answer

How to fill 50% opaque color to polygon?

I can fill color by this code void FillColorPolygon(POINT pts[],int ilnum,long fillColor) { COLORREF fillcol; fillcol = Gc_disp::ColorSet(fillColor); HBRUSH hBrushNew = CreateSolidBrush(fillcol); …
Fame th
  • 1,018
  • 3
  • 17
  • 37
0
votes
2 answers

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…
MrPerphekt
0
votes
1 answer

GDI Drawing to external windows (C++)

The task is to draw to external windows such as drawing a line to a window running. (Kind of like ESP for games). I have this code to draw to desktop (draws a rectangle), but how would I change it to draw to a window running of my choice? Code to…
0
votes
1 answer

MFC DrawText, vertical, DT_CALCRECT with lf_escapement = 900

I'm working on a MFC project with some GDI drawings. I use DC.DrawText to draw a vertical text into a DC using a LOGFONT with lfEscapement = 900. The text is output when i use DT_NOCLIP in the desired vertical formatting. However to center this…
0
votes
1 answer

GetDIBits Returns Zero after Many Iterations In Screen Capture function

I am using this code to capture screen and cursor. // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there. #include #include "opencv2/imgproc.hpp" #include…
0
votes
2 answers

Can't draw in title bar on WM_NCPAINT?

I'm trying to draw something in the title bar area to represent an X since there is no WS_CAPTION, it just uses WS_EX_TOOLWINDOW | WS_EX_TOPMOST and WS_POPUP|WS_THICKFRAME. But I can't get anything to draw anywhere. I did a test below to just fill…
df234987
  • 513
  • 2
  • 13
1 2 3
99
100