示例#1
0
        private void reportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dockParent = FindDockContent(this);

            foreach (Record r in this.listSearchView.SelectedObjects.OfType <Record>())
            {
                var form = new RichTextContent();
                form.UpdateRecord(r);
                form.StartPosition = FormStartPosition.CenterScreen;
                if (dockParent != null)
                {
                    var sz = form.Size;
                    form.Show(dockParent.DockHandler.DockPanel, DockState.Float);
                    form.Pane.FloatWindow.Size = sz;
                }
                else
                {
                    form.Show(this);
                }
            }
        }
示例#2
0
        private void contextMenuRecordReport_Click(object sender, EventArgs e)
        {
            var dockParent = this.FindDockContent(this);

            foreach (BaseRecord r in this.PluginTree.SelectedRecords.OfType <BaseRecord>())
            {
                var form = new RichTextContent();
                form.UpdateRecord(r);
                form.StartPosition = FormStartPosition.CenterScreen;

                if (dockParent != null)
                {
                    var sz = form.Size;
                    form.Show(dockParent.DockHandler.DockPanel, DockState.Float);
                    form.Pane.FloatWindow.Size = sz;
                }
                else
                {
                    form.Show(this);
                }
            }
        }
示例#3
0
        private void reportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var selRecord = PluginTree.SelectedRecord;

            var r    = selRecord as Record;
            var form = new RichTextContent();

            form.UpdateRecord(selRecord);
            form.StartPosition = FormStartPosition.CenterScreen;

            var dockParent = FindDockContent(this);

            if (dockParent != null)
            {
                var sz = form.Size;
                form.Show(dockParent.DockHandler.DockPanel, DockState.Float);
                form.Pane.FloatWindow.Size = sz;
            }
            else
            {
                form.Show(this);
            }
        }
示例#4
0
        /// <summary>
        /// Determines whether additional overflow columns are needed and if existing columns can
        /// be removed.
        /// </summary>
        /// <param name="availableSize">The size of the space available, used to constrain the
        /// number of additional columns that can be created.</param>
        /// <returns>The resulting size of the original content plus any extra columns.</returns>
        protected override Size MeasureOverride(Size availableSize)
        {
            if (RichTextContent == null)
            {
                return(new Size(0, 0));
            }

            // Make sure the RichTextBlock is a child, using the lack of
            // a list of additional columns as a sign that this hasn't been
            // done yet
            if (_overflowColumns == null)
            {
                Children.Add(RichTextContent);
                _overflowColumns = new List <RichTextBlockOverflow>();
            }

            // Start by measuring the original RichTextBlock content
            RichTextContent.Measure(availableSize);
            var maxWidth    = RichTextContent.DesiredSize.Width;
            var maxHeight   = RichTextContent.DesiredSize.Height;
            var hasOverflow = RichTextContent.HasOverflowContent;

            // Make sure there are enough overflow columns
            int overflowIndex = 0;

            while (hasOverflow && maxWidth < availableSize.Width && ColumnTemplate != null)
            {
                // Use existing overflow columns until we run out, then create
                // more from the supplied template
                RichTextBlockOverflow overflow;
                if (_overflowColumns.Count > overflowIndex)
                {
                    overflow = _overflowColumns[overflowIndex];
                }
                else
                {
                    overflow = (RichTextBlockOverflow)ColumnTemplate.LoadContent();
                    _overflowColumns.Add(overflow);
                    Children.Add(overflow);
                    if (overflowIndex == 0)
                    {
                        RichTextContent.OverflowContentTarget = overflow;
                    }
                    else
                    {
                        _overflowColumns[overflowIndex - 1].OverflowContentTarget = overflow;
                    }
                }

                // Measure the new column and prepare to repeat as necessary
                overflow.Measure(new Size(availableSize.Width - maxWidth, availableSize.Height));
                maxWidth   += overflow.DesiredSize.Width;
                maxHeight   = Math.Max(maxHeight, overflow.DesiredSize.Height);
                hasOverflow = overflow.HasOverflowContent;
                overflowIndex++;
            }

            // Disconnect extra columns from the overflow chain, remove them from our private list
            // of columns, and remove them as children
            if (_overflowColumns.Count > overflowIndex)
            {
                if (overflowIndex == 0)
                {
                    RichTextContent.OverflowContentTarget = null;
                }
                else
                {
                    _overflowColumns[overflowIndex - 1].OverflowContentTarget = null;
                }
                while (_overflowColumns.Count > overflowIndex)
                {
                    _overflowColumns.RemoveAt(overflowIndex);
                    Children.RemoveAt(overflowIndex + 1);
                }
            }

            // Report final determined size
            return(new Size(maxWidth, maxHeight));
        }
        protected override Size MeasureOverride(Size availableSize)
        {
            if (RichTextContent == null)
            {
                return(new Size(0, 0));
            }

            if (_overflowColumns == null)
            {
                Children.Add(RichTextContent);
                _overflowColumns = new List <RichTextBlockOverflow>();
            }

            RichTextContent.Measure(availableSize);
            var maxWidth    = RichTextContent.DesiredSize.Width;
            var maxHeight   = RichTextContent.DesiredSize.Height;
            var hasOverflow = RichTextContent.HasOverflowContent;

            var overflowIndex = 0;

            while (hasOverflow && maxWidth < availableSize.Width && ColumnTemplate != null)
            {
                RichTextBlockOverflow overflow;
                if (_overflowColumns.Count > overflowIndex)
                {
                    overflow = _overflowColumns[overflowIndex];
                }
                else
                {
                    overflow = (RichTextBlockOverflow)ColumnTemplate.LoadContent();
                    _overflowColumns.Add(overflow);
                    Children.Add(overflow);
                    if (overflowIndex == 0)
                    {
                        RichTextContent.OverflowContentTarget = overflow;
                    }
                    else
                    {
                        _overflowColumns[overflowIndex - 1].OverflowContentTarget = overflow;
                    }
                }

                overflow.Measure(new Size(availableSize.Width - maxWidth, availableSize.Height));
                maxWidth   += overflow.DesiredSize.Width;
                maxHeight   = Math.Max(maxHeight, overflow.DesiredSize.Height);
                hasOverflow = overflow.HasOverflowContent;
                overflowIndex++;
            }

            if (_overflowColumns.Count > overflowIndex)
            {
                if (overflowIndex == 0)
                {
                    RichTextContent.OverflowContentTarget = null;
                }
                else
                {
                    _overflowColumns[overflowIndex - 1].OverflowContentTarget = null;
                }
                while (_overflowColumns.Count > overflowIndex)
                {
                    _overflowColumns.RemoveAt(overflowIndex);
                    Children.RemoveAt(overflowIndex + 1);
                }
            }

            return(new Size(maxWidth, maxHeight));
        }