473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

LB_SETITEMHEIGHT example message

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 -
Nov 16 '05 #1
3 3666
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2
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" <ma********************@mvps.org> wrote in message
news:ez**************@TK2MSFTNGP11.phx.gbl...
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #3
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" <ga************@drdc-rddc.gc.ca> wrote in message news:<10***************@viz.drev.dnd.ca>...
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" <ma********************@mvps.org> wrote in message
news:ez**************@TK2MSFTNGP11.phx.gbl...
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: relaxedrob | last post by:
Hi All! I ran the following w3c example through my WSDL parser (SOA Editor from Cape Clear): http://www.w3.org/TR/wsdl#_rpcexample It told me that there were a bunch of erros about no...
13
by: vbmax | last post by:
Hi to all! I have to write the following program. 1.User inputs a number (example: 5) 2.Then (because he entered 5) he enters 5 times, each time different, 3-placed number (example: 134, 256,...
10
by: Bart Goeman | last post by:
Hi, I have a question about how to put redundant information in data structures, initialized at compile time. This is often necessary for performance reasons and can't be done at run time (data...
5
by: Serge | last post by:
Hi, I am having a thread hang problem in my c# code. The example on the website: http://csharp.web1000.com/ is a simplified version of my problem. You will see in the form that a...
2
by: Tash Robinson | last post by:
I have been searching and can not seem to find a good example of a working UDP client that listens, but does not block while waiting for data arrival. I am trying to write a client application...
3
by: Peder Y | last post by:
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 -
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
3
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the...
3
by: Amie | last post by:
Hi, I would like to know if it's possible to display a message using python, if so can you show me an example. I saw something like:" from twisted.python import log log.msg" in some programs...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.