// i = 49 ou 50 //Loohy public BoutonDeroulant(Rectangle rect_, int indexDico_) : base(rect_, new Rectangle(42,7,42,7)) { state = e_etatDeroulant.Ferme; tstate = e_pinceau.Plaine; tsize = e_toolSize.Standard; hauteur = 0; indexDico = indexDico_; }
//Loohy public override void Draw() { switch (state) { #region Ouvert case e_etatDeroulant.Ouvert: Contents.Draw("px", new Rectangle(rect.X, rect.Y + rect.Height, rect.Width, hauteur), Color.DarkRed); Rectangle rect2 = new Rectangle(rect.X, rect.Y + rect.Height, 110, (int)(Contents.MeasureString("S").Y + 2)); //hauteur = (int)(font.MeasureString("S").Y + 2) * 15; Color c = Color.Red; #region Type if (indexDico == 49)// { e_pinceau tableau = e_pinceau.Plaine; while (tableau != e_pinceau.Rien) { Contents.DrawString(Dico.langues[Dico.current][ToolText(tableau)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Contents.contientLaSouris(rect2)) { Contents.Draw("px", rect2, c); Contents.DrawString(Dico.langues[Dico.current][ToolText(tableau)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Mouse.GetState().LeftButton == ButtonState.Pressed) { tstate = tableau; //logBox_.ToLogBox("La brosse actuelle est : " + tstate.ToString()); state = e_etatDeroulant.Montant; } } rect2.Y += (int)(Contents.MeasureString("S").Y + 2); tableau++; } Contents.DrawString(Dico.langues[Dico.current][ToolText(tableau)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Contents.contientLaSouris(rect2)) { Contents.Draw("px", rect2, c); Contents.DrawString(Dico.langues[Dico.current][ToolText(tableau)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Mouse.GetState().LeftButton == ButtonState.Pressed) { tstate = tableau; //logBox_.ToLogBox("La brosse actuelle est : " + tstate.ToString()); state = e_etatDeroulant.Montant; } } } #endregion #region Size else if (indexDico == 50)// { e_toolSize tableur = e_toolSize.XSmall; while (tableur != e_toolSize.XLarge) { Contents.DrawString(Dico.langues[Dico.current][SizeText(tableur)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Contents.contientLaSouris(rect2)) { Contents.Draw("px", rect2, c); Contents.DrawString(Dico.langues[Dico.current][SizeText(tableur)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Mouse.GetState().LeftButton == ButtonState.Pressed) { tsize = tableur; //logBox_.ToLogBox("La taille de la brosse est : " + SizeText(tableur)); state = e_etatDeroulant.Montant; } } rect2.Y += (int)(Contents.MeasureString("S").Y + 2); tableur++; } Contents.DrawString(Dico.langues[Dico.current][SizeText(tableur)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Contents.contientLaSouris(rect2)) { Contents.Draw("px", rect2, c); Contents.DrawString(Dico.langues[Dico.current][SizeText(tableur)], new Rectangle(rect2.X, rect2.Y, 0, 0)); if (Mouse.GetState().LeftButton == ButtonState.Pressed) { tsize = tableur; //logBox_.ToLogBox("La taille de la brosse est : " + SizeText(tableur)); state = e_etatDeroulant.Montant; } } #endregion } goto default; #endregion #region Montant/Descendant case e_etatDeroulant.Montant: case e_etatDeroulant.Descendant: Contents.Draw("px", new Rectangle(rect.X, rect.Y + rect.Height, rect.Width, hauteur), Color.DarkRed); goto default; #endregion #region Bouton default: int s; if (indexDico == 49) { s = ToolText(tstate); } else { s = SizeText(tsize); } if (!Contents.contientLaSouris(base.rect)) { Contents.Draw("px", rect, Color.Gray); Contents.DrawStringInBoxCentered(Dico.langues[Dico.current][indexDico] + " : " + Dico.langues[Dico.current][s], rect, Color.Black); } else { Contents.Draw("px", rect, Color.DarkRed); Contents.DrawStringInBoxCentered(Dico.langues[Dico.current][indexDico] + " : " + Dico.langues[Dico.current][s], rect); } break; #endregion } }
//Loohy public void UpdateDeroulantNicoTuFaitPasChier(ref e_toolSize tsize_, ref e_pinceau tstate_) { switch (state) { case e_etatDeroulant.Ouvert: if (Contents.contientLaSouris(base.rect) && Mouse.GetState().LeftButton == ButtonState.Pressed) { state = e_etatDeroulant.Montant; } break; case e_etatDeroulant.Montant: hauteur -= 10; if (hauteur < 0) { hauteur = 0; state = e_etatDeroulant.Ferme; } break; case e_etatDeroulant.Descendant: hauteur += 10; if (indexDico == 49) { if (hauteur > Contents.MeasureString("S").Y * 16) { hauteur = (int)(Contents.MeasureString("S").Y + 2) * 16; state = e_etatDeroulant.Ouvert; } } else { if (hauteur > Contents.MeasureString("S").Y * 6) { hauteur = (int)(Contents.MeasureString("S").Y + 2) * 6; state = e_etatDeroulant.Ouvert; } } break; default: if (Contents.contientLaSouris(base.rect) && Mouse.GetState().LeftButton == ButtonState.Pressed) { state = e_etatDeroulant.Descendant; } break; } if (indexDico == 49) { tstate_ = tstate; } else { tsize_ = tsize; } }