468,161 Members | 1,946 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,161 developers. It's quick & easy.

Scrolling list of user controls (and more)


Hello again,

I have a problem that I can't seem to find any help for. I'm probably not typing the
correct words into goo... *cough*... MSN.

I have created a user control which I would like to use as items in a list. The list would
display as many of these controls as I wish to add, scrolling as it needs to.

I KNOW this functionality exists already in every list you care to mention but I don't
know how to go about making a list display my user control rather than a string as
seems to often be the case.

Anyone help?

------------------------------------

Another unchecked rambeling brought to you by:

Oddball
joshua@bf#N0SP4M#wd.co.uk
Nov 17 '05 #1
3 5010
Dear Oddball,

This might help : (from MSDN)

Typically, Windows handles the task of drawing the items to display in the
ListBox. You can use the DrawMode property and handle the MeasureItem and
DrawItem events to provide the ability to override the automatic drawing
that Windows provides and draw the items yourself. You can use owner-drawn
ListBox controls to display variable-height items, images, or a different
color or font for the text of each item in the list. The HorizontalExtent
property, GetItemHeight, and GetItemRectangle property also provide
assistance for drawing your own items.
Possibly better would be a Listview in Detail mode. I've been using a
control that 'merges' a tree view and a list view
(http://www.codeproject.com/cs/miscct...elistview.asp). That could be a
useful starting point for your needs, though I should warn you that I had to
make quite a few minor fixes before it behaved as I wanted; I hope to post
them back to the site at some point. That uses the Listview to draw the text
and some images, but then draws additional stuff itself, using the
SetIndentation to make space (note - Indentation is based on image width, so
no ImageList, no indentation). It also uses BeforeLabelEdit and
AfterLabelEdit to change the editing Textbox to a Combobox, or similar,
during editing.
Failing that, could you create a scrollable control and handle other
drawing, user input, etc. yourself?
HTH - feels like a single post from me is enough to kill a thread, so sorry
if that happens!!!! ;o)

Now, if I could just get an answer to my scrolling problem ('Scrolling bug
in MDI client windows') I'd be a happy guy...

James

Nov 17 '05 #2

Questions as vague as the one I asked usualy don't get ANY replies, I'm happy with
just one... I'll give it a coat of looking at.

"James CC" <Ja*****@Nowhere.com> wrote:
Dear Oddball,

This might help : (from MSDN)

Typically, Windows handles the task of drawing the items to display in the
ListBox. You can use the DrawMode property and handle the MeasureItem and
DrawItem events to provide the ability to override the automatic drawing
that Windows provides and draw the items yourself. You can use owner-drawn
ListBox controls to display variable-height items, images, or a different
color or font for the text of each item in the list. The HorizontalExtent
property, GetItemHeight, and GetItemRectangle property also provide
assistance for drawing your own items.
Possibly better would be a Listview in Detail mode. I've been using a
control that 'merges' a tree view and a list view
(http://www.codeproject.com/cs/miscct...elistview.asp). That could be a
useful starting point for your needs, though I should warn you that I had to
make quite a few minor fixes before it behaved as I wanted; I hope to post
them back to the site at some point. That uses the Listview to draw the text
and some images, but then draws additional stuff itself, using the
SetIndentation to make space (note - Indentation is based on image width, so
no ImageList, no indentation). It also uses BeforeLabelEdit and
AfterLabelEdit to change the editing Textbox to a Combobox, or similar,
during editing.
Failing that, could you create a scrollable control and handle other
drawing, user input, etc. yourself?
HTH - feels like a single post from me is enough to kill a thread, so sorry
if that happens!!!! ;o)

Now, if I could just get an answer to my scrolling problem ('Scrolling bug
in MDI client windows') I'd be a happy guy...

James

------------------------------------

Another unchecked rambeling brought to you by:

Oddball
joshua@bf#N0SP4M#wd.co.uk
Nov 17 '05 #3
Dear Oddball,

For the TreeListView, the author catches windows messages to know when to
paint, etc. You could no doubt do the same.

By the way, whats a 'coat of looking at'??

Either way, you now have two replies....

James
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by headware | last post: by
13 posts views Thread by al jones | last post: by
5 posts views Thread by Vigneshwar Pilli via DotNetMonster.com | last post: by
1 post views Thread by Oberfuhrer | last post: by
1 post views Thread by atif | last post: by
2 posts views Thread by Rob Pollard | last post: by
11 posts views Thread by =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.