コード例 #1
0
        //------------------------------------------------------------------------
        protected override object GetData(Node node, TreeListColumn column)
        {
            if (node[column.Index] != null)
            {
                return(node[column.Index]);
            }

            CResultAErreur result = CResultAErreur.True;

            CLocalAlarmeAffichee localAlarme = node.Tag as CLocalAlarmeAffichee;

            if (localAlarme != null)
            {
                try
                {
                    CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(localAlarme);
                    C2iExpression exp = m_parametreAffichage.Colonnes[column.Index].FormuleDonnee;
                    if (exp != null)
                    {
                        result = exp.Eval(ctx);
                        if (result)
                        {
                            node[column.Index] = result.Data;
                            return(result.Data);
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    result.EmpileErreur(ex.Message);
                    return(result);
                }
            }
            return(null);
        }
コード例 #2
0
        void SetHotColumn(TreeListColumn col, bool ishot)
        {
            int scrolloffset = HScrollValue();

            if (col != m_hotColumn)
            {
                if (m_hotColumn != null)
                {
                    m_hotColumn.ishot = false;
                    Rectangle r = m_hotColumn.CalculatedRect;
                    r.X -= scrolloffset;
                    Invalidate(r);
                }
                m_hotColumn = col;
                if (m_hotColumn != null)
                {
                    m_hotColumn.ishot = ishot;
                    Rectangle r = m_hotColumn.CalculatedRect;
                    r.X -= scrolloffset;
                    Invalidate(r);
                }
            }
        }
コード例 #3
0
        protected virtual Rectangle GetPlusMinusRectangle(Node node, TreeListColumn firstColumn, int visibleRowIndex)
        {
            if (node.HasChildren == false)
            {
                return(Rectangle.Empty);
            }
            int hScrollOffset = HScrollValue();

            if (firstColumn.CalculatedRect.Right - hScrollOffset < RowHeaderWidth())
            {
                return(Rectangle.Empty);
            }
            System.Diagnostics.Debug.Assert(firstColumn.VisibleIndex == 0);

            Rectangle glyphRect = firstColumn.CalculatedRect;

            glyphRect.X     -= hScrollOffset;
            glyphRect.X     += GetIndentSize(node);
            glyphRect.X     += Columns.Options.LeftMargin;
            glyphRect.Width  = 10;
            glyphRect.Y      = VisibleRowToYPoint(visibleRowIndex);
            glyphRect.Height = RowOptions.ItemHeight;
            return(glyphRect);
        }
コード例 #4
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            try
            {
                bool bShowToolTip = false;
                Node nodeSurvole  = CalcHitNode(e.Location);
                if (nodeSurvole != null && nodeSurvole != m_lastNodeForToolTip)
                {
                    bShowToolTip         = true;
                    m_lastNodeForToolTip = nodeSurvole;
                }
                TreeListColumn colonneSurvolee = CalcColumnHit(e.Location).Column;
                if (colonneSurvolee != null && colonneSurvolee != m_lastColumnForToolTip)
                {
                    bShowToolTip           = true;
                    m_lastColumnForToolTip = colonneSurvolee;
                    // Gestion curseur souris
                    if (m_dicIndexColonneAction.Keys.Contains(colonneSurvolee.Index))
                    {
                        Cursor.Current = Cursors.Hand;
                    }
                    else
                    {
                        Cursor.Current = Cursors.Default;
                    }
                }


                if (bShowToolTip)
                {
                    object dataForToolTip = GetData(nodeSurvole, colonneSurvolee);
                    if (dataForToolTip != null)
                    {
                        string texte = dataForToolTip.ToString();
                        if (texte.Trim() != "")
                        {
                            Graphics       g       = CreateGraphics();
                            TextFormatting format  = GetFormatting(nodeSurvole, colonneSurvolee);
                            SizeF          dim     = g.MeasureString(texte, format.Font);
                            Rectangle      rc      = Util.AdjustRectangle(colonneSurvolee.CalculatedRect, format.Padding);
                            int            nOffset = 0;
                            if (colonneSurvolee.Index == 0)
                            {
                                nOffset = GetIndentSize(nodeSurvole) + 16;
                            }
                            if ((int)dim.Width >= (rc.Width - nOffset))
                            {
                                DelayShowTooltip(e.Location, texte);
                            }
                            else
                            {
                                HideTooltip();
                            }
                        }
                        else
                        {
                            HideTooltip();
                        }
                    }
                    else
                    {
                        HideTooltip();
                    }
                }
            }
            catch
            {
                HideTooltip();
            }
        }