gdi

Rotate The Rectangle in GDI

我们两清 提交于 2020-01-05 03:35:18
问题 I am using the windows GDI API ExtTextOut function to draw text like this: ExtTextOut(hDC, 2000, 2000, 0, &stRect, PrintText, TextOutLen, aiCharCellDistances); I am trying to rotate the text, and I do rotate the text. But when I fill the rectangle with colors, I found that the rectangle didn't rotate with the text. Is there any way to rotate the rectangle with the text? Or is there a better way to do this? P.S.: My goal is to draw text in the rectangle (like text area) and can rotate it in

Embed custom font fot text box use in Visual Basic 2010

妖精的绣舞 提交于 2020-01-04 11:10:26
问题 OK I'm working on a problem tyring to embed a LCD type true type font in a text box. As for some background, I can get the lcd font to display if I install the font onto my system, then load it as the font type for the text box and it works great. However, it will not work as an embedded font in the application. I"m using a a Windows Forms Application in Visual Basic, from the Microsoft Visual Studio 2010 on a Windows 7 box. I have tried the following code using a private font collection from

bitblt failed on Windows 10 version 1703 (15063.138)

自闭症网瘾萝莉.ら 提交于 2020-01-04 05:45:32
问题 using Visual Studio 2017, vc141, the following code should got a screenshot from front game window but now it return a black and blank image. only issue with games(tried OpenGL and Vulkan, ogl return black, vulkan return white) before upgrade to windows 10 1703, it works on windows 10 1607 and windows 7 sp1 #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> code: BOOL ScreenShot(cv::Mat *img, HWND hWnd = NULL) { HBITMAP hBitmap; HDC

BitBlt drawing bitmap upside down

a 夏天 提交于 2020-01-03 17:53:08
问题 I have an MFC control to which I pass a handle to a bitmap (HBITMAP). In the controls OnPaint method I am using BitBlt to render the bitmap. But the bitmap is being rendered upside down. As a test I created a CBitmap object from this handle and write that out to a file and it created a bitmap that was right side up. So am I doing something wrong with my call to BitBlt? I've posted my code from OnPaint below. I did try to change the mapping mode of my device context to MM_LOENGLISH and was

HBRUSH to RGB value

混江龙づ霸主 提交于 2020-01-03 09:03:31
问题 Can you get the RGB value from HBRUSH or from brush id? for example: I'm looking for GRAY_BRUSH in RGB value. 回答1: You want to use the GetObject function to return a LOGBRUSH structure that contains the brush color. 来源: https://stackoverflow.com/questions/3612024/hbrush-to-rgb-value

GDI is not rendering, what am I doing wrong?

痞子三分冷 提交于 2020-01-03 04:52:08
问题 I am trying to make a basic framework for graphics with GDI to make some minigames with. But GDI is not rendering anything at all, I just get a black client area, and I have no idea what I'm doing wrong. The following code is inside a game loop that is running constantly: //render double buffered with GDI HDC frontBuffer = GetDC(m_hMainWnd); HDC backBuffer; HBITMAP bitmap; HBITMAP oldBitmap; backBuffer = CreateCompatibleDC(frontBuffer); bitmap = CreateCompatibleBitmap(frontBuffer, m

Win32 (GDI) - Set Opacity of STATIC Control

旧城冷巷雨未停 提交于 2020-01-02 06:59:54
问题 I'm using C - (NO MFC or GDI+) :-) What I want is to set the opacity of my child window to let say 100 (my child window is a STATIC control). I was wondering if this is even possible and if so can someone please point me to the right direction on how to do it. Here is my setup: I create my Parent window as follow: HWND hWnd; WNDCLASS wndCls_s; wndCls_s.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wndCls_s.lpfnWndProc = MainWndProc; wndCls_s.cbClsExtra = 0; wndCls_s.cbWndExtra = 0; wndCls_s

Possible bug with .net winforms, or am I just missing something? GDI object leak

戏子无情 提交于 2020-01-01 19:22:23
问题 Could someone please tell me what is going wrong? After removing tons of code to find our GDI object leak (using task manager and watching the "GDI Objects" column grow to 10,000 and our app crashing) I reduced the code down to only .net code without any custom business code. We are still getting the issue. I created a test app to replicate the issue, which has the following basic behavior. Open the a form 150 times (150 is nothing special, just a number large enough to easily see "stuck"

How to effectively draw on desktop in C#?

落爺英雄遲暮 提交于 2020-01-01 09:07:09
问题 I want to draw directly on the desktop in C#. From searching a bit, I ended up using a Graphics object from the Desktop HDC (null). Then, I painted normally using this Graphics object. The problem is that my shapes get lost when any part of the screen is redrawn. I tried a While loop, but it actually ends up drawing as fast as the application can, which is not the update rate of the desktop. Normally, I would need to put my drawing code in a "OnPaint" event, but such thing does not exist for

绘图、GDI、颜色及字体

旧街凉风 提交于 2020-01-01 01:28:51
1,任何时候当程序需要直接在屏幕或打印机上绘图的时候,都需要调用GDI函数,GDI函数包含了一些用于绘制图形、位图以及文本的函数。 2,Windows的设备环境是GDI的关键元素,它代表了物理设备。每一个C++设备环境对象都有与之对应的Windows设备环境, 并且通过一个32位类型的HDC句柄来标识。 3,MFC库设备环境类基类CDC包含了绘图所需要的所有成员函数,并且几乎所有派生类只有构造函数和析构函数不同(CMetaFileDC类除外)。 对于显示器来说,常用的派生类有CClientDC 和 CWindowDC,而对其它设备(如打印机或内存缓冲区),则可以构造一个基类CDC的对象。 对于显示器和打印机设备环境对象来说,应用程序框架会直接将句柄附在对象上;而对其它设备环境(如内存设备环境), 为了将对象与句柄相联系,在构造完对象之后,还必须调用一个成员函数(进行初试化)。 4,CClientDC类 和 CWindowDC类 如果构造CClientDC对象,则设备环境的映射区域限于客户区域,不能在客户区域外绘图。原点(0,0)在客户区左上角。 如果创建CWindowDC对象,则设备环境的映射区域为整个窗口(包括标题栏、状态栏、窗口边框等)。原点(0,0)在整个窗口的左上角。 注意: 1)视图窗口没有非客户区域. 2)视图窗口覆盖在框架窗口之上。 3)在《》中的内容