<$BlogRSDURL$>

Tuesday, April 06, 2004

Windows: A few Gotchas! 

Trial and Error Stuff

1. Have you ever used any of the IndexFromPoint function in ListBoxes, TreeViews and such? Does not seem to give the right answer always. Anyway the reason is the way to get the right index because of difference between screen and client coordinates is something like

Point pt = listEx2.PointToClient(new Point(e.X, e.Y));
int i=listEx2.IndexFromPoint(pt.X , pt.Y);

You can of course combine this in one line. Just for clarity.

2. Have you ever used COM Interop and gotten the error "Referenced assembly 'Interop.xxxxxx' does not have a strong name". The easiest way to overcome is to follow these steps.
1. Open the properties of the Project
2. In Common Properties, go to General
3. In the Wrapper Assembly Key File field, add the key file.

In order to know what is key and how to generate a key file see the previous posts.

0 Comments:

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?