|
|
Hi.
For obtain index of the first visible ListViewItem of a ListView I can use the the TopItem Properties. I would obtain index of the last visible ListViewItem.
How i can do?
Thank's.
Gianpiero from Italy
|
|
|
|
|
Hi!
One way to do this is to use ListView.GetItemRect() to get the height of a single item and divide the ListView's Height by this value.
Then you have the number of visible items in your ListView and can calculate the index of the last visible Item.
Regards,
mav
|
|
|
|
|
I already tried your solution. but it isn't the right solution.
This because the value that I obtain from ListView.Heigth/ListView.GetItemRect().Heigth is a number that not correspond to real a visible object. This values is number of displaied object + tot; where tot is variable and its value change when I try to resize the control.
Tank so much.
|
|
|
|
|
The solution _is_ correct, how else would the ListView draw its items?
I just didn't give you ready-to-use code but thought you could work it out from there, but obviously I was wrong.
So here's the full code - I explicitely tried it and it does work.
int first = listView1.TopItem.Index;
int h_tot = listView1.ClientRectangle.Height - 1;
int h_hdr = listView1.GetItemRect(first).Y;
int h_item = listView1.GetItemRect(0).Height;
int cntVis = (h_tot-h_hdr) / h_item;
int last = Math.Min(listView1.Items.Count-1, first+cntVis);
mav
|
|
|
|
|
Ok its right!!! I tried again and I resolved mi problem. Thank yuo very much.
Gianpiero.
|
|
|
|
|
Hi, is there a simple way to convert formats like BMP GIF and so on to the JPEG format? How do I do this?
|
|
|
|
|
Yup, this should do it
Bitmap image( @"C:\mypic.bmp" );<br />
image.save( @"C:\mypic.jpg", ImageFormat.Jpeg );
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
I want to create a tabel with 3 columns and multiple row which can be filetered and sorted. The data is not located in a database.
Is the datagrid the correct coice of control to use? If not which should I use. I am concerned as all the examples I have seen seem to be link to a database. Does anyone have an example of non-database use?
Thanks,
Liam
|
|
|
|
|
Well, what's the table's filename extension then Liam? What kind of a table is it?
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
The data is not an external file so does not have an extension. The table will be constructed from a number of variables in the code. The first column will be a description (this will not change after initialisation), the second column will be updated periodically and the third colum will be the time of update.
Hope this clarifies things a bit.
Thanks,
Liam
|
|
|
|
|
LiamD wrote:
Is the datagrid the correct coice of control to use?
Take a look at this article.[^] I believe it gives you an alternative to the DataGrid by allowing you to attach a data source to a ListView, something that .NET's implementation doesn't do. You should then be able to change the filter and sortby of the DataView.
The only reason you see examples linked to a database is that it's an easy way of populating the DataTable. You can certainly create the Columns, do a NewRow, set the fields, and do an AddRow yourself.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Depends on what exactly you want.
If you want an easy and straight way and your data isnt too big (lets say less then 100000 rows) then you can just pack your whole data into a DataTable and display it in the grid. This way you will have sorting and filtering capabilities right from the start. That the data isnt bound to any database isnt relevant.
For some extended filter functionality in DataGrid have a look at this article.
|
|
|
|
|
Hi,
I've wrote a .Net Remoting client-server application. I'm using a config file to connect the components and use the Ingo Rammer RemotingHelper class
http://www.thinktecture.com/Resources/RemotingFAQ/USEINTERFACESWITHCONFIGFILES.html[^]" rel="nofollow">
The problem is : I can't disconnect client from server (only when I exit the exe).
I disconnect client from server using
RemotingServices.Disconnect(ObjetMarshal);
but I have an error : "Cannot call disconnect on a proxy"
Thanks !
|
|
|
|
|
Hi Soke,
You can call the RemotingServices.Disconnect method on remoting proxies.
Guess the following link will help you.
http://blogs.msdn.com/manishg/
Thanks and Regards
SGS
|
|
|
|
|
Thanks for your answer !
But there is something I don't understand. In fact Disconnect method doesn't really disconnect client Ok for that but how than disconnect ?
I don't find the answer on the mentionned blog :s
In fact, I would like to unregister the channel on which i was connected (to have all my ressources free)
Thanks !
Sok
ps: i'm working with framework 1.1
|
|
|
|
|
Hi Sok,
The blog which i mentioned talk about RemotingServices.Disconnect method.
To unregister a channel you can use ChannelServices.UnregisterChannel method.
ChannelServices.UnregisterChannel(channelobj);
Thanks and Regards
SGS
|
|
|
|
|
Yes of course there is the ChannelServices.UnregisterChannel method
But my problem is than i connect my clients with config file and activator.getObject.. Then I can't find the way to unregister the channel
|
|
|
|
|
hi all,
I have done a C# Applcation with TextBoxes,Labels and DataGrid.Default Window State of the Form is "Normal".
Now I want to resise Controls in the Window Form when maximising the Dialog..
How can I do it?if any one knows it ,please reply me..
thanks in advance..
|
|
|
|
|
you can use the Anchor propriety of the controls to a certain degree. For example if you have a control Anchored to a margine, whenever that margine is moved the control will always keep the same distance from that margine. if the control is Anchored to two oposed Margines(left and right for example), when the parent control is resized, the control will increase his size acordingly so as to keep the same distances from the margins(in the left right case he will increase his width). Anchors work in desing mode too .. you should try and experimet with them there.
if you want more control you can handle the SizeChanged event of the parent control (this beeing in your case the main form).
|
|
|
|
|
Thanks for reply..
This Method is work successfully if one control in the Windows Form.
How is this implement to WindowForm exist with many Controls..?
|
|
|
|
|
|
hi
if we add many controls to the Application,and do Anchor for all controls,after that maximising several times, some controls are going to invisible.
that's the problem.
|
|
|
|
|
Sounds very strange. Never heard of that one. But I've experienced similar problems in other situations (I have a button on a tabpage that tends to disappear when I disable/enable it).
Do they appear again when you manually call Invalidate() on the form after maximising? Maybe that could be a workaround.
Claudio
Claudio's Website
Hommingberger Gepardenforelle
|
|
|
|
|
If you are using teh visual studio IDE it's simple by only holdig Control key while clicking the con trols you want to set it's auncher property,and then set the directions you want this control to be auncher to.
|
|
|
|