Пример #1
0
        /// <summary>
        /// 将选择的项目同步到<see cref="AIDAShownItems"/>中
        /// </summary>
        /// <param name="checkedItemCollection"></param>
        /// <param name="aIDADataType"></param>
        public static void SyncSeletedItems(this CheckedItemCollection checkedItemCollection, AIDADataType aIDADataType)
        {
            List <string> items = new List <string>();

            foreach (var item in checkedItemCollection)
            {
                items.Add(item.ToString());
            }
            switch (aIDADataType)
            {
            case AIDADataType.System:
                Config.ConfigData.AIDAShownItems.AIDA64Data.System.Clear();
                items.ForEach(t => Config.ConfigData.AIDAShownItems.AIDA64Data.System.Add(AIDA64Handler.GetItemByLabel(t)));
                break;

            case AIDADataType.Temperature:
                Config.ConfigData.AIDAShownItems.AIDA64Data.Temperature.Clear();
                items.ForEach(t => Config.ConfigData.AIDAShownItems.AIDA64Data.Temperature.Add(AIDA64Handler.GetItemByLabel(t)));
                break;

            case AIDADataType.Volt:
                Config.ConfigData.AIDAShownItems.AIDA64Data.Volt.Clear();
                items.ForEach(t => Config.ConfigData.AIDAShownItems.AIDA64Data.Volt.Add(AIDA64Handler.GetItemByLabel(t)));
                break;

            case AIDADataType.Power:
                Config.ConfigData.AIDAShownItems.AIDA64Data.Power.Clear();
                items.ForEach(t => Config.ConfigData.AIDAShownItems.AIDA64Data.Power.Add(AIDA64Handler.GetItemByLabel(t)));
                break;
            }
        }
Пример #2
0
        private void ButSave_Click(object sender, EventArgs e)
        {
            CheckedItemCollection checkedItems1 = HeadersCheckedListGroup1.CheckedItems;
            CheckedItemCollection checkedItems2 = HeadersCheckedListGroup2.CheckedItems;
            CheckedItemCollection checkedItems4 = HeadersCheckedListGroup4.CheckedItems;

            Settings.StartProtOptions.StartProtGroup1.ChoosedHeaders = saveStartProtHeaders(checkedItems1);
            Settings.StartProtOptions.StartProtGroup2.ChoosedHeaders = saveStartProtHeaders(checkedItems2);
            Settings.StartProtOptions.StartProtGroup4.ChoosedHeaders = saveStartProtHeaders(checkedItems4);

            Settings.StartProtOptions.save();

            this.Close();

            List <string> saveStartProtHeaders(CheckedItemCollection checkedItemCollection)
            {
                List <string> choosedHeaders = new List <string>();

                foreach (object item in checkedItemCollection)
                {
                    if (Settings.StartProtOptions.TryGetHeader((string)item, out Header header))
                    {
                        choosedHeaders.Add(header.ShortName);
                    }
                }

                return(choosedHeaders);
            }
        }
Пример #3
0
        /// <summary>
        /// PRE: la clase debe estar inicializada
        /// POST:Devuelve un presupuesto reyenandolo con los datos que hay en los textBox, sin comprobar que estos sean datos correctos.
        /// </summary>
        /// <returns></returns>
        internal Presupuesto devolverPresupuesto()
        //se usa cunado los formatos ya se saben que son correctos
        {
            Cliente c = LNCliente.LogicaNegocioCliente.Buscar(new Cliente(this.cCliente.SelectedItem.ToString()));

            DateTime fecha;

            DateTime.TryParse(this.tbFecha.Text, out fecha);

            CheckedItemCollection l         = this.clbVehiculos.CheckedItems;
            List <Vehiculo>       vehiculos = new List <Vehiculo>();

            foreach (String i in l)
            {
                string [] t = i.ToString().Split('-');

                Vehiculo v2 = new VehiculoNuevo(t[0]);
                v2 = LNVehiculo.LogicaNegocioVehiculo.buscar(v2);
                vehiculos.Add(v2);
            }

            Object   p = this.cVehiculoComprado.SelectedItem;
            Vehiculo v = null;

            if (p != null)
            {
                string[] r = this.cVehiculoComprado.SelectedItem.ToString().Split('-');
                v = new VehiculoNuevo(r[0]);
                v = LNVehiculo.LogicaNegocioVehiculo.buscar(v);
            }
            return(new Presupuesto(this.tbIdentificador.Text, c, fecha, this.tbEstado.Text, vehiculos, v));
        }
Пример #4
0
        private void agregarFuncionalidades(Rol rol)
        {
            CheckedItemCollection funcionalidades = chkListFuncionalidades.CheckedItems;

            foreach (Funcionalidad funcionalidad in funcionalidades)
            {
                rol.funcionalidades.Add(funcionalidad);
            }
        }
Пример #5
0
        public List <string> GetCheckedItems()
        {
            List <string>         checkedItem = new List <string>();
            CheckedItemCollection col         = clbScrape.CheckedItems;

            foreach (var item in col)
            {
                checkedItem.Add(item.ToString());
            }
            return(checkedItem);
        }
Пример #6
0
        public static string checkedListToStringFields(CheckedItemCollection cbx)
        {
            string             result = string.Empty;
            List <SchemaField> se     = cbx.Cast <SchemaField>().ToList();

            se.ForEach(s => {
                result += ("'" + s.name + "',");
            });
            //delete last coma
            return(result.Substring(0, result.Length - 1));
        }
Пример #7
0
        private void changeButton_Click(object sender, EventArgs e)
        {
            CheckedItemCollection col = checkedFilesBox.CheckedItems;

            numOfFilesToChange = col.Count;

            progressBar1.Value   = 0;
            progressBar1.Step    = 1;
            progressBar1.Maximum = numOfFilesToChange;

            toggleRunning(false);

            Task.Factory.StartNew(() => changeFiles(col));
            Task.Factory.StartNew(() => Loading(), cancellationToken.Token);
            checkedFilesBox.Refresh();
        }
Пример #8
0
        internal static List <ActivatedFeature> SelectedRowsToActivatedFeature(CheckedItemCollection selectedRows)
        {
            if (selectedRows == null || selectedRows.Count == 1)
            {
                Log.Warning("No activated features selected!");
                return(null);
            }

            var convertedRows = new List <ActivatedFeature>();

            foreach (DataGridViewRow row in selectedRows)
            {
                ActivatedFeature fd = row.DataBoundItem as ActivatedFeature;
                convertedRows.Add(fd);
            }

            return(convertedRows);
        }
Пример #9
0
        public int[] getResult()
        {
            CheckedItemCollection operations = getCheckedOperation();

            int[] numbers = getNumbers(),
            rez = new int[operations.Count];
            int i = 0;

            if (operations.Contains("Summ"))
            {
                rez[i++] = numbers.Sum();
            }
            if (operations.Contains("Least multiple"))
            {
                rez[i++] = mlc(numbers[0], numbers[1]);
            }

            return(rez);
        }
Пример #10
0
        public FastFunctionExtraction() : base()
        {
            var items = new CheckedItemCollection <EnumValue <OpCode> >();

            foreach (var op in nonlinFuncs)
            {
                items.Add(new EnumValue <OpCode>(op));
            }
            base.Problem = new RegressionProblem();
            Parameters.Add(new ValueParameter <BoolValue>(ConsiderInteractionsParameterName, "True if you want the models to include interactions, otherwise false.", new BoolValue(true)));
            Parameters.Add(new ValueParameter <BoolValue>(ConsiderDenominationParameterName, "True if you want the models to include denominations, otherwise false.", new BoolValue(true)));
            Parameters.Add(new ValueParameter <BoolValue>(ConsiderExponentiationParameterName, "True if you want the models to include exponentiation, otherwise false.", new BoolValue(true)));
            Parameters.Add(new ValueParameter <BoolValue>(ConsiderNonlinearFuncsParameterName, "True if you want the models to include nonlinear functions(abs, log,...), otherwise false.", new BoolValue(true)));
            Parameters.Add(new ValueParameter <BoolValue>(ConsiderHingeFuncsParameterName, "True if you want the models to include Hinge Functions, otherwise false.", new BoolValue(false)));
            Parameters.Add(new FixedValueParameter <DoubleValue>(PenaltyParameterName, "Penalty factor (alpha) for balancing between ridge (0.0) and lasso (1.0) regression", new DoubleValue(0.9)));
            Parameters.Add(new OptionalValueParameter <DoubleValue>(LambdaParameterName, "Optional: the value of lambda for which to calculate an elastic-net solution. lambda == null => calculate the whole path of all lambdas"));
            Parameters.Add(new ValueParameter <CheckedItemCollection <EnumValue <OpCode> > >(NonlinearFuncsParameterName, "What nonlinear functions the models should be able to include.", items));
            Parameters.Add(new ValueParameter <BoolValue>(VerboseParameterName, "Verbose", new BoolValue(true)));
            Parameters.Add(new ValueParameter <StringValue>(FilePathParameterName, "The path where you want the program to write the results. If left empty, the result doesn't get written anywhere.", new StringValue(@"")));
        }
Пример #11
0
        public void changeFiles(CheckedItemCollection col)
        {
            try
            {
                foreach (string fileFromList in col)
                {
                    for (int i = 0; i < filesAndPaths.Count; i++)
                    {
                        if (fileFromList.Equals(filesAndPaths[i]))
                        {
                            numOfFilesChanged++;
                            System.IO.File.Copy(originalFile.FullName, filesAndPaths[i], true);
                            filesThatWereChanged.Add(fileFromList);
                        }
                    }
                    this.Invoke((MethodInvoker) delegate
                    {
                        progressBar1.PerformStep();
                    });
                }
                cancellationToken.Cancel();

                MessageBox.Show($"{numOfFilesChanged} were changed");
                this.Invoke((MethodInvoker) delegate
                {
                    foreach (string fileFromList in filesThatWereChanged)
                    {
                        checkedFilesBox.Items.Remove(fileFromList);
                    }
                    label2.Text = "Done";
                    toggleRunning(true);
                    checkedFilesBox.Refresh();
                });
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                toggleRunning(true);
            }
        }
        public bool AddOrEditAnAuthor(string firstName, string lastName, CheckedItemCollection booksByAuthor, int?authorId)
        {
            firstName = firstName.FirstLettersToUpper(true);
            lastName  = lastName.FirstLettersToUpper(true);

            if (firstName == "" || lastName == "" || firstName == "Error" || lastName == "Error")
            {
                return(false);
            }

            var booksCollection = new List <Book>();

            foreach (var book in booksByAuthor)
            {
                booksCollection.AddRange(_context.Books.Where(contextBook => contextBook.Name.Equals(book)));
            }

            if (booksCollection.Count == 0)
            {
                return(false);
            }

            if (authorId == null)
            {
                _context.Add(new Author {
                    FirstName = firstName, LastName = lastName, BooksByAuthor = booksCollection
                });
                _context.SaveChanges();

                return(true);
            }

            _context.Authors.Find(authorId).FirstName     = firstName;
            _context.Authors.Find(authorId).LastName      = lastName;
            _context.Authors.Find(authorId).BooksByAuthor = booksCollection;
            _context.SaveChanges();

            return(true);
        }
Пример #13
0
        private void AfterDeserialization()
        {
            // BackwardsCompatibility3.3
            #region Backwards compatible code, remove with 3.4
#pragma warning disable 0612
            if (converters != null)
            {
                if (convertersList == null)
                {
                    convertersList = new CheckedItemList <IItemToSolutionMessageConverter>();
                }
                foreach (IItemToSolutionMessageConverter c in converters)
                {
                    convertersList.Add(c);
                }
                converters.Clear();
                converters = null;
            }
#pragma warning restore 0612
            #endregion
            RegisterEventHandlers();
        }
Пример #14
0
        public MosaicData(CheckedItemCollection names,
                          Dictionary <string, string> nameToPath, Size size, Bitmap bmp)
        {
            if (names == null)
            {
                throw new ArgumentNullException("names");
            }

            if (nameToPath == null)
            {
                throw new ArgumentNullException("nameToPath");
            }

            ElementSize = size;
            LoadedImage = bmp;

            Paths = new List <string>(names.Count);

            foreach (var n in names)
            {
                Paths.Add(nameToPath[(string)n]);
            }
        }
Пример #15
0
        /// <summary>
        /// Action to take when "Button1" is clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button1_Click(object sender, EventArgs e)
        {
            CheckedItemCollection checkedPlayer = checkedListBox.CheckedItems;

            if (checkedPlayer.Count != 3)
            {
                MessageBox.Show("Select 3 pokemon!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (_choose.PokemonPlayer1.Count == 0)
            {
                // Select pokemon player 1.
                foreach (string pName in checkedPlayer)
                {
                    _choose.PokemonPlayer1.Add((Pokemon)_choose.PokemonList.Where(p => p.Name == pName).FirstOrDefault().Clone());
                }

                labelPlayer.Text = "Player2";
                buttonStart.Text = "Start game";

                // Clear selected.
                for (int i = 0; i < checkedListBox.Items.Count; i++)
                {
                    checkedListBox.SetItemCheckState(i, CheckState.Unchecked);
                }
            }
            else
            {
                // Select pokemon player 2.
                foreach (string pName in checkedPlayer)
                {
                    _choose.PokemonPlayer2.Add((Pokemon)_choose.PokemonList.Where(p => p.Name == pName).FirstOrDefault().Clone());
                }

                _choose.Start();
                this.Hide();
            }
        }
        private void kontenjan_degistir(object sender, EventArgs e)
        {
            // isaretli sınıfların bulunması
            CheckedItemCollection isaretliler = siniflar_listbox.CheckedItems;

            // seçilen sınıfıların kontenjanları toplamının bulunması için değişkenin atanması
            kontenjan = 0;
            // seçilen sınıflar için dersliklerin sayıları
            derslikler = "";
            // seçilen sınıfların kontenjanlarının tutulması için integer dizinin tanımlanması
            sinif_kontenjanlar = new int[isaretliler.Count];

            for (int i = 0; i < isaretliler.Count; i++)
            {
                // işaretlenmiş dersliklerin ayrıştırılması
                string[] derslik = isaretliler[i].ToString().Split(',');
                // derslik numaralarının string olarak birleştirilmesi
                derslikler += derslik[0] + "\n";
                // derslik kontenjanının diziye atanması
                sinif_kontenjanlar[i] = Convert.ToInt32(derslik[1].Substring(0, derslik[1].IndexOf(' ')));
                // seçilen kontenjanların toplanması
                kontenjan += Convert.ToInt32(derslik[1].Substring(0, derslik[1].IndexOf(' ')));
            }
            // seçilmiş dersliklerin diziye dönüştürülmesi
            siniflar = derslikler.Split('\n');
            // Toplam kontenjan sayısının kullanıcıya bildirilmesi
            secilen_kontenjan.Text = "Seçilen Kontenjan:" + kontenjan;
            // Kontenjan Öğrenci sayısından az ise dağıtma butonunun kapatılması
            if (kontenjan < ogrenci_sayisi)
            {
                dagit_buton.Enabled = false;
            }
            else
            {
                dagit_buton.Enabled = true;
            }
        }
Пример #17
0
 internal static List <Player> ToPlayerList(this CheckedItemCollection checkedItems)
 {
     return(checkedItems.OfType <Player>().ToList());
 }
Пример #18
0
 public FilterContent(IFilteredPreprocessingData preprocessingData)
     : base(preprocessingData)
 {
     Filters          = new CheckedItemCollection <IFilter>();
     IsAndCombination = true;
 }
Пример #19
0
        public static void StartQuiz(MainForm q)
        {
            ControlTimeDiff         = q.setTimeDiff;
            ControlIncrement        = q.setIncTFCAns;
            ControlTimeDiffDesc     = q.lblTimeDiffDesc;
            ControlEnabledQuestions = q.setQuestionsOn;
            ControlFileBrowse       = q.setFile;
            ControlFileName         = q.lblQFileName;
            ControlStartButton      = q.btnStart;
            Status = q.status;

            TimeDiff         = ControlTimeDiff.Text;
            SelectedTimeDiff = q.setTimeDiffVal;
            IncTFCAns        = ControlIncrement.Checked;
            EnabledQuestions = ControlEnabledQuestions.CheckedItems;

            bool   TimerOn   = true;
            bool   Countdown = true;
            bool   Decrement = false;
            double Length    = 0;
            int    Type      = 0;

            bool go = true;

            if (TimeDiff == "" || EnabledQuestions.Count == 0 || q.QuizFile == String.Empty || q.QuizPath == String.Empty)
            {
                Status.Text = "Quiz settings are not complete.";
                go          = false;
            }

            if (EnabledQuestions.Cast <string>().ToList().Count == 0)
            {
                Status.Text = "Select at least one difficulty level.";
                go          = false;
            }

            List <String> Enabled = EnabledQuestions.Cast <string>().ToList();

            switch (TimeDiff)
            {
            case ("Untimed Practice"):
                TimerOn = false;
                break;

            case ("Timed Practice"):
                TimerOn   = true;
                Countdown = false;
                break;

            case ("Easy"):
                TimerOn   = true;
                Countdown = true;
                Length    = 5;
                break;

            case ("Moderate"):
                TimerOn   = true;
                Countdown = true;
                Length    = 3;
                break;

            case ("Difficult"):
                TimerOn   = true;
                Countdown = true;
                Length    = 1;
                break;

            case ("Extreme"):
                TimerOn   = true;
                Countdown = true;
                Length    = 0.5;
                break;

            case ("Custom"):
                if (go)
                {
                    CustomTimeDifficultyCreator ctdc = new CustomTimeDifficultyCreator();
                    if (ctdc.ShowDialog() == DialogResult.OK)
                    {
                        TimerOn = ctdc.timerShow.Checked;
                        if (TimerOn)
                        {
                            if (ctdc.timerCountMode.Checked && !ctdc.timerStopMode.Checked)
                            {
                                Countdown = true;
                                Length    = Decimal.ToInt64(ctdc.timerDuration.Value);
                            }
                            else if (!ctdc.timerCountMode.Checked && ctdc.timerStopMode.Checked)
                            {
                                Countdown = false;
                            }
                            else
                            {
                                Status.Text = "Invalid Custom Time Difficulty Timer Mode.";
                                go          = false;
                            }
                        }
                    }
                    else
                    {
                        Status.Text = "Custom Time Difficulty canceled.";
                        go          = false;
                    }
                }
                break;

            default:
                break;
            }
            if (go)
            {
                Status.Text = "Starting quiz.";
                Lock(q);
                QuizBox qb = new QuizBox();
                Status.Text = "Quiz started...";
                qb.RunQuiz(q.QuizPath, q.QuizFile, TimerOn, Countdown, Length, qb.timer, Enabled);
                Unlock(q);
            }
        }
Пример #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            string conditions = "";

            bool where = false;

            string     filtroNome    = "";
            int        filtroDev     = -1;
            int        filtroDisp    = -1;
            int        filtroEstoque = -1;
            double     filtroPreco   = -1;
            List <int> checkedList   = new List <int>();

            if (txtNomeFiltro.Text.Length > 0)
            {
                filtroNome  = txtNomeFiltro.Text;
                conditions += " p.nome LIKE @nome AND ";
                where       = true;
            }

            if (cmbDevFiltro.SelectedItem != null)
            {
                var item = cmbDevFiltro.SelectedItem as Desenvolvedor;
                filtroDev   = item.codigo;
                conditions += " p.codigo_desenvolvedor = @cod_dev AND ";
                where       = true;
            }

            if (cmbDispFiltro.SelectedItem != null)
            {
                var item = cmbDispFiltro.SelectedItem as Disponibilidade;
                filtroDisp  = item.codigo;
                conditions += " p.codigo_disponibilidade = @cod_disp AND ";
                where       = true;
            }

            if (txtEstoqueFiltro.Text.Length > 0 && Convert.ToInt32(txtEstoqueFiltro.Text) >= 0)
            {
                filtroEstoque = Convert.ToInt32(txtEstoqueFiltro.Text);
                conditions   += " p.estoque = @estoque AND ";
                where         = true;
            }

            if (txtPrecoFiltro.Text.Length > 0 && Convert.ToDouble(txtPrecoFiltro.Text) >= 0)
            {
                filtroPreco = Convert.ToDouble(txtPrecoFiltro.Text);
                conditions += " p.preco = @preco AND ";
                where       = true;
            }

            if (checkListGenFiltro.CheckedItems.Count > 0)
            {
                CheckedItemCollection checkedItems = checkListGenFiltro.CheckedItems;
                foreach (Genero item in checkedItems)
                {
                    int codigo = item.codigo;
                    checkedList.Add(codigo);
                }
                conditions += " p.codigo IN (SELECT pg.codigo_produto FROM tb_produtos_generos AS pg WHERE pg.codigo_genero IN (@generos_list)) AND ";
            }

            conditions = conditions.Trim();
            // Remove último 'AND' da string
            string[] tmp = conditions.Split(' ');
            conditions = String.Join(" ", tmp.Take(tmp.Length - 1).ToArray());


            string sqlFiltro = "SELECT * FROM tb_produtos AS p ";

            if (where)
            {
                sqlFiltro += " WHERE ";
                sqlFiltro += conditions;
            }

            SqlCommand commandFiltro = new SqlCommand(sqlFiltro, conn);

            if (filtroNome != "")
            {
                commandFiltro.Parameters.AddWithValue("@nome", filtroNome + "%");
            }
            if (filtroDev != -1)
            {
                commandFiltro.Parameters.AddWithValue("@cod_dev", filtroDev);
            }
            if (filtroDisp != -1)
            {
                commandFiltro.Parameters.AddWithValue("@cod_disp", filtroDisp);
            }
            if (filtroEstoque != -1)
            {
                commandFiltro.Parameters.AddWithValue("@estoque", filtroEstoque);
            }
            if (filtroPreco != -1)
            {
                commandFiltro.Parameters.AddWithValue("@preco", filtroPreco);
            }
            if (checkedList.Count > 0)
            {
                commandFiltro.Parameters.AddWithValue("@generos_list", String.Join(", ", checkedList.ToArray()));
            }

            try {
                SqlDataReader filtroReader = commandFiltro.ExecuteReader();

                if (filtroReader.HasRows)
                {
                    listProdutos.Items.Clear();

                    while (filtroReader.Read())
                    {
                        string codigo  = filtroReader.GetInt32(0).ToString();
                        string nome    = filtroReader.GetString(3);
                        string dev     = Desenvolvedor.getNameById(filtroReader.GetInt32(1), conn);
                        string disp    = Disponibilidade.getNameById(filtroReader.GetInt32(2), conn);
                        string estoque = filtroReader.GetInt32(4).ToString();
                        string preco   = "R$ " + filtroReader.GetDecimal(5).ToString("#.##");

                        string[]     row  = { codigo, nome, dev, disp, estoque, preco };
                        ListViewItem item = new ListViewItem(row);
                        listProdutos.Items.Add(item);
                    }
                }
                else
                {
                    listProdutos.Items.Clear();
                }
            } catch (SqlException ex) {
                Console.WriteLine(ex.StackTrace);
            }
        }
Пример #21
0
 public CheckedListBox()
 {
     checked_indices = new CheckedIndexCollection(this);
     checked_items   = new CheckedItemCollection(this);
     SetStyle(ControlStyles.ResizeRedraw, true);
 }
Пример #22
0
        public SQLiteDataReader QueryDatabase(string query, List <string> parameters, CheckedItemCollection parameterValues)
        {
            SQLiteDataReader resultQuery;

            if (parameters == null && parameterValues == null)
            {
                command.CommandText = query;
                resultQuery         = command.ExecuteReader();
                return(resultQuery);
            }
            else
            {
                command.CommandText = query;
                command.Prepare();
                for (int i = 0; i < parameters.Count; i++)
                {
                    command.Parameters.AddWithValue("@Extension" + i, parameterValues[i]);
                }

                resultQuery = command.ExecuteReader();
                return(resultQuery);
            }
        }
    private void AfterDeserialization() {
      // BackwardsCompatibility3.3
      #region Backwards compatible code, remove with 3.4
#pragma warning disable 0612
      if (converters != null) {
        if (convertersList == null) convertersList = new CheckedItemList<IItemToSolutionMessageConverter>();
        foreach (IItemToSolutionMessageConverter c in converters)
          convertersList.Add(c);
        converters.Clear();
        converters = null;
      }
#pragma warning restore 0612
      #endregion
      RegisterEventHandlers();
    }
Пример #24
-1
		public CheckedListBox ()
		{
			checked_indices = new CheckedIndexCollection (this);
			checked_items = new CheckedItemCollection (this);
			SetStyle (ControlStyles.ResizeRedraw, true);
		}
        /// <summary>
        /// Initialize a new instance of the KryptonCheckedListBox class.
        /// </summary>
        public KryptonCheckedListBox()
        {
            // Contains another control and needs marking as such for validation to work
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select this control, only the child CheckedListBox and does not generate a click event
            SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false);

            // Default fields
            _alwaysActive = true;
            _style = ButtonStyle.ListItem;
            _lastSelectedIndex = -1;
            base.Padding = new Padding(1);

            // Create the palette storage
            _images = new CheckBoxImages(NeedPaintDelegate);
            _paletteCheckBoxImages = new PaletteRedirectCheckBox(Redirector, _images);
            _stateCommon = new PaletteListStateRedirect(Redirector, PaletteBackStyle.InputControlStandalone, PaletteBorderStyle.InputControlStandalone, NeedPaintDelegate);
            _stateFocus = new PaletteListItemTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate);
            _stateDisabled = new PaletteListState(_stateCommon, NeedPaintDelegate);
            _stateActive = new PaletteDouble(_stateCommon, NeedPaintDelegate);
            _stateNormal = new PaletteListState(_stateCommon, NeedPaintDelegate);
            _stateTracking = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _statePressed = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _stateCheckedNormal = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _stateCheckedTracking = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _stateCheckedPressed = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);

            // Create the override handling classes
            _overrideNormal = new PaletteTripleOverride(_stateFocus.Item, _stateNormal.Item, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus.Item, _stateTracking.Item, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus.Item, _statePressed.Item, PaletteState.FocusOverride);
            _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedNormal.Item, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedTracking.Item, PaletteState.FocusOverride);
            _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedPressed.Item, PaletteState.FocusOverride);

            // Create the check box image drawer and place inside element so it is always centered
            _drawCheckBox = new ViewDrawCheckBox(_paletteCheckBoxImages);
            _layoutCenter = new ViewLayoutCenter();
            _layoutCenter.Add(_drawCheckBox);

            // Create the draw element for owner drawing individual items
            _contentValues = new FixedContentValue();
            _drawButton = new ViewDrawButton(StateDisabled.Item, _overrideNormal,
                                             _overrideTracking, _overridePressed,
                                             _overrideCheckedNormal, _overrideCheckedTracking,
                                             _overrideCheckedPressed,
                                             new PaletteMetricRedirect(Redirector),
                                             _contentValues, VisualOrientation.Top, false);

            // Place check box on the left and the label in the remainder
            _layoutDocker = new ViewLayoutDocker();
            _layoutDocker.Add(new ViewLayoutSeparator(1), ViewDockStyle.Left);
            _layoutDocker.Add(_layoutCenter, ViewDockStyle.Left);
            _layoutDocker.Add(new ViewLayoutSeparator(2), ViewDockStyle.Left);
            _layoutDocker.Add(_drawButton, ViewDockStyle.Fill);

            // Create the internal list box used for containing content
            _listBox = new InternalCheckedListBox(this);
            _listBox.DrawItem += new DrawItemEventHandler(OnListBoxDrawItem);
            _listBox.MeasureItem += new MeasureItemEventHandler(OnListBoxMeasureItem);
            _listBox.TrackMouseEnter += new EventHandler(OnListBoxMouseChange);
            _listBox.TrackMouseLeave += new EventHandler(OnListBoxMouseChange);
            _listBox.SelectedIndexChanged += new EventHandler(OnListBoxSelectedIndexChanged);
            _listBox.SelectedValueChanged += new EventHandler(OnListBoxSelectedValueChanged);
            _listBox.Format += new ListControlConvertEventHandler(OnListBoxFormat);
            _listBox.FormatInfoChanged += new EventHandler(OnListBoxFormatInfoChanged);
            _listBox.FormatStringChanged += new EventHandler(OnListBoxFormatStringChanged);
            _listBox.FormattingEnabledChanged += new EventHandler(OnListBoxFormattingEnabledChanged);
            _listBox.GotFocus += new EventHandler(OnListBoxGotFocus);
            _listBox.LostFocus += new EventHandler(OnListBoxLostFocus);
            _listBox.KeyDown += new KeyEventHandler(OnListBoxKeyDown);
            _listBox.KeyUp += new KeyEventHandler(OnListBoxKeyUp);
            _listBox.KeyPress += new KeyPressEventHandler(OnListBoxKeyPress);
            _listBox.PreviewKeyDown += new PreviewKeyDownEventHandler(OnListBoxPreviewKeyDown);
            _listBox.Validating += new CancelEventHandler(OnListBoxValidating);
            _listBox.Validated += new EventHandler(OnListBoxValidated);

            // Create extra collections for storing checked state and checked items
            _checkedItems = new CheckedItemCollection(this);
            _checkedIndices = new CheckedIndexCollection(this);

            // Create the element that fills the remainder space and remembers fill rectange
            _layoutFill = new ViewLayoutFill(_listBox);
            _layoutFill.DisplayPadding = new Padding(1);

            // Create inner view for placing inside the drawing docker
            _drawDockerInner = new ViewLayoutDocker();
            _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill);

            // Create view for the control border and background
            _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border);
            _drawDockerOuter.Add(_drawDockerInner, ViewDockStyle.Fill);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawDockerOuter);

            // We need to create and cache a device context compatible with the display
            _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);

            // Add text box to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(_listBox);
        }