/// <summary> /// Returns a ImageListHelper created based on a VB6 ImageList object. /// </summary> /// <param name="VB6ImageList">The VB6 Imagelist object.</param> /// <returns>An instance of a ImageListHelper.</returns> private static ImageListHelper GetImageListHelper(object VB6ImageList) { ImageListHelper imgHelper = new ImageListHelper(); imgHelper.LoadVB6ImageList(VB6ImageList); return imgHelper; }
/// <summary> /// Returns a ImageListHelper created based on a VB6 ImageList (name). /// </summary> /// <param name="lView">The ListView is used to get access to /// the original VB6 ImageList based on its name.</param> /// <param name="VB6ImageListName">The name of the VB6 Image List.</param> /// <param name="onDesignMode">Is Design Mode?</param> /// <returns>An instance of a ImageListHelper.</returns> private static ImageListHelper GetImageListHelper(ListView lView, string VB6ImageListName, bool onDesignMode) { ImageListHelper imgHelper = new ImageListHelper(); Form parentForm = lView.FindForm(); if (parentForm != null) { object imlControl = ContainerHelper.Controls(parentForm)[VB6ImageListName]; if (imlControl != null) { imgHelper.LoadVB6ImageList(imlControl); } else { if (!onDesignMode) { Type type = parentForm.GetType(); FieldInfo finfo = type.GetField(VB6ImageListName); if (finfo != null) { object field_value = finfo.GetValue(parentForm); imgHelper.NETImageList = field_value as ImageList; } } } } return imgHelper; }