Beispiel #1
0
        public void EndTextMode(bool changeText)
        {
            AnnRichTextObject obj = _targetObject as AnnRichTextObject;

            IsEditingText = false;

            if (_tb != null)
            {
                if (!changeText)
                {
                    _tb.Rtf = obj.Rtf;
                }
                obj.Rtf = _tb.Rtf;
                if (_tb.Parent != null)
                {
                    if (_toolBar != null)
                    {
                        _toolBar.Closing -= new System.ComponentModel.CancelEventHandler(_toolBar_Closing);
                        _toolBar.Dispose();
                        _toolBar = null;
                    }

                    _tb.Parent.Controls.Remove(_tb);
                }
            }
        }
Beispiel #2
0
        public void ShowRichTextDialog(AnnRichTextObject richTextObject)
        {
            if ((richTextObject != null) && !richTextObject.IsLocked && !richTextObject.Bounds.IsEmpty)
            {
                _tb               = new RichTextBox();
                _tb.Multiline     = true;
                _tb.HideSelection = false;

                _tb.Rtf = richTextObject.Rtf;

                LeadRectD bounds = _container.Mapper.RectFromContainerCoordinates(richTextObject.Bounds, richTextObject.FixedStateOperations);
                bounds.Inflate(20, 20);

                _tb.Location   = new Point((int)bounds.X, (int)bounds.Y);
                _tb.Size       = new Size((int)bounds.Width, (int)bounds.Height);
                _tb.LostFocus += new EventHandler(tb_LostFocus);
                _tb.KeyDown   += new KeyEventHandler(tb_KeyDown);
                _tb.MouseDown += new MouseEventHandler(tb_MouseDown);

                _toolBar          = new RichTextMenu(_tb);
                _toolBar.Location = new Point(200, 200);
                _toolBar.Closing += new System.ComponentModel.CancelEventHandler(_toolBar_Closing);

                _toolBar.Show(_tb.Parent);

                var imageViewerAutomationControl = _owner as ImageViewerAutomationControl;
                if (imageViewerAutomationControl != null)
                {
                    imageViewerAutomationControl.ImageViewer.Controls.Add(_tb);
                }

                _tb.Focus();
                _tb.SelectAll();
                IsEditingText = true;
            }
        }