Exemplo n.º 1
0
        void Grids_MouseMove(object sender, MouseEventArgs e)
        {
            Cursor.Current = Cursors.HSplit;

            if (!m_fResizingGrids || m_oResizingGrid == null)
            {
                return;
            }

            Point pt = panelGrids.PointToClient(Cursor.Position);

            if (pt.Y < m_oResizingGrid.Top + kdypMinResults)
            {
                return;
            }

            int dypHeight = 0;
            int dyp       = m_oResizingGrid.Height - (pt.Y - m_oResizingGrid.Top);

            m_oResizingGrid.Height = m_oResizingGrid.Height - dyp;
            foreach (Control oControl in panelGrids.Controls)
            {
                if (oControl.Top > m_oResizingGrid.Top && oControl != m_oResizingGrid)
                {
                    oControl.Top = oControl.Top - dyp;
                }
                dypHeight += GetHeight(oControl);
            }

            panelGrids.AutoScrollMinSize = new Size(0, dypHeight);
        }
Exemplo n.º 2
0
        private void m_panelCalendrier_MouseDown(object sender, MouseEventArgs e)
        {
            m_panelCalendrier.Focus();
            if ((ModifierKeys & Keys.Control) != Keys.Control)
            {
                // Vider la sélection
                m_lstSelectionDates.Clear();
            }
            if ((ModifierKeys & Keys.Shift) == Keys.Shift)
            {
                // Ajoute du dernier au nouveau
                DateTime dt = DateTime.Now;
                if (GetDateTimeFromPoint(m_panelCalendrier.PointToClient(Cursor.Position), ref dt))
                {
                    HideSelection();
                    m_lstSelectionDates.Add(dt);
                    if (dt != m_lastSelectedDate)
                    {
                        int sens = dt < m_lastSelectedDate ? -1 : 1;
                        for (DateTime date = m_lastSelectedDate; date != dt; date = date.AddDays(sens))
                        {
                            m_lstSelectionDates.Add(date);
                        }
                    }
                    ShowSelection();

                    if (OnSelectedDateChanged != null)
                    {
                        OnSelectedDateChanged(this, new EventArgs());
                    }
                }
            }
            else
            {
                DateTime dt = DateTime.Now;
                if (GetDateTimeFromPoint(m_panelCalendrier.PointToClient(Cursor.Position), ref dt))
                {
                    // Ajoute nouveau
                    if (!m_lstSelectionDates.Contains(dt))
                    {
                        HideSelection();
                        m_lstSelectionDates.Add(dt);
                        ShowSelection();
                        if (OnSelectedDateChanged != null)
                        {
                            OnSelectedDateChanged(this, new EventArgs());
                        }
                    }
                    // Supprime nouveau
                    else
                    {
                        HideSelection();
                        m_lstSelectionDates.Remove(dt);
                        ShowSelection();
                        if (OnSelectedDateChanged != null)
                        {
                            OnSelectedDateChanged(this, new EventArgs());
                        }
                    }
                }

                // Dernier = nouveau
                m_lastSelectedDate = dt;
            }
        }