开发者

listview behaves different when used in activex component

I am developing an activeX image editor using c# .net 2.0

I use listview control to display thumbnail images. Normally if you use Shift key for selecting multiple items it selects the whole range between the selected and the clicked item. But when used as activeX it selects items in a rectangular canvas between selected and clicked items.

I cant add picture so i will illustrate like this :)

second item is selected and i Shift click on 7.

this is what i need:

xxxx

xxxx

this is what happens:

xxxx

xxxx

bold x: selected.

The component is used in .net based app. also in web apps as activex object. I want te开发者_如何学JAVA listview to behave the same at every location. Any ideas?

PS: .net ver 2.0


It is not that clear what 'used as activex' might mean. If that means your component is getting used in another, non .NET program then this has an explanation. The code for the native ListView control, wrapped by the .NET ListView class, is stored in comctl32.dll. There are two versions of that DLL, one in c:\windows\system32, another in in the Windows side-by-side cache (c:\windows\winsxs\etc...)

The one in system32 is a legacy version, used by old programs. Using the side-by-side version requires the program telling Windows that it wants to use the latest version, not the legacy one. These versions don't behave the same, seeing different behavior in the way they select items could certainly be explained by this.

You are subject to what this program is telling Windows. This is typically done by including a manifest but that's not a realistic option. It is very likely to break the program when it gets a version of comctl32.dll that it was never tested with. The programmatic way is CreateActCtx(), you'd have to pinvoke it before you create the ListView control. This API function is not exactly easy to use. Do consider if you really want to make your list view behave differently from any other list view that this program might be using.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜