gdi

WICBitmapSource.CopyPixels to GDI Bitmap Scan0

一世执手 提交于 2019-12-25 04:04:08
问题 I've modified the C# IWICBitmapSource.CopyPixels interface to allow both array marshaling and passing a pointer: void CopyPixels( WICRect prc, uint cbStride, uint cbBufferSize, [Out] [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] pbBuffer ); new void CopyPixels( WICRect prc, uint cbStride, uint cbBufferSize, IntPtr pbBuffer ); I'm calling it like this public static Bitmap FromWic(IWICBitmapSource source) { Guid format; source.GetPixelFormat(out format); PixelFormat gdiFormat =

How to keep a window in front of another applications window

若如初见. 提交于 2019-12-25 03:53:51
问题 I needed to display flashing border in on top of chosen application's window (in my example the application is cmd.exe). I used layered windows for this purpose. Everything works fine, except the one thing: I can't bring target window (in my case - cmd.exe) in front if it is overlapped by another window (if another window is in the foreground). It works when I maximize/minimize target window, but doesn't work in case when target windows is overlapped. I can't restore in clicking on app's icon

GDI and DirectX rendering

无人久伴 提交于 2019-12-25 01:23:31
问题 I have two windows, parent window where I'm rendering by D3D11 and second child window what I want to move over parent window. here is code how I'm creating windows: wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = 0; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(NULL,IDI_APPLICATION); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)0; wcex.lpszMenuName = 0; wcex.lpszClassName = L"Parent"; wcex

transparency layered window white

我怕爱的太早我们不能终老 提交于 2019-12-24 17:03:47
问题 I'm trying to make a layered window with c++ win32 but I'm having a problem with the drawing or "collision" of it For reference the picture that I'm trying to display. This is the basic creation of the window //window DWORD exFlags = 0; if(m_bTransparent) exFlags |= WS_EX_LAYERED; Create(WS_POPUP, exFlags); std::wstring sPic(L"power-disconnected.png"); m_pAlertPic = m_pPowerMon->GetGPPicMan()->LoadPicture(sPic.c_str()); // make the window layered when using transparency if(m_bTransparent && m

Remove alpha from a BitmapSource

南楼画角 提交于 2019-12-24 13:32:18
问题 I use BitBlt() and CreateBitmapSourceFromHBitmap() to capture a window as a BitmapSource that I can display on an Image element in a WPF application. But for some reason, most of the application that it captures is transparent. Here is a source vs. capture image of what's happening: (source: umbc.edu) It's gray because the background of the window it's on is gray. Whatever background I give the window will show through. How can I get the captured image to more accurately reflect the original?

How to get a 32bpp bitmap/image from a GDI Device Context?

夙愿已清 提交于 2019-12-24 12:33:01
问题 I am using code from this Project http://www.codeproject.com/Articles/9064/Yet-Another-Transparent-Static-Control in order to draw transparent button images from my subclassed Button control onto my CDialogEx. This code is meant for legacy 24bpp GDI functions: BOOL CTransparentStatic2::OnEraseBkgnd(CDC* pDC) { if (m_Bmp.GetSafeHandle() == NULL) { CRect Rect; GetWindowRect(&Rect); CWnd *pParent = GetParent(); ASSERT(pParent); pParent->ScreenToClient(&Rect); //convert our corrdinates to our

How to get a 32bpp bitmap/image from a GDI Device Context?

瘦欲@ 提交于 2019-12-24 12:27:07
问题 I am using code from this Project http://www.codeproject.com/Articles/9064/Yet-Another-Transparent-Static-Control in order to draw transparent button images from my subclassed Button control onto my CDialogEx. This code is meant for legacy 24bpp GDI functions: BOOL CTransparentStatic2::OnEraseBkgnd(CDC* pDC) { if (m_Bmp.GetSafeHandle() == NULL) { CRect Rect; GetWindowRect(&Rect); CWnd *pParent = GetParent(); ASSERT(pParent); pParent->ScreenToClient(&Rect); //convert our corrdinates to our

Drawing a circle with GDI graphics on WPF

不问归期 提交于 2019-12-24 11:37:52
问题 I need to draw with GDI graphics a circle on my form in WPF. I can't do this with windows forms, so i have added a using. I can not use the Elipse controls from WPF. My teacher told me to do this like this. This is my code: public void MakeLogo() { System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Green); System.Drawing.Graphics formGraphics = this.CreateGraphics(); formGraphics.FillEllipse(myBrush, new System.Drawing.Rectangle(0, 0, 200, 300)); myBrush

How to draw a string on two not adjacent areas

佐手、 提交于 2019-12-24 09:24:18
问题 I can not figure out if there is there any way in GDI32 to draw a string on two not adjacent areas (let's say Rectangles) on a form?. The text should automatically split if the edge of the first rectangle is reached as shown in the example picture. Thanks for your help. 回答1: An example, using two Labels and a TrackBar . The TrackBar determines a string position inside one Label, which reflects on the second Label each time the string is moved . This cascading effect is generated using the

Overlay WinForms controls on DirectX content

六月ゝ 毕业季﹏ 提交于 2019-12-24 08:58:28
问题 I'm trying to create a graphics library with graphics control. The control enables adding overlay controls. The graphics on the control uses DirectX and is part of the library, while the overlay controls are provided by end users of the library which are not graphics experts. Thus stability and convenient API are the most important issues. For technical reasons I need to show the graphics by DirectX directly on the control and cannot host the DirectX scene using another framework as WPF (For