Re: How to bypass dialog box and window and create bitmap frames for animations of scrolling an listbox
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Mon, 22 Sep 2008 12:02:01 -0400
See below...
On Wed, 17 Sep 2008 20:14:12 -0700, "Siegfried Heintze" <siegfried@xxxxxxxxxxx> wrote:
I have a custom LCD display connected to a embedded processor with which I*****
communicate via USB.
Can someone point me to an example of drawing to a GDI+ bitmap without
drawing to a window first?
Create a DIB section, select it into a memory DC, draw to the memory DC
*****
I want to create a list box in a GDI+ bitmap*****
instead of a window and then scroll the contents of the listbox by
simulating mouse clicks while periodicatlly piping a copy of the bitmap
display (via IMediaSample) down thru the USB to create an animation on the
embedded device.
Seems to be a complex solution to a simple problem, but essentially, once you've drawn the
bitmap into a memory DC, you can BitBlt any arbitrary rectangle into another window's DC
during the OnPaint handler, so you can simulate scrolling by doing a different BitBlt, or
perhaps by changing the window origin of the target window. Note that you will probably
need to create a clipping region equal to the client area you want to display and select
that clipping region in, because most controls have a clipping region which is the parent
(they seem to have fixed this fundamental design error in Vista)
*****
****
I don't know how to create a listbox outside of the context of a dialog
box -- so I need help there. I don't know how to create any window (let
alone a listbox) on a GDI+ bitmap so I need help there too. I guess I would
set up a winproc and use SendMessage(WM_LBUTTONDOWN ...) to the handle of
the bitmap?
You would not create a list box. You would create a bitmap, and simulate the drawing of
the list box contents. I don't see why you want to go through all this work instead of
just creating a list box, but no, you can't really get a list box to paint itself onto a
bitmap.
****
*****
Also, I want to populate each element of the list box with images. I've seen
the code for that in MFC books. I'll need a pointer for that too.
It depends on what you mean by "images". For example, you can do an owner-draw-variable
listbox, but your maximum height is limited to 255 pixels. Some years ago I had to do a
control for a client that needed unlimited image size (1024 was common) in a listbox, as
well as scroll-by-image and scroll-image capabilities (up/down, left/right). This
required a completely custom control. They also ended up adding "iconize" so the images
could be collapsed, and double-clicking an image expanded it to full size.
To do this, you typically do an owner-draw-no-strings style listbox, and sinceyou are not
using MFC, you would use the ListBox_AddString (if you are not using MFC, you should be
using windowsx.h!) but cast a structure of your devising to the ItemData value (I think it
is the LPARAM). Then, in your WM_DRAWITEM handler for the listbox, or in my case, a
WM_PAINT for the custom control; you examine the contents of the itemdata structure, which
in my case included such things as the BITMAP structure, the HBITMAP, flags about the
iconized state, the current horizontal and vertical scroll position of the image, etc.,
and derived the necessary BitBlt information from that. Note that I could have as few as
one item, partially displayed, or a whole lot of iconized items (StretchBlt rendered them
largely unintelligible, but apparently the users could recognize what they needed), so you
would get many WM_DRAWITEM messages. It helps to set a clipping region equal to the
drawitemstruct.rcItem to avoid spillover.
joe
*****
.
Thanks!
Siegfried
- References:
- Prev by Date: Re: Why shutdown become logoff in 2008 with user of Users group?
- Next by Date: Re: How to animate pixmaps with perspective distortions?
- Previous by thread: Re: How to bypass dialog box and window and create bitmap frames for animations of scrolling an listbox
- Next by thread: Re: blinking tabs in an owner drawn tab control
- Index(es):
Relevant Pages
|