From: Peter Duniho on
Jeff Johnson wrote:
> Oh, I wasn't suggesting using the PictureBox in that manner. I was just
> wondering if the OP knew how to draw at all, and the PictureBox seemed like
> the easiest thing to draw on.

What makes the PictureBox any easier to draw on than anything else?

> I guess you could just draw right on a Form, though.

You don't even need a Form. You can just create a Control sub-class of
your own. Or you can drop a Panel instance into the Form and subscribe
to its Paint event to draw into that (the Panel has the nice quality
that it's very simple, has no visual elements of its own, but is still a
full-fledged control that can be manipulated in the Designer�in other
words, it's pretty much the simplest control available, short of just
writing one's own Control sub-class).

Pete
From: Jeff Johnson on
"Peter Duniho" <no.peted.spam(a)no.nwlink.spam.com> wrote in message
news:%23YIJMfV1KHA.5972(a)TK2MSFTNGP06.phx.gbl...

>> Oh, I wasn't suggesting using the PictureBox in that manner. I was just
>> wondering if the OP knew how to draw at all, and the PictureBox seemed
>> like the easiest thing to draw on.
>
> What makes the PictureBox any easier to draw on than anything else?
>
>> I guess you could just draw right on a Form, though.
>
> You don't even need a Form. You can just create a Control sub-class of
> your own. Or you can drop a Panel instance into the Form and subscribe to
> its Paint event to draw into that (the Panel has the nice quality that
> it's very simple, has no visual elements of its own, but is still a
> full-fledged control that can be manipulated in the Designer�in other
> words, it's pretty much the simplest control available, short of just
> writing one's own Control sub-class).

Apparently I haven't been clear. I'm talking about for testing and learning
purposes ONLY. I'm not suggestion any implementation. And for learning, it
seems to me far easier to just create a new Windows Forms project, slap a
PictureBox on it, and draw. Or just draw on the form. Your suggestion about
creating your own custom control seems like it's more for a final product
than simply playing with the Graphics object.


From: vanderghast on
You don't need a special control in order to make your own painting "per
item" with a list box since setting the DrawMode property to OwnerDrawFixe
of OwnerDrawVariable would allow listbox_DrawItem event to fire, with an
appropriate graphical environment.
http://www.amazon.com/Windows-Forms-Programming-Microsoft-Development/dp/0321267966/ref=sr_1_1?ie=UTF8&s=books&qid=1270564182&sr=1-1,
pages 362-365 supply two examples (one with fixed height, one with variable
height, per item (listbox_MeasureItem event is then involved too, in this
last case)).


Vanderghast, Access MVP


"Gladys" <Gladys(a)nomail.nospam> wrote in message
news:OZCQJvC1KHA.5996(a)TK2MSFTNGP05.phx.gbl...
> Hi everybody, i have a problem creating a owner drawn ListBox.
>
> I need a ListBox that accepts graphic icons (.ico) files between the text
> (e.g. some text [myIcon.ico] more text and then another icon
> [myIcon.ico] and some text )
> So i I am assuming that this is only possible creating a owner drawn
> ListBox.
> I'm a beginner, so an simple example would be nice.
>
> Thanks in advance,
>
> Gladys
>

From: Peter Duniho on
Jeff Johnson wrote:
> Apparently I haven't been clear. I'm talking about for testing and learning
> purposes ONLY. I'm not suggestion any implementation. And for learning, it
> seems to me far easier to just create a new Windows Forms project, slap a
> PictureBox on it, and draw. Or just draw on the form. Your suggestion about
> creating your own custom control seems like it's more for a final product
> than simply playing with the Graphics object.

Nevertheless, that doesn't answer my question. Even for "testing and
learning purposes", what makes the PictureBox class easier to use or
otherwise a superior choice over, for example, the Panel class?

If you've got an image to display and don't want to use DrawImage()
yourself, then sure�PictureBox seems like a fine choice. But for simply
drawing, it seems like overkill to me. Why do you feel it's better than
other choices available?

Pete
From: Gladys on
> You don't need a special control in order to make your own painting "per
> item" with a list box since setting the DrawMode property to OwnerDrawFixe
> of OwnerDrawVariable would allow listbox_DrawItem event to fire, with an
> appropriate graphical environment.
> http://www.amazon.com/Windows-Forms-Programming-Microsoft-Development/dp/0321267966/ref=sr_1_1?ie=UTF8&s=books&qid=1270564182&sr=1-1,
> pages 362-365 supply two examples (one with fixed height, one with
> variable height, per item (listbox_MeasureItem event is then involved too,
> in this last case)).

Thanks !
I have found a copy!

Gladys