gdi

C# WinForms - Anyone know of a C# GDI library not SLOW GDI+

你说的曾经没有我的故事 提交于 2019-11-28 16:45:30
GDI+ is very slow, almost entirely software whereas GDI is highly hardware accelerated. GDI+ is what the Graphics class uses on WinForms and it's just too slow. Has anyone made a .NET GDI library so we can have the speed? [EDIT] Many people are recommending OpenGL/DirectX. A requirement of mine is client compatibility especially remote desktop. AFAIK remote desktop does not support OGL/DirectX out of the box.[/EDIT] Text rendering in GDI+ is slower than GDI. Microsoft realized this after .NET 1.1. That is why .NET 2.0 contains a new TextRenderer class that wraps GDI DrawText . It has two

Enumerating monitors on a computer

99封情书 提交于 2019-11-28 15:58:05
问题 I have found 7 different ways to enumerate the monitors attached to the computer. But all solutions give different results (number of the monitors and information on each monitor). These solutions are: Using the famous EnumDisplayDevices Using EnumDisplayMonitors Using the Windows Management Instrumentation (WMI): With the following query: SELECT * FROM WmiMonitorID in the root\\WMI namespace. Again using the WMI: With the new query: SELECT * FROM Win32_DesktopMonitor in the root\\CIMV2

Screen Capture Specific Window

僤鯓⒐⒋嵵緔 提交于 2019-11-28 11:02:01
Is it possible to screen capture a specific window (also possibly of another process)? Currently I am capturing the entire desktop of a specific monitor, however what I truly want is to capture the content of a specific window (regardless of its position). Yes it is. All what you need is get handle to window which you want to capture and use WinAPI function PrintWindow for example: // Get the window handle of calculator application. HWND hWnd = ::FindWindow( 0, _T( "Calculator" )); // Take screenshot. PrintWindow( hWnd, getDC(hWnd), 0 ); Here you have PrintWindow documentation. Deanna Yes,

How can I detect if a thread has windows handles?

不羁的心 提交于 2019-11-28 10:27:06
How can I programmatically detect if a thread has windows handles on it for a given process? spy++ gives me this information but I need to do it programmatically. I need to do this in C#, however the .net diagnostics libs don't give me this information. I imagine spy++ is using some windows api call that I don't know about. I have access to the code of the system I'm trying to debug. I want to embed some code called by a timer periodically that will detect how many thread contain windows handles and log this info. thanks I believe you can use win api functions: EnumWindowsProc to iterate

Find out number of icons in an icon resource using Win32 API

你离开我真会死。 提交于 2019-11-28 09:28:32
I have an *.ico file that contains multiple icons in different sizes linked to my executable as a resource. I use this resource to set my application's icon with RegisterClassEx() , i.e.: wcx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); In addition to that, I'd also like to convert all the single icons in this resource to ARGB pixel arrays. This should be possible by using GetDIBits() on the bitmap returned by GetIconInfo() . However, there is one problem: I need to find out the number of icons in the HICON handle returned by LoadIcon() as well as their sizes. I do not seem to find

How can I find what font was actually used for my CreateFont call?

旧城冷巷雨未停 提交于 2019-11-28 09:10:30
In Windows, the CreateFontIndirect() call can silently substitute compatible fonts if the requested font is not requested. The GetObject() call does not reflect this substitution; it returns the same LOGFONT passed in. How can I find what font was actually created? Alternately, how can I force Windows to only return the exact font requested? In Windows, the CreateFontIndirect() call can silently substitute compatible fonts if the requested font is not requested. The GetObject() call does not reflect this substitution; it returns the same LOGFONT passed in. It's not CreateFontIndirect that's

GDI+绘制字体显示不全

巧了我就是萌 提交于 2019-11-28 06:17:15
使用graphics.DrawString(pstrText, -1, &font, rectF, &stringFormat, &brush);绘制文字,显示不全。 通过字体平滑处理解决:graphics.SetTextRenderingHint(Gdiplus::TextRenderingHintAntiAlias); 来源: https://www.cnblogs.com/zzx-blog/p/11396895.html

Transparent window containing opaque text and buttons

空扰寡人 提交于 2019-11-28 05:58:13
问题 I'm creating a non-intrusive popup window to notify the user when processing a time-consuming operation. At the moment I'm setting its transparency by calling SetLayeredWindowAttributes which gives me a reasonable result: alt text http://img6.imageshack.us/img6/3144/transparentn.jpg However I'd like the text and close button to appear opaque (it doesn't quite look right with white text) while keeping the background transparent - is there a way of doing this? 回答1: In order to do "proper" alpha

How to render a font from privatefontcollection memory to editable controls

余生长醉 提交于 2019-11-28 04:51:35
问题 This is a continuation of Loading a font from resources into PrivateFontCollection results in corruption The answer supplied here is sufficient for controls that have the UseCompatibleTextRendering method available, however it does not appear to be available for other common controls which text is the primary focus such as : ListView TextBox RichTextBox ComboBox ... and many more... I have attempted the information from here which is basically toying with the Application

Once and for all: how do I get a fully transparent checkbox, button, radio button, etc. in Windows API, and not with a black background?

我的梦境 提交于 2019-11-28 02:24:12
First, sorry if I sound arrogant/rude here. All right, so everyone has run into this by now (I hope); I just haven't found any adequate answer anywhere . We start with a Common Controls 6 manifest and case WM_CTLCOLORSTATIC: if (/* window has WS_EX_TRANSPARENT */) { SetBkMode((HDC) wParam, TRANSPARENT); return (LRESULT) GetStockObject(HOLLOW_BRUSH); } and give our labels WS_EX_TRANSPARENT . They become transparent; so far so good. Now we have to add that style to our checkboxes (because checkboxes respond to that and not to WM_CTLCOLORBTN for some reason). And... the checkboxes become black!