public Form1() { var favouriteColorControl = new FavouriteColorControl(r, g, b); InitializeComponent(); favourites = new List <FavouriteColorControl>(); lastColorsList = new List <PictureBox>(); listadocelowa = new List <FavouriteColor>(); #region EventsInit sliderRed.ValueChanged += SliderRed_ValueChanged; sliderGreen.ValueChanged += SliderGreen_ValueChanged; sliderBlue.ValueChanged += SliderBlue_ValueChanged; buttonRandom.Click += ButtonRandom_Click; buttonSave.Click += AddToFavourites; buttonExport.Click += SaveToolStripButton_Click; saveToolStripButton.Click += SaveToolStripButton_Click; saveFileDialog.FileOk += SaveFileDialog_FileOk; favouriteToolStripButton.Click += AddToFavourites; buttonClear.Click += ButtonClear_Click; #endregion EventsInit Refresh(); }
private void AddToFavourites(object sender, EventArgs e) { var positionMultiplier = favourites.Count() != 0 ? favourites.Count() : 1; var favouriteColorControl = new FavouriteColorControl(r, g, b); var favor = new FavouriteColor(); favouriteColorControl.Disposed += FavouriteColorControl_Deleted; favouriteColorControl.Click += LoadColorFromFavourites; favouriteColorControl.Location = new Point(0, (favouriteColorControl.Height + 10) * positionMultiplier); favouriteColorControl.FavouriteClick += LoadColorFromFavourites; favourites.Add(favouriteColorControl); favouriteListPanel.Controls.Add(favouriteColorControl); listadocelowa.Add(favor); RefreshFavourites(); }