public void OnMouseUp(CControleMapBesoinOld controleMap, Point ptLocal) { if (m_rectangleZoneExpand != null && m_rectangleZoneExpand.Value.Contains(ptLocal)) { if (!m_satisfaction.Equals(controleMap.m_satisfactionRacine)) { if (m_bIsExpanded) { controleMap.m_setSatisfactionsExpanded.Remove(m_satisfaction); } else { controleMap.m_setSatisfactionsExpanded.Add(m_satisfaction); } controleMap.RefreshDessin(); } } }
public void OnMouseMove(CControleMapBesoinOld controleMap, Point ptLocal) { if (m_rectangleZoneExpand != null && m_rectangleZoneExpand.Value.Contains(ptLocal)) { if (m_satisfaction.Equals(controleMap.m_satisfactionRacine)) { controleMap.Cursor = Cursors.No; } else { controleMap.Cursor = Cursors.Hand; } } else { controleMap.Cursor = Cursors.Default; } }
//----------------------------------------- private void AddSatisfaction( int nNiveauHierarchique, CControleMapBesoinOld controleMap, ISatisfactionBesoin satisfaction) { if (satisfaction != null && !controleMap.m_setSatisfactionsIntegrés.Contains(satisfaction)) { controleMap.m_setSatisfactionsIntegrés.Add(satisfaction); m_listeSatisfactions.Add(satisfaction); if (controleMap.m_setSatisfactionsExpanded.Contains(satisfaction)) { ISatisfactionBesoinAvecSousBesoins satB = satisfaction as ISatisfactionBesoinAvecSousBesoins; if (satB != null) { foreach (CBesoin besoin in satB.GetSousBesoinsDeSatisfaction()) { AddSatisfaction(nNiveauHierarchique + 1, controleMap, besoin); } } } } }
//----------------------------------------- public void AddSatisfaction( CControleMapBesoinOld controleMap, ISatisfactionBesoin satisfaction) { AddSatisfaction(0, controleMap, satisfaction); }
public void OnMouseDown(CControleMapBesoinOld controleMap, Point ptLocal) { }
//------------------------------------------------------ public void Draw( CControleMapBesoinOld controleMap, Color couleurFond, bool bSelected, Graphics g) { Rectangle rct = Rectangle; Brush br = new SolidBrush(Color.FromArgb(64, 0, 0, 0)); g.FillRectangle(br, rct.Left + 4, rct.Bottom, rct.Width, 4); g.FillRectangle(br, rct.Right, rct.Top + 4, 4, rct.Height - 4); br.Dispose(); Color c = couleurFond; br = new SolidBrush(c); g.FillRectangle(br, rct); br.Dispose(); Pen pTour = new Pen(Color.Black, bSelected ? 4 : 1); g.DrawRectangle(pTour, rct); pTour.Dispose(); rct.Offset(1, 1); rct.Height = controleMap.m_nHauteurSatisfactionDefaut; rct.Inflate(-2, -2); Image img = sc2i.common.DynamicClassAttribute.GetImage(m_satisfaction.GetType()); if (img != null) { Rectangle rctImage = new Rectangle(rct.Left, rct.Top, 16, 16); g.DrawImage(img, rctImage); rct.Offset(16, 0); rct.Width -= 16; } if (HasChildren) { img = m_bIsExpanded ? Resources.blueUp32 : Resources.blueDown32; Size sz = CUtilImage.GetSizeAvecRatio(img, new Size(2000, 16)); Rectangle rctImage = new Rectangle(rct.Right - sz.Width, rct.Bottom - sz.Height, sz.Width, sz.Height); g.DrawImage(img, rctImage, new Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel); Point pt = new Point(rctImage.Left, rctImage.Top); pt = PointToClient(pt); m_rectangleZoneExpand = new Rectangle(pt, rctImage.Size); } string str = m_satisfaction.LibelleSatisfactionComplet; StringFormat sf = new StringFormat(StringFormatFlags.FitBlackBox); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; g.DrawString(str, controleMap.Font, Brushes.Black, rct, sf); sf.Dispose(); }