コード例 #1
0
        /// <summary>
        /// Metoda volaná pro vykreslování obsahu "Přes Child prvky".
        /// </summary>
        /// <param name="e"></param>
        /// <param name="boundsAbsolute"></param>
        /// <param name="drawMode"></param>
        public void DrawOverChilds(GInteractiveDrawArgs e, Rectangle boundsAbsolute, DrawItemMode drawMode)
        {
            Rectangle boundsVisibleAbsolute = boundsAbsolute;

            if (e.DrawLayer == GInteractiveDrawLayer.Standard)
            {
                boundsVisibleAbsolute = e.GetClip(boundsAbsolute);
            }

            this.ControlBuffered.DrawImages(e, ref boundsAbsolute, boundsVisibleAbsolute, drawMode);

            if (!this.DrawTextInCurrentState)
            {
                return;
            }

            if (e.DrawLayer == GInteractiveDrawLayer.Standard)
            {
                boundsVisibleAbsolute = e.GetClip(boundsAbsolute);
            }

            FontInfo fontInfo = FontInfo.CaptionBold;
            ExtendedContentAlignment textPosition = this.TextPosition;
            string text = this.GetCaption(e, boundsAbsolute, boundsVisibleAbsolute, fontInfo, textPosition);

            if (String.IsNullOrEmpty(text))
            {
                return;
            }
            this.ControlBuffered.DrawText(e, boundsVisibleAbsolute, text, fontInfo, textPosition);
        }
コード例 #2
0
        /// <summary>
        /// Metoda vrátí text, který má být zobrazen v grafickém prvku
        /// </summary>
        /// <param name="e"></param>
        /// <param name="boundsAbsolute"></param>
        /// <param name="boundsVisibleAbsolute"></param>
        /// <param name="fontInfo"></param>
        /// <param name="textPosition"></param>
        /// <returns></returns>
        protected string GetCaption(GInteractiveDrawArgs e, Rectangle boundsAbsolute, Rectangle boundsVisibleAbsolute, FontInfo fontInfo, ExtendedContentAlignment textPosition)
        {
            // 1. Pokud je text v prvku uveden explicitně, pak jej použijeme:
            string text = this._FirstItem.Text;

            if (text != null)
            {
                return(text);
            }

            // 2. Text pro aktuální velikost je pravděpodobně uložený v paměti (od posledně):
            Size size = boundsAbsolute.Size;

            text = this.GetCaptionForSize(size);
            if (text != null)
            {
                return(text);
            }

            // 3. Pro danou velikost ještě text není zapamatován => Získáme text Caption z datového zdroje grafu a zapamatujeme si ho:
            CreateTextArgs args = new CreateTextArgs(this._ParentGraph, e, fontInfo, this, this._FirstItem, GraphControlPosition.Group, boundsAbsolute, boundsVisibleAbsolute);

            text = this._ParentGraph.GraphItemGetCaptionText(args);
            this.SetCaptionForSize(size, text);

            return(text);
        }