gdi

windows 10 screen coordinates are offset by 7

雨燕双飞 提交于 2020-06-10 02:02:11
问题 I'm coding in c++ on windows 10 - straight win32 API. I wanted to make a window show up in the top right of the screen. As I was doing this, I noticed that screen coordinates for a maximized window are left=-8, top=-8, right=1936, bottom=1088. Also, when I position a window so right=1920 and top=0, there's about an 8 pixel gap on the right. I tried moving the window around to see what screen coordinates I got. rect.left for a nonmaximized window can go from -7 to 1912. so things are slid by 7

Create window without titlebar, with resizable border and without bogus 6px white stripe

给你一囗甜甜゛ 提交于 2020-05-24 19:36:52
问题 I want a window without title bar but with resizable frames and shadow. This can easily be achieved by removing WS_CAPTION and adding WS_THICKFRAME, however, since Windows 10, there's a 6px white non-client area. With the following code I create a window and paint all the client area with black, the window gets a left, right and bottom 6px transparent margins, however the top margin is white. #ifndef UNICODE #define UNICODE #endif #include <windows.h> LRESULT CALLBACK WindowProc(HWND hwnd,

Create window without titlebar, with resizable border and without bogus 6px white stripe

匆匆过客 提交于 2020-05-24 19:35:03
问题 I want a window without title bar but with resizable frames and shadow. This can easily be achieved by removing WS_CAPTION and adding WS_THICKFRAME, however, since Windows 10, there's a 6px white non-client area. With the following code I create a window and paint all the client area with black, the window gets a left, right and bottom 6px transparent margins, however the top margin is white. #ifndef UNICODE #define UNICODE #endif #include <windows.h> LRESULT CALLBACK WindowProc(HWND hwnd,

WinAPI/GDI: why snapshot of large windows includes taskbar?

心已入冬 提交于 2020-04-30 08:54:47
问题 I am using GDI+ to take window snapshot, the code is: CComBSTR bstrfname (fname); HDC hdc = CreateCompatibleDC (hDC); HBITMAP hbmp = CreateCompatibleBitmap (hDC, CFG_WIDTH, CFG_HEIGHT); HBITMAP hbmp0 = (HBITMAP)SelectObject (hdc, hbmp); BitBlt (hdc, 0, 0, CFG_WIDTH, CFG_HEIGHT, hDC, 0, 0, SRCCOPY); Gdiplus::Bitmap *bmp = new Gdiplus::Bitmap (hbmp, NULL); CLSID encoderClsid; GetEncoderClsid (L"image/png", &encoderClsid); bmp->Save (bstrfname, &encoderClsid, NULL); delete bmp; SelectObject (hdc

WinAPI/GDI: why snapshot of large windows includes taskbar?

老子叫甜甜 提交于 2020-04-30 08:53:00
问题 I am using GDI+ to take window snapshot, the code is: CComBSTR bstrfname (fname); HDC hdc = CreateCompatibleDC (hDC); HBITMAP hbmp = CreateCompatibleBitmap (hDC, CFG_WIDTH, CFG_HEIGHT); HBITMAP hbmp0 = (HBITMAP)SelectObject (hdc, hbmp); BitBlt (hdc, 0, 0, CFG_WIDTH, CFG_HEIGHT, hDC, 0, 0, SRCCOPY); Gdiplus::Bitmap *bmp = new Gdiplus::Bitmap (hbmp, NULL); CLSID encoderClsid; GetEncoderClsid (L"image/png", &encoderClsid); bmp->Save (bstrfname, &encoderClsid, NULL); delete bmp; SelectObject (hdc

CreateCompatibleBitmap() returns black HBITMAP

北战南征 提交于 2020-04-30 07:46:27
问题 Hello Stack Overflow users. It seems that I am not using CreateCompatibleBitmap() properly in the following code: #include <windows.h> using namespace std; int main() {HDC hdc=GetDC(HWND_DESKTOP); HDC MemDC=CreateCompatibleDC(hdc); HBITMAP hBit=CreateCompatibleBitmap(hdc,1366,768); SelectObject(MemDC,hBit); BitBlt(hdc,0,0,1366,768,MemDC,0,0,SRCCOPY); //Screen turns black DeleteObject(hBit); ReleaseDC(HWND_DESKTOP,hdc); ReleaseDC(NULL,MemDC); DeleteDC(MemDC); DeleteDC(hdc); } I thought

CreateCompatibleBitmap() returns black HBITMAP

你。 提交于 2020-04-30 07:45:06
问题 Hello Stack Overflow users. It seems that I am not using CreateCompatibleBitmap() properly in the following code: #include <windows.h> using namespace std; int main() {HDC hdc=GetDC(HWND_DESKTOP); HDC MemDC=CreateCompatibleDC(hdc); HBITMAP hBit=CreateCompatibleBitmap(hdc,1366,768); SelectObject(MemDC,hBit); BitBlt(hdc,0,0,1366,768,MemDC,0,0,SRCCOPY); //Screen turns black DeleteObject(hBit); ReleaseDC(HWND_DESKTOP,hdc); ReleaseDC(NULL,MemDC); DeleteDC(MemDC); DeleteDC(hdc); } I thought

在VC6.0中使用GDI+

大憨熊 提交于 2020-04-01 08:45:29
GDI+在原来GDI的基础上进行了许多的升级和优化,比如线条平滑、颜色透明度、图形变换(平移、缩放、旋转),更多图片格式支持等技术都进行了很大的改善,使用GDI+可以很方便的实现对各种图形的绘制和优化。GDI+属于.NET组合,不过VC6.0的朋友也可以很方面地使用它,在VC6.0和工程中使用GDI+的流程如下: 1.安装GDI+组件。对于没用安装.NET开发平台的朋友,不能直接开发GDI+程序,需要先 安装该组件。 (1)可以简单地到其它地方拷贝Gdiplus的相关文件到编程目录下(主要包括gdiplus.h, gdiplus.lib, gdiplus.dll等); (2)直接从微软的网站下载MICROSOFT PLATFORM SDK 进行安装 ( http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm );比较大。 安装完成后还要在VC6.0开始环境中添加文件关联路径: 选择菜单"Tools"-->"Options",选择"Directories"标签页面,分别在Include files及Library files中添加文件关联路径,如下: 图1 关联头文件路径 图2 关联lib库文件 2.创建一个SDI项目GdiplusTest。 3.加载和注销GDI+资源

VS2010的MFC中配置GDI+

≯℡__Kan透↙ 提交于 2020-04-01 08:44:08
如何在VS2010中的MFC中配置GDI+ 首先,VS2010中已经有GDI+SDK包的,不需要额外下载 1:在stdafx.h文件中加入下面3行代码,添加相应的头文件和库 #pragma comment( lib, "gdiplus.lib" ) #include "gdiplus.h" using namespace Gdiplus; 2:定义一个全局变量 ULONG_PTR m_gdiplusToken; 其中,ULONG_PTR是一个DWORD数据类型,该成员变量用来保存GDI+被初始化后在应用程序中的GDI+标识,以便能在应用程序退出后,引用该标识来调用Gdiplus:: GdiplusShutdown来关闭GDI+。 3:使用GDI+函数前,先,最好放在OnInitDialog()中 Gdiplus::GdiplusStartupInput gdiplusStartupInput; Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL); 4:使用完GDI+函数后,需要卸载GDI+ Gdiplus::GdiplusShutdown(m_gdiplusToken); 这就是基本的配置了 来源: https://www.cnblogs.com/it20120227/archive/2011

MFC/Win32中使用GDI+

你。 提交于 2020-04-01 08:42:03
一、MFC中使用GDI+的方法: 1、包含头文件与库 在stdafx.h中加入以下三行代码: #include "gdiplus.h" using namespace Gdiplus ; #pragma comment ( lib , "gdiplus.lib" ) 2、安装GDI+ 在使用GDI+之前要进行安装,否则程序不会报错,但绘图不成功。安装方法如下: GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup (&gdiplusToken, &gdiplusStartupInput, NULL ); 安装完成后就可以使用GDI+进行绘图了…… 3、卸载GDI+ 卸载调用如下函数即可 GdiplusShutdown (gdiplusToken); 二、Win32中使用GDI+的方法: 1、包含头文件与库 在stdafx.h中加入以下三行代码: #include < comdef.h > 这个头文件是必须的,要不编译时会有很多错误。 #include " gdiplus.h " using namespace Gdiplus; #pragma comment(lib, " gdiplus.lib ") 第2、3步与MFC是一样的,也列在下面,方便阅读。 2、安装GDI+