private void ColorPickerPanel_ColorChanged(object sender, EventArgs e) { ColorPickerPanel picker = (ColorPickerPanel)sender; Rectangle r = (Rectangle)ColorDropDown.Content; Color color = picker.Color; SolidColorBrush brush = new SolidColorBrush(color); r.Fill = brush; }
void Update() { brushColor = ColorPickerPanel.GetCurrentColor(); //Updates our painted color with the selected color if (Input.GetMouseButton(0)) { DoAction(); } UpdateBrushCursor(); }
private void InitializeComponent() { this.ColorPick = new ColorPickerPanel(); base.SuspendLayout(); this.ColorPick.Dock = DockStyle.Fill; this.ColorPick.Location = new Point(0, 0); this.ColorPick.Name = "ColorPick"; this.ColorPick.SelectedColor = Color.Empty; this.ColorPick.Size = new Size(202, 250); this.ColorPick.TabIndex = 0; this.ColorPick.VIBlendTheme = VIBLEND_THEME.VISTABLUE; this.ColorPick.SelectedColorChanged += new EventHandler(this.ColorPick_SelectedColorChanged); base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(202, 247); base.Controls.Add(this.ColorPick); base.FormBorderStyle = FormBorderStyle.FixedToolWindow; base.Name = "BGColor"; base.StartPosition = FormStartPosition.CenterScreen; this.Text = "Background Color"; base.Load += new EventHandler(this.BGColor_Load); base.ResumeLayout(false); }
protected void Page_Load(object sender, EventArgs e) { string db = ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString; //set the user if (this.Session["user"] != null) { this.user = this.Session["user"] as UserProfile; } else { this.GetUser(db); } if (Request.QueryString["lid"] != null) { long lookId = long.Parse(Request.QueryString["lid"]); initialLook = Look.GetLookById(lookId, this.user.userId, db); this.contestId = initialLook.contestId; this.Session["contest"] = this.contestId; this.OriginalLook.Text = lookId.ToString(); } if (Request.QueryString["contestid"] != null) { this.contestId = int.Parse(Request.QueryString["contestid"]); this.Session["contest"] = this.contestId; } else if (this.Session["contest"] == null || (int)this.Session["contest"] == 0) { this.contestId = int.Parse(ConfigurationManager.AppSettings["ContestId1"]); this.Session["contest"] = this.contestId; } else { this.contestId = (int)this.Session["contest"]; } Master.Page.Title = "FashionKred - Create outfit from your favorites"; //set the subtext //Label subText = (Label)this.Master.FindControl("Subtext"); //subText.Text = "CREATE AN OUTFIT TO WIN $50 MACY'S GIFT CARD"; System.Web.UI.WebControls.Image userImage = (System.Web.UI.WebControls.Image) this.Master.FindControl("UserImage"); userImage.ImageUrl = user.pic; HyperLink userName = (HyperLink)this.Master.FindControl("UserName"); userName.Text = user.name; userName.NavigateUrl = "user.aspx?uid=" + user.userId; Label userPoints = (Label)this.Master.FindControl("UserPoints"); userPoints.Text = user.points.ToString() + " votes"; this.userId = user.userId; UserId.Text = this.userId.ToString(); UserShare.Text = this.user.IsPrivate ? "0" : "1"; //Set the cover product - TOO - right now the first product is always cover product CoverPdt.Text = "0"; //Get favorites for the specified categories Dictionary <string, IList <Product> > favorites = UserProfile.GetLovesByContest(userId, contestId, db); int position = 1; foreach (KeyValuePair <string, IList <Product> > favorite in favorites) { Product pdt = new Product(); if (initialLook != null) { pdt = initialLook.products[position - 1]; } string carouselClass = "carousel-favorites", prevCarouselClass = "prev-carousel", nextCarouselClass = "next-carousel", itemCssClass = "fav-image", sliderId = "sliderCreate"; if (position > 1) { carouselClass += ("_" + position); prevCarouselClass += ("_" + position); nextCarouselClass += ("_" + position); itemCssClass += ("_" + position); sliderId += position; } Panel favCaptionCarousel = new Panel(); favCaptionCarousel.CssClass = "caption-carousel"; string[] captions = favorite.Key.Split(','); switch (position) { case 1: P1Cat.Text = captions[0]; P1Id.Text = pdt.id.ToString(); break; case 2: P2Cat.Text = captions[0]; P2Id.Text = pdt.id.ToString(); break; case 3: P3Cat.Text = captions[0]; P3Id.Text = pdt.id.ToString(); break; } foreach (string caption in captions) { HyperLink cat = new HyperLink(); cat.CssClass = "caption-link"; CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture; TextInfo textInfo = cultureInfo.TextInfo; cat.Text = textInfo.ToTitleCase(caption); cat.NavigateUrl = "javascript:GetProductsByCategory(" + this.userId + "," + contestId + "," + position + ",'" + caption + "');"; favCaptionCarousel.Controls.Add(cat); } Favorites.Controls.Add(favCaptionCarousel); Panel colorPicker = new ColorPickerPanel(user.userId, this.contestId, position); Favorites.Controls.Add(colorPicker); Panel favPanel = new Panel(); favPanel.CssClass = "carousel"; favPanel.Controls.Add(new Literal() { Text = "<div class=\"" + prevCarouselClass + "\"><img src=\"images/carousel_left.png\" alt=\"Previous\"></div>" + "<div class=\"" + nextCarouselClass + "\"><img src=\"images/carousel_right.png\" alt=\"Next\"></div>" }); Panel favCarousel = new Panel(); favCarousel.CssClass = carouselClass; favPanel.Controls.Add(favCarousel); int carouselPosition = 1; //Add the item to the top slider HtmlGenericControl slider = (HtmlGenericControl)Page.Master.FindControl("MainContent").FindControl(sliderId); if (pdt.id != 0) { CreateSliderAndFav(pdt, position, itemCssClass, carouselPosition, ref favCarousel, ref slider, sliderId); slider.Style.Add("left", position == 1 ? "-336px" : "-175px"); carouselPosition++; } foreach (ShopSenseDemo.Product love in favorite.Value) { if (pdt != null && pdt.id == love.id) { continue; } CreateSliderAndFav(love, position, itemCssClass, carouselPosition, ref favCarousel, ref slider, sliderId); carouselPosition++; } position++; Favorites.Controls.Add(favPanel); } Favorites.Controls.Add(new Literal() { Text = "<br/><br/><hr/>" }); }