Пример #1
0
        /// <summary>
        /// Loads the list of DataHelpers found in the form.
        /// </summary>
        private void LoadListOfDataHelpers()
        {
            int index = 0;

            try
            {
                DHComboBox.Items.Clear();
                Control ctrl = (Control)context.Instance;

                foreach (Control childCtrl in ContainerHelper.Controls(ctrl.FindForm()))
                {
                    if (childCtrl is DataHelper)
                    {
                        index = DHComboBox.Items.Add(childCtrl);
                        if ((_dataHelperBindingInfo != null) && (_dataHelperBindingInfo.BindingControl != null) &&
                            (_dataHelperBindingInfo.BindingControl.Equals(childCtrl)))
                        {
                            DHComboBox.SelectedIndex = index;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
        /// <summary>
        /// Tries to find the form containing this instance and loads the image list of VB6.
        /// </summary>
        /// <param name="vb6ImageListName">The name of the VB6 ImageList.</param>
        /// <returns>True if image list was successfully loaded.</returns>
        private bool LoadVb6ImageListFromControlName(string vb6ImageListName)
        {
            Form parentForm = FindForm();

            if (parentForm != null)
            {
                Control ctrl = ContainerHelper.Controls(ParentForm)[vb6ImageListName];
                if (ctrl != null)
                {
                    return(LoadVB6ImageList(ctrl));
                }
            }

            return(false);
        }