Example #1
0
            /// <include file='doc\CompositionDesigner.uex' path='docs/doc[@for="ComponentDocumentDesigner.CompositionUI.CompositionUI"]/*' />
            /// <devdoc>
            ///      Creates a new CompositionUI object.
            /// </devdoc>
            public CompositionUI(ComponentDocumentDesigner compositionDesigner, IServiceProvider provider) : base(compositionDesigner, provider)
            {
                this.compositionDesigner = compositionDesigner;
                this.serviceProvider     = provider;

                this.watermark         = new WatermarkLabel(this);
                watermark.TextAlign    = System.Drawing.ContentAlignment.MiddleCenter;
                watermark.LinkClicked += new LinkLabelLinkClickedEventHandler(this.OnLinkClick);
                watermark.Dock         = System.Windows.Forms.DockStyle.Fill;
                watermark.TabStop      = false;
                watermark.Text         = SR.GetString(SR.CompositionDesignerWaterMark);

                try {
                    int wmBegin  = Int32.Parse(SR.GetString(SR.CompositionDesignerWaterMarkBegin1));
                    int wmLength = Int32.Parse(SR.GetString(SR.CompositionDesignerWaterMarkLength1));
                    watermark.Links.Add(wmBegin, wmLength, "ServerExplorer");

                    wmBegin  = Int32.Parse(SR.GetString(SR.CompositionDesignerWaterMarkBegin2));
                    wmLength = Int32.Parse(SR.GetString(SR.CompositionDesignerWaterMarkLength2));
                    watermark.Links.Add(wmBegin, wmLength, "Toolbox");

                    wmBegin  = Int32.Parse(SR.GetString(SR.CompositionDesignerWaterMarkBegin3));
                    wmLength = Int32.Parse(SR.GetString(SR.CompositionDesignerWaterMarkLength3));
                    watermark.Links.Add(wmBegin, wmLength, "CodeView");
                }
                catch (Exception e) {
                    Debug.WriteLine(e.ToString());
                }

                this.Controls.Add(watermark);
            }
Example #2
0
 public CompositionUI(ComponentDocumentDesigner compositionDesigner, IServiceProvider provider) : base(compositionDesigner, provider)
 {
     this.compositionDesigner    = compositionDesigner;
     this.serviceProvider        = provider;
     this.watermark              = new ComponentDocumentDesigner.WatermarkLabel(this);
     this.watermark.Font         = new Font(this.watermark.Font.FontFamily, 11f);
     this.watermark.TextAlign    = ContentAlignment.MiddleCenter;
     this.watermark.LinkClicked += new LinkLabelLinkClickedEventHandler(this.OnLinkClick);
     this.watermark.Dock         = DockStyle.Fill;
     this.watermark.TabStop      = false;
     this.watermark.Text         = System.Design.SR.GetString("CompositionDesignerWaterMark");
     try
     {
         string str    = System.Design.SR.GetString("CompositionDesignerWaterMarkFirstLink");
         int    index  = this.watermark.Text.IndexOf(str);
         int    length = str.Length;
         this.watermark.Links.Add(index, length, "Toolbox");
         str    = System.Design.SR.GetString("CompositionDesignerWaterMarkSecondLink");
         index  = this.watermark.Text.IndexOf(str);
         length = str.Length;
         this.watermark.Links.Add(index, length, "CodeView");
     }
     catch (Exception exception)
     {
         if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
         {
             throw;
         }
     }
     base.Controls.Add(this.watermark);
 }
 public WatermarkLabel(ComponentDocumentDesigner.CompositionUI compositionUI)
 {
     this.compositionUI = compositionUI;
 }
 public CompositionSelectionUIHandler(ComponentDocumentDesigner compositionDesigner)
 {
     this.compositionDesigner = compositionDesigner;
 }
 public CompositionUI(ComponentDocumentDesigner compositionDesigner, IServiceProvider provider)
     : base(compositionDesigner, provider)
 {
     this.compositionDesigner = compositionDesigner;
     this.serviceProvider = provider;
     this.watermark = new ComponentDocumentDesigner.WatermarkLabel(this);
     this.watermark.Font = new Font(this.watermark.Font.FontFamily, 11f);
     this.watermark.TextAlign = ContentAlignment.MiddleCenter;
     this.watermark.LinkClicked += new LinkLabelLinkClickedEventHandler(this.OnLinkClick);
     this.watermark.Dock = DockStyle.Fill;
     this.watermark.TabStop = false;
     this.watermark.Text = System.Design.SR.GetString("CompositionDesignerWaterMark");
     try
     {
         string str = System.Design.SR.GetString("CompositionDesignerWaterMarkFirstLink");
         int index = this.watermark.Text.IndexOf(str);
         int length = str.Length;
         this.watermark.Links.Add(index, length, "Toolbox");
         str = System.Design.SR.GetString("CompositionDesignerWaterMarkSecondLink");
         index = this.watermark.Text.IndexOf(str);
         length = str.Length;
         this.watermark.Links.Add(index, length, "CodeView");
     }
     catch (Exception exception)
     {
         if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
         {
             throw;
         }
     }
     base.Controls.Add(this.watermark);
 }
		internal DesignerHost(BrowserTree objTree, Panel imagePanel)
		{
			_imagePanel = imagePanel;
			if (_host == null) {
				_host = this;
				_serviceContainer = new ServiceContainer();
				_serviceContainer.AddService(typeof(IDesignerHost), _host);
				_serviceContainer.AddService(typeof(IUIService), _host);
				_serviceContainer.AddService(typeof(ISelectionService), _host);
				_serviceContainer.AddService(typeof(IToolboxService), new ToolboxService());
			}

			_container = new DesignerContainer(this);
			_defaultSite = new DesignerSite(this, null, _container,	"Default site");

			_designSurfaceSite = (DesignerSite)_container.CreateSite(_imagePanel, "Design Surface");

			// Hook the design surface to the ParentControlDesigner
			_parentControlDesigner = new DummyDesigner();
			_imagePanel.Site = _designSurfaceSite;
			_designSurfaceSite.Designer = _parentControlDesigner;
			_parentControlDesigner.Initialize(_imagePanel);

			// Used to make sure we don't give a designer for anything higher
			// than the design surface (GetDesigner is called on the 
			// surface's parent)
			_designSurfaceParent = ((Control)_imagePanel).Parent;

			// Get the type for the UI selection service, since its private
			// the compiler will not let us see it
			_typeISelectionUIService = ReflectionHelper.GetType("System.Windows.Forms.Design.ISelectionUIService");

			// This is required to get an instance of the selection 
			// UI service installed, we don't actually use this 
			// designer for anything
			_fakePanel = new Panel();
			IDesigner compDes = new ComponentDocumentDesigner();
			_fakePanel.Site = _container.CreateSite(_fakePanel, "Fake Design Surface");
			compDes.Initialize(_fakePanel);

			// Make the size of the selection service cover the design
			// surface panel so that it will see all of the events
			_selUIService = (Control)GetService(_typeISelectionUIService);
			ObjectBrowser.ImagePanel.ResetSize(_selUIService);
			_imagePanel.Controls.Add(_selUIService);
			_imagePanel.SizeChanged += new EventHandler(ImagePanelSizeChange);

			DesignMode = true;

			// So we change the object selected when a control is selected
			SelectionChanged += new EventHandler(objTree.ControlSelectionChanged);
		}
Example #7
0
 /// <include file='doc\CompositionDesigner.uex' path='docs/doc[@for="ComponentDocumentDesigner.CompositionUI.CompositionSelectionUIHandler.CompositionSelectionUIHandler"]/*' />
 /// <devdoc>
 ///      Creates a new selection UI handler for the given
 ///      composition designer.
 /// </devdoc>
 public CompositionSelectionUIHandler(ComponentDocumentDesigner compositionDesigner)
 {
     this.compositionDesigner = compositionDesigner;
 }