LB_SETITEMHEIGHT example message

  • Thread starter Thread starter Peder Y
  • Start date Start date
P

Peder Y

Can anyone provide a simple example on how to use a message with LB_SETITEMHEIGHT?

I need to resize a listBox 'cell' at runtime.

Thanks!


- Peder -
 
Peder,
Can anyone provide a simple example on how to use a message with LB_SETITEMHEIGHT?

[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam,
IntPtr lParam);

const uint LB_SETITEMHEIGHT = 0x1a0;

....

SendMessage( theListBox.Handle, LB_SETITEMHEIGHT, (IntPtr)index,
(IntPtr)height );



Mattias
 
you don't need to do this in .Net

you can use .Net built-in features to change control properties

what are you trying to do?


Mattias Sjögren said:
Peder,
Can anyone provide a simple example on how to use a message with
LB_SETITEMHEIGHT?

[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam,
IntPtr lParam);

const uint LB_SETITEMHEIGHT = 0x1a0;

...

SendMessage( theListBox.Handle, LB_SETITEMHEIGHT, (IntPtr)index,
(IntPtr)height );



Mattias
 
I'm trying to change the ItemHeight of a single item (say item 3) in a
ListBox. AFAIK this cannot be done without either the message method
or deleting all Items and refilling the list. The control I'm making
is supposed to enlarge the item the mouse is hovering over. Clearly
the last method would be very inefficient for big lists. Hope this
clears things up. If there is a better .Net method, let me know. I
have searched high and low for one and noone seems to know.

Thanks!

- Peder -



gary hitch said:
you don't need to do this in .Net

you can use .Net built-in features to change control properties

what are you trying to do?


Mattias Sjögren said:
Peder,
Can anyone provide a simple example on how to use a message with
LB_SETITEMHEIGHT?

[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam,
IntPtr lParam);

const uint LB_SETITEMHEIGHT = 0x1a0;

...

SendMessage( theListBox.Handle, LB_SETITEMHEIGHT, (IntPtr)index,
(IntPtr)height );



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top