Prevent of list view columns width change

G

Guest

Hi All!

Is there any way to prevent changing listView control columns width? I have to hide some columns in listView, setting they width to 0, but some users could change their width and saw a column content.

Thanks for any help!
Kind regards
Krzysztof Kazmierczak
 
Y

yououtthere

Krzysztof,

Will changing the HeaderStyle property of the listview control to
nonclickable do what you want or is it to restrictive.

HTH,

Geoff

Krzysztof Kazmierczak said:
Hi All!

Is there any way to prevent changing listView control columns width? I
have to hide some columns in listView, setting they width to 0, but some
users could change their width and saw a column content.
 
G

Guest

Unfortunately, HeaderStyle did not help ;) but thanks a lot for your hint ;

Kind regard
Krzysztof Kazmierczak
 
Y

yououtthere

Sorry Krzysztof,

this prevents resizing in the ide but not when the app is actually running.
 
S

Serg Kuryata [MS]

Hello Krzysztof,

As far as I know, there is no way to prevent changing columns width. Could
you please explain to me why you need it?

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Thread-Topic: Prevent of list view columns width change
| thread-index: AcQWJMdT6uTgTm/yS2GdAhchwzJqAg==
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| From: =?Utf-8?B?S3J6eXN6dG9mIEthem1pZXJjemFr?=
<krzysztof@NO_SPAMsmartsolutions.pl>
| Subject: Prevent of list view columns width change
| Date: Mon, 29 Mar 2004 23:01:09 -0800
| Lines: 7
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:49807
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi All!

Is there any way to prevent changing listView control columns width? I have
to hide some columns in listView, setting they width to 0, but some users
could change their width and saw a column content.

Thanks for any help!
Kind regards
Krzysztof Kazmierczak
|
 
S

Serg Kuryata [MS]

Hi Krzysztof,

First of all, I want to apologize that it took me so long to reply to you.

What you can do is to derive your own class from the ListViewItem class,
add some fields/properties in order to store required data and then use the
class as you would normally use the ListViewItem class. For example, you
could do something like the following:

public class MyListViewItem : ListViewItem
{
private int id;

public MyListViewItem()
{
this.id = -1;
}

public int Id
{
get
{
return(this.id);
}

set
{
this.id = value;
}
}
}



MyListViewITem item;

item = new MyListViewItem();
item.Text = "Item 1";
item.Id = 23;

this.listView.Items.Add(item);

Hope this helps,
Thank you,
Sergiy.


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Thread-Topic: Prevent of list view columns width change
| thread-index: AcQcDE2wSYOREDSvTDOXITifrPixWg==
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| From: =?Utf-8?B?S3J6eXN6dG9mIEthem1pZXJjemFr?=
<krzysztof@NO_SPAMsmartsolutions.pl>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Prevent of list view columns width change
| Date: Tue, 6 Apr 2004 12:21:04 -0700
| Lines: 8
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:50389
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Sergiy!

I use ListView control in my mobile application. I create column in which i
have an Id, for example, but i dont't want my users to see that column. I
can set its width to 0, but user can resize that column. And that's why i
want to pervent columns resizing ;) Maybe there is some better way?

Kind regards!!
Krzysztof


|
 

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

Top