device-context

how to drag image in a wxpython frame

对着背影说爱祢 提交于 2020-01-04 20:25:38
问题 what is the easiest way to drag an image ( or text) in a wx window ? i need steps or a small example on how to do that. thanx in advance 回答1: Take a look at the PseudoDC example in the wxPython demo. The sample displays some random shapes within the window which you can grab and move around, you should be able to apply the concepts for an image. You can download the win32-docs-demos from here 回答2: Install wxpython demos, there is DragImage demostration in it. 来源: https://stackoverflow.com

how to drag image in a wxpython frame

喜欢而已 提交于 2020-01-04 20:24:34
问题 what is the easiest way to drag an image ( or text) in a wx window ? i need steps or a small example on how to do that. thanx in advance 回答1: Take a look at the PseudoDC example in the wxPython demo. The sample displays some random shapes within the window which you can grab and move around, you should be able to apply the concepts for an image. You can download the win32-docs-demos from here 回答2: Install wxpython demos, there is DragImage demostration in it. 来源: https://stackoverflow.com

OpenGL get Device Context

一世执手 提交于 2020-01-03 05:07:33
问题 I am trying to create an OpenGL application on windows. As far as I can understand, one of the first things I must acquire is a Device Context, which must be passed on to a couple of functions that choose and set a pixel format and create a rendering context. I used the OpenGL wiki to get a rough idea about what I should do. My code is something like: #include <iostream> #include <windef.h> #include <wingdi.h> HDC hdc; int main() { hdc = wglGetCurrentDC(); std::cout << "HDC: " << hdc << std:

How to fill a rectangle region with Semi-transparent brush in MFC?

故事扮演 提交于 2019-12-25 12:11:52
问题 I need to fill a rectangular region with semi-transparent color/brush in mfc. How can I achieve that? 回答1: You can't just fill a rectangle with a semi-transparent brush, you'll need to use something like AlphaBlend or TransparentBlt to create the effect. An example is available here: http://www.codeproject.com/Articles/286/Using-the-AlphaBlend-function 回答2: I found the solution. To fill the rectangle region with semi-transparent brush, we need to use GdiPlus objects. Here is the Sample Code:

How to fill a rectangle region with Semi-transparent brush in MFC?

六月ゝ 毕业季﹏ 提交于 2019-12-25 12:10:11
问题 I need to fill a rectangular region with semi-transparent color/brush in mfc. How can I achieve that? 回答1: You can't just fill a rectangle with a semi-transparent brush, you'll need to use something like AlphaBlend or TransparentBlt to create the effect. An example is available here: http://www.codeproject.com/Articles/286/Using-the-AlphaBlend-function 回答2: I found the solution. To fill the rectangle region with semi-transparent brush, we need to use GdiPlus objects. Here is the Sample Code:

how to draw into a PaintDC and MemoryDC in parallel?

随声附和 提交于 2019-12-25 06:31:37
问题 I'm looking for a pice of code, how to use a wx.PaintDC() and wx.MemoryDC in parallel. My wxPython is in version 2.8.12 and I do not get it work to draw to a wx.PaintDC() into a wx.Window, while also having a thread running, that draws to a wx.MemoryDC into a bitmap. Like this: def onPaint(self, evt): self.dc=wx.PaintDC(self) imgbuf, (sx, sy), self.refresh_needed=self.osm.getBitmap() self.dc.DrawBitmap(imgbuf, sx, sy) as_thread() w, h=self.__getBitmapSize() self.bmpbuf=wx.EmptyBitmapRGBA(w, h

Win32 DrawText line height

末鹿安然 提交于 2019-12-23 15:21:39
问题 I'm calling the Win32 DrawText function to output some text into a device context. The text is long and wraps nicely onto a second line. The problem is I need to decrease the space between lines a bit (I guess decrease the line height?). Any ideas on how to do this? I would just call DrawText twice (one for each line) but then I have to do my own word wrap. Is there any other way? Thanks 回答1: One possibility is to put the text into a disabled Rich Edit Control. I think that gives you a lot of

Win32API) Why should I GetDC and ReleaseDC again and again?

此生再无相见时 提交于 2019-12-13 11:28:57
问题 Every example codes I saw are GetDC and releaseDC again and again. (or BeginPaint/EndPaint) But I think drawing screen happens very frequently(especially in game), store them in memory is better then get and release all time. So I did like keep mainDC as global and just use it, only release it when program ends. But why people doesn't do like this? (maybe Get/Release DC costs very little?) case WM_CREATE: hdc = GetDC(hWnd); //hdc is declared as global HDC MyBitmap = LoadBitmap(g_hInst,

Can you render a StreamGeometry object in multiple places during an OnRender override?

∥☆過路亽.° 提交于 2019-12-13 04:42:47
问题 We have a StreamGeometry object which we would like to render in about 400 different locations during the OnRender call. The problem is, of course, that a geometry object uses absolute coordinates. While we could of course apply transforms before the render call, that means we'd in essence be creating 400 transforms as well, which just seems like overkill. We just want to say 'Render this in that location, like this (Note: DrawGeometryAtPoint is fictitious)... protected override void OnRender

How to Get TCanvas DC in Firemonkey?

↘锁芯ラ 提交于 2019-12-12 13:15:20
问题 What I need I need to get the DC of a Firemonkey component's TCanvas . I need this to use Win API drawing functions not accessible through Firemonkey, mainly 100% control over font rendering. Obviously, this is a pure Windows Application, so any compatibilities with OSX isn't an issue. What I did I managed to get hold of the TForm's handle and convert it into a HWND, then getting the DC with GetDC(FmxHandleToHWND(Handle)); This is the OnPaint handler for the Character_PaintBox control. HWND