Renders code and data side by side.
Inheritance: TextView
示例#1
0
        public PreviewInteractor(
            IServiceProvider services,
            Program program,
            Timer previewTimer,
            MixedCodeDataControl mixedCodeDataControl)
        {
            this.services = services;
            this.previewTimer = previewTimer;
            this.program = program;
            this.mixedCodeDataControl = mixedCodeDataControl;
            this.szPreview = new Size(500, 200); //$REVIEW: should this be a user preference?

            this.mixedCodeDataControl.MouseDown += MixedCodeDataControl_MouseDown;
            this.mixedCodeDataControl.SpanEnter += MixedCodeDataControl_SpanEnter;
            this.mixedCodeDataControl.SpanLeave += MixedCodeDataControl_SpanLeave;
            this.previewTimer.Tick += PreviewTimer_Tick;
        }
示例#2
0
        private void PreviewTimer_Tick(object sender, EventArgs e)
        {
            // Timer needs to be disabled now so we don't get more ticks.
            this.previewTimer.Enabled = false;

            // Popup a sizeable tool window with a mixed code data control inside.
            var rcF = previewSpan.ContentExtent;
            var rc = mixedCodeDataControl.ClientRectangle;
            var ptScreen = mixedCodeDataControl.PointToScreen(
                new System.Drawing.Point(100, (int)rcF.Bottom));

            var nested = new MixedCodeDataControl
            {
                Model = ((MixedCodeDataModel)this.mixedCodeDataControl.Model).Clone(),
                Program = this.mixedCodeDataControl.Program,      //$TODO: would be nice to avoid triggering recalc
                Dock = DockStyle.Fill,
                Services = this.services,
                StyleClass = this.mixedCodeDataControl.StyleClass,
                Padding = new Padding(3),
            };
            nested.VScrollBar.Visible = false;

            var parentForm = this.mixedCodeDataControl.FindForm();
            var frame = new Form
            {
                AutoSize = false,
                FormBorderStyle = FormBorderStyle.SizableToolWindow,
                Size = szPreview,
                StartPosition = FormStartPosition.Manual,
                Location = ptScreen,
                Controls = { nested },
                ShowInTaskbar = false,
                ControlBox = false,
            };
            parentForm.AddOwnedForm(frame);
            frame.Show();
            this.previewWindow = frame;
            nested.TopAddress = this.addressPreview;

            frame.MouseLeave += Lbl_MouseLeave;
            frame.MouseEnter += Lbl_MouseEnter;
            this.insidePreview = false;
        }