device-context

how to display IBitmapImage on CDC

What is the best way to display IBitmapImage on a device context. I am using Windows CE 6.0. void CImaginingTestView::OnDraw(CDC* pDC) { CImaginingTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); IBitmapImage* pBitmapImage = pDoc->GetBitmapImage(); if (pBitmapImage) { // how to draw my bitmap on a pDC ?? ...

Win32 DrawText line height

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 ha...

The legacy device context is too coarse.

Hi. I have a Process Control system. It has a huge 2D workspace where all the logic is laid out. The 2D workspace is a coordinate system. You usually do not see the whole workspace at once, but rather some in-zoomed part of it focusing on some part of the controlled process. Such subsystem views are bookmarked into predefined named ima...

how to drag image in a wxpython frame

hello 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 ...

Win32: Does a window have the same HDC for its entire lifetime?

Am i allowed to use a DC outside of a paint cycle? Is my window's DC guaranteed to be valid forever? i'm trying to figure out how long my control's Device Context (DC) is valid. i know that i can call: GetDC(hWnd); to get the device context of my control's window, but is that allowed? When Windows sends me a WM_PAINT message, i am ...

how to erase lines with wxpython

hello I'm trying to make a paint tool in wxpython. and i couldn't find a way to make an ( Eraser ) . how can i make an eraser tool - just like the one in windows paint - in wxpython ? please help . the idea or small code sample would be very helpful thanks in advance ...

QT: Scroll widget that renders directly to the DC

I'm trying to create a widget which paints directly to the windows Device Context by calling getDC() and painting an HBITMAP to it. The widget I'm painting resides inside a scroll widget. I've implemented the paintEvent() and it does seem to paint but immediatly after painting the widget gets painted over again with a blank gray color. ...

Understanding Device Contexts

As a relative newcomer to MFC, I see Device Contexts (DCs) a lot. I vaguely understand that it's something to do with drawing, but the specifics are not very well explained anywhere that I can find. What does creating a "compatible Device Context" mean, and why is it important? What does SelectObject do, and how must I make a DC compatib...

How to draw a web page into a memory DC ?

I would like to trick Chrome in to rendering its tabs in some memory device context of mine. Is this possible at all ? Thank you ! ...

Strange error with CreateCompatibleDC

Maybe this is a foolish question, I can't see why I can not get a DC created in the following code : HBITMAP COcrDlg::LoadClippedBitmap(LPCTSTR pathName,UINT maxWidth,UINT maxHeight) { HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, pathName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); ...

Draw on DeviceContext from COLORREF[]

Hi, I have a pointer to a COLORREF buffer, something like: COLORREF* buf = new COLORREF[x*y]; A subroutine fills this buffer with color-information. Each COLORREF represents one pixel. Now I want to draw this buffer to a device context. My current approach works, but is pretty slow (== ~200ms per drawing, depending on the size of th...