pouvoir faire de la multi-sélection (key.control) et pouvoir grouper/dégrouper les contrôles sélectionnés
c'est toujours toi qui me répondspour les questions C#, malheureusement la communauté n'est plus ce qu'elle était.....
private void DrawControlBorder(object sender) { Control control = (Control)sender; //define the border to be drawn, it will be offset by DRAG_HANDLE_SIZE / 2 //around the control, so when the drag handles are drawn they will be seem //connected in the middle. Rectangle Border = new Rectangle( new Point(control.Location.X - DRAG_HANDLE_SIZE / 2, control.Location.Y - DRAG_HANDLE_SIZE / 2), new Size(control.Size.Width + DRAG_HANDLE_SIZE, control.Size.Height + DRAG_HANDLE_SIZE)); //define the 8 drag handles, that has the size of DRAG_HANDLE_SIZE Rectangle NW = new Rectangle( new Point(control.Location.X - DRAG_HANDLE_SIZE, control.Location.Y - DRAG_HANDLE_SIZE), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); Rectangle N = new Rectangle( new Point(control.Location.X + control.Width / 2 - DRAG_HANDLE_SIZE / 2, control.Location.Y - DRAG_HANDLE_SIZE), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); Rectangle NE = new Rectangle( new Point(control.Location.X + control.Width, control.Location.Y - DRAG_HANDLE_SIZE), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); Rectangle W = new Rectangle( new Point(control.Location.X - DRAG_HANDLE_SIZE, control.Location.Y + control.Height / 2 - DRAG_HANDLE_SIZE / 2), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); Rectangle E = new Rectangle( new Point(control.Location.X + control.Width, control.Location.Y + control.Height / 2 - DRAG_HANDLE_SIZE / 2), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); Rectangle SW = new Rectangle( new Point(control.Location.X - DRAG_HANDLE_SIZE, control.Location.Y + control.Height), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); Rectangle S = new Rectangle( new Point(control.Location.X + control.Width / 2 - DRAG_HANDLE_SIZE / 2, control.Location.Y + control.Height), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); Rectangle SE = new Rectangle( new Point(control.Location.X + control.Width, control.Location.Y + control.Height), new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE)); //get the form graphic Graphics g = DistriMakerPanel.CreateGraphics(); //draw the border and drag handles ControlPaint.DrawBorder(g, Border, Color.Gray, ButtonBorderStyle.Dotted); ControlPaint.DrawGrabHandle(g, NW, true, true); ControlPaint.DrawGrabHandle(g, N, true, true); ControlPaint.DrawGrabHandle(g, NE, true, true); ControlPaint.DrawGrabHandle(g, W, true, true); ControlPaint.DrawGrabHandle(g, E, true, true); ControlPaint.DrawGrabHandle(g, SW, true, true); ControlPaint.DrawGrabHandle(g, S, true, true); ControlPaint.DrawGrabHandle(g, SE, true, true); g.Dispose(); Graphics p = pnlMain.CreateGraphics(); //draw the border and drag handles ControlPaint.DrawBorder(p, Border, Color.Gray, ButtonBorderStyle.Dotted); ControlPaint.DrawGrabHandle(p, NW, true, true); ControlPaint.DrawGrabHandle(p, N, true, true); ControlPaint.DrawGrabHandle(p, NE, true, true); ControlPaint.DrawGrabHandle(p, W, true, true); ControlPaint.DrawGrabHandle(p, E, true, true); ControlPaint.DrawGrabHandle(p, SW, true, true); ControlPaint.DrawGrabHandle(p, S, true, true); ControlPaint.DrawGrabHandle(p, SE, true, true); p.Dispose(); Graphics f = flowLayoutPanel1.CreateGraphics(); //draw the border and drag handles ControlPaint.DrawBorder(f, Border, Color.Gray, ButtonBorderStyle.Dotted); ControlPaint.DrawGrabHandle(f, NW, true, true); ControlPaint.DrawGrabHandle(f, N, true, true); ControlPaint.DrawGrabHandle(f, NE, true, true); ControlPaint.DrawGrabHandle(f, W, true, true); ControlPaint.DrawGrabHandle(f, E, true, true); ControlPaint.DrawGrabHandle(f, SW, true, true); ControlPaint.DrawGrabHandle(f, S, true, true); ControlPaint.DrawGrabHandle(f, SE, true, true); f.Dispose(); }
List<List<Control>> mesGroupes = new List<List<Control>>();
List<Control>() nouveauGroupe = new List<Control>(); mesGroupes.Add(nouveauGroupe);
nouveauGroupe.Add(leControle);
List<Control>() leGroupe = mesGroupes.SingleOrDefault(g => g.Contains(leControle)); if (leGroupe != null)//le contrôle fait parti de leGroupe
24 févr. 2019 à 13:33
ci dessous une capture d’écran.
Je fabrique un ensemble de contrôles à l'aide des boutons à gauche (Add...)
Tout les contrôles sont sélectionnables un par un .
Moi j'aurais voulu pouvoir en sélectionner plusieurs en même temps , par exemple les textbox "Soca" et créer un groupe avec.
C'est a dire qu'une fois le groupe créer, lorsque je clique sur une Textbox Soca ça me sélectionne les 5 Textboxs Soca.
En fait c'est la fonctions group/Ungroup dans la plupart des logiciel de dessin.
J’espère ne pas être trop fouillis dans mes explications.
Merci d'avance pour les pistes de recherche.
Bien a toi.