• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Design.DesignSurface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.ComponentModel.Design.DesignSurface的典型用法代码示例。如果您正苦于以下问题:C# DesignSurface类的具体用法?C# DesignSurface怎么用?C# DesignSurface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DesignSurface类属于System.ComponentModel.Design命名空间,在下文中一共展示了DesignSurface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DesignerHost

 public DesignerHost(DesignSurface surface)
 {
     this._surface = surface;
     this._state = new BitVector32();
     this._designers = new Hashtable();
     this._events = new EventHandlerList();
     DesignSurfaceServiceContainer service = this.GetService(typeof(DesignSurfaceServiceContainer)) as DesignSurfaceServiceContainer;
     if (service != null)
     {
         foreach (Type type in DefaultServices)
         {
             service.AddFixedService(type, this);
         }
     }
     else
     {
         IServiceContainer container2 = this.GetService(typeof(IServiceContainer)) as IServiceContainer;
         if (container2 != null)
         {
             foreach (Type type2 in DefaultServices)
             {
                 container2.AddService(type2, this);
             }
         }
     }
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:26,代码来源:DesignerHost.cs


示例2: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				Form form = (Form)host.RootComponent;			
				form.ClientSize = new Size(284, 264);
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				RichTextBox textBox = (RichTextBox)host.CreateComponent(typeof(RichTextBox), "richTextBox1");
				textBox.Size = new Size(110, 20);
				textBox.TabIndex = 1;
				textBox.Location = new Point(10, 10);
				textBox.Text = "abc\r\n" +
					"def\r\n" +
					"ghi\r\n";
				
				form.Controls.Add(textBox);
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:28,代码来源:GenerateRichTextBoxTestFixture.cs


示例3: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);
				
				Button button = (Button)host.CreateComponent(typeof(Button), "button1");
				button.Location = new Point(0, 0);
				button.Size = new Size(10, 10);
				button.Text = "button1";
				button.UseCompatibleTextRendering = false;
				
				button.FlatAppearance.BorderSize = 2;
				button.FlatAppearance.BorderColor = Color.Red;
				button.FlatAppearance.MouseOverBackColor = Color.Yellow;
		
				form.Controls.Add(button);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					RubyCodeDomSerializer serializer = new RubyCodeDomSerializer("    ");
					generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:31,代码来源:GenerateButtonFlatAppearanceTestFixture.cs


示例4: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor descriptor = descriptors.Find("Name", false);
				descriptor.SetValue(form, "MainForm");
				
				// Add menu strip.
				MenuStrip menuStrip = (MenuStrip)host.CreateComponent(typeof(MenuStrip), "menuStrip1");
				menuStrip.Text = "menuStrip1";
				menuStrip.TabIndex = 0;
				menuStrip.Location = new Point(0, 0);
				form.Controls.Add(menuStrip);

				descriptor = descriptors.Find("MainMenuStrip", false);
				descriptor.SetValue(form, menuStrip);

				form.Controls.Remove(menuStrip);
				host.Container.Remove(menuStrip);
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:32,代码来源:RemoveMainMenuStripFromFormTestFixture.cs


示例5: SetUpFixture

		public void SetUpFixture()
		{
			resourceWriter = new MockResourceWriter();
			resourceService = new MockResourceService();
			resourceService.SetResourceWriter(resourceWriter);
			
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();
			
			PythonParser parser = new PythonParser();
			ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(499, 309);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter adapter = new AvalonEditDocumentAdapter(document, null);
					MockTextEditorOptions options = new MockTextEditorOptions();
					PythonDesignerGenerator generator = new PythonDesignerGenerator(options);
					generator.Merge(host, adapter, compilationUnit, serializationManager);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:31,代码来源:MergeFormTestFixture.cs


示例6: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				// Add combo box.
				ComboBox comboBox = (ComboBox)host.CreateComponent(typeof(ComboBox), "comboBox1");
				comboBox.TabIndex = 0;
				comboBox.Location = new Point(0, 0);
				comboBox.Size = new System.Drawing.Size(121, 21);
				comboBox.Items.Add("aaa");
				comboBox.Items.Add("bbb");
				comboBox.Items.Add("ccc");
				
				form.Controls.Add(comboBox);
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}	
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:30,代码来源:GenerateComboBoxItemsTestFixture.cs


示例7: WorkflowViewWrapper

        public WorkflowViewWrapper()
        {
            this.loader = new Loader();

            // Create a Workflow Design Surface
            this.surface = new DesignSurface();
            this.surface.BeginLoad(this.loader);

            // Get the Workflow Designer Host
            this.Host = this.surface.GetService(typeof(IDesignerHost)) as IDesignerHost;

            if (this.Host == null)
                return;

            // Create a Sequential Workflow by using the Workflow Designer Host
            SequentialWorkflow = (SequentialWorkflowActivity)Host.CreateComponent(typeof(SequentialWorkflowActivity));
            SequentialWorkflow.Name = "CustomOutlookWorkflow";

            // Create a Workflow View on the Workflow Design Surface
            this.workflowView = new WorkflowView(this.surface as IServiceProvider);

            // Add a message filter to the workflow view, to support panning
            MessageFilter filter = new MessageFilter(this.surface as IServiceProvider, this.workflowView);
            this.workflowView.AddDesignerMessageFilter(filter);

            // Activate the Workflow View
            this.Host.Activate();

            this.workflowView.Dock = DockStyle.Fill;
            this.Controls.Add(workflowView);
            this.Dock = DockStyle.Fill;
        }
开发者ID:ssickles,项目名称:archive,代码行数:32,代码来源:WorkflowViewWrapper.cs


示例8: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				// Add month calendar.
				MonthCalendar calendar = (MonthCalendar)host.CreateComponent(typeof(MonthCalendar), "monthCalendar1");
				calendar.TabIndex = 0;
				calendar.Location = new Point(0, 0);
				calendar.AddMonthlyBoldedDate(new DateTime(2009, 1, 2));
				calendar.AddMonthlyBoldedDate(new DateTime(0));
				
				form.Controls.Add(calendar);
								
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:28,代码来源:GenerateMonthCalendarTestFixture.cs


示例9: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				DataGridView dataGridView = (DataGridView)host.CreateComponent(typeof(DataGridView), "dataGridView1");
				dataGridView.Location = new Point(0, 0);
				dataGridView.Size = new Size(100, 100);
				form.Controls.Add(dataGridView);

				DataSet dataSet = (DataSet)host.CreateComponent(typeof(DataSet), "dataSet1");
				dataGridView.DataSource = dataSet;
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:27,代码来源:GenerateDataSetTestFixture.cs


示例10: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");

				// Add timer. This checks that the components Container is only created once in the
				// generated code.
				Timer timer = (Timer)host.CreateComponent(typeof(Timer), "timer1");
				
				// Add menu strip.
				ContextMenuStrip menuStrip = (ContextMenuStrip)host.CreateComponent(typeof(ContextMenuStrip), "contextMenuStrip1");
				
				// Set the context menu strip OwnerItem to simulate leaving the context menu
				// open in the designer before generating the source code. We do not want the
				// OwnerItem to be serialized.
				menuStrip.OwnerItem = new DerivedToolStripMenuItem();
				menuStrip.RightToLeft = RightToLeft.No;
				menuStripSize = menuStrip.Size;
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					RubyCodeDomSerializer serializer = new RubyCodeDomSerializer("    ");
					generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1);
				}
			}
		}	
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:33,代码来源:GenerateContextMenuStripTestFixture.cs


示例11: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				host.AddService(typeof(IEventBindingService), eventBindingService);
				
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				// Simulate giving a name to the Load event handler in the property grid.
				EventDescriptorCollection events = TypeDescriptor.GetEvents(form);
				EventDescriptor loadEvent = events.Find("Load", false);
				PropertyDescriptor loadEventProperty = eventBindingService.GetEventProperty(loadEvent);
				loadEventProperty.SetValue(form, "MainFormLoad");
				
				// Add a second event handler method.
				EventDescriptor closedEvent = events.Find("FormClosed", false);
				PropertyDescriptor closedEventProperty = eventBindingService.GetEventProperty(closedEvent);
				closedEventProperty.SetValue(form, "MainFormClosed");

				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:32,代码来源:GenerateEventHandlerFormTestFixture.cs


示例12: SetUpFixture

		public void SetUpFixture()
		{
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();

			RubyParser parser = new RubyParser();
			ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(UserControl))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				UserControl userControl = (UserControl)host.RootComponent;			
				userControl.ClientSize = new Size(489, 389);
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(userControl);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(userControl, "userControl1");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter docAdapter = new AvalonEditDocumentAdapter(document, null);
					RubyDesignerGenerator generator = new RubyDesignerGenerator(new MockTextEditorOptions());
					generator.Merge(host, docAdapter, compilationUnit, serializationManager);
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:26,代码来源:NoNewLineAfterInitializeComponentMethodTestFixture.cs


示例13: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				// Add table layout panel.
				TableLayoutPanel tableLayoutPanel1 = (TableLayoutPanel)host.CreateComponent(typeof(TableLayoutPanel), "tableLayoutPanel1");
				tableLayoutPanel1.ColumnCount = 2;
				tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
				tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F));
				tableLayoutPanel1.Location = new Point(0, 0);
				tableLayoutPanel1.RowCount = 2;
				tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
				tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F));
				tableLayoutPanel1.Size = new Size(200, 100);
				tableLayoutPanel1.TabIndex = 0;
								
				form.Controls.Add(tableLayoutPanel1);
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					RubyCodeDomSerializer serializer = new RubyCodeDomSerializer("    ");
					generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:33,代码来源:GenerateTableLayoutPanelTestFixture.cs


示例14: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				Form form = (Form)host.RootComponent;			
				form.ClientSize = new Size(284, 264);
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor descriptor = descriptors.Find("MinimumSize", false);
				descriptor.SetValue(form, new Size(100, 200));
				descriptor = descriptors.Find("AutoScrollMinSize", false);
				descriptor.SetValue(form, new Size(10, 20));
				descriptor = descriptors.Find("AutoScrollMargin", false);
				descriptor.SetValue(form, new Size(11, 22));
				descriptor = descriptors.Find("AutoScroll", false);
				descriptor.SetValue(form, false);
				
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:27,代码来源:GenerateMinSizeFormTestFixture.cs


示例15: SetUpFixture

		public void SetUpFixture()
		{
			resourceWriter = new MockResourceWriter();
			componentCreator = new MockComponentCreator();
			componentCreator.SetResourceWriter(resourceWriter);
			
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				host.AddService(typeof(IResourceService), componentCreator);
				
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				// Add ImageList.
				icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico");
				ImageList imageList = (ImageList)host.CreateComponent(typeof(ImageList), "imageList1");
				imageList.Images.Add("App.ico", icon);
				imageList.Images.Add("", icon);
				imageList.Images.Add("", icon);
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					RubyCodeDomSerializer serializer = new RubyCodeDomSerializer("    ");
					generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:32,代码来源:GenerateImageListResourceTestFixture.cs


示例16: SetUpFixture

		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				Form form = (Form)host.RootComponent;			
				form.ClientSize = new Size(284, 264);
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				Button button = (Button)host.CreateComponent(typeof(Button), "button1");
				button.Location = new Point(0, 0);
				button.Size = new Size(10, 10);
				button.Text = "button1";
				button.TabIndex = 0;
				button.UseCompatibleTextRendering = false;
				form.Controls.Add(button);

				RadioButton radioButton = (RadioButton)host.CreateComponent(typeof(RadioButton), "radioButton1");
				radioButton.Location = new Point(20, 0);
				radioButton.Size = new Size(10, 10);
				radioButton.Text = "radioButton1";
				radioButton.TabIndex = 1;
				radioButton.UseCompatibleTextRendering = false;
				form.Controls.Add(radioButton);
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					RubyCodeDomSerializer serializer = new RubyCodeDomSerializer("    ");
					generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:34,代码来源:GeneratedControlOrderingTestFixture.cs


示例17: SetUpFixture

		public void SetUpFixture()
		{
			resourceWriter = new MockResourceWriter();
			componentCreator = new MockComponentCreator();
			componentCreator.SetResourceWriter(resourceWriter);
			
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				host.AddService(typeof(IResourceService), componentCreator);
				
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				// Set bitmap as form background image.
				bitmap = new Bitmap(10, 10);
				form.BackgroundImage = bitmap;
				
				icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico");
				form.Icon = icon;
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:32,代码来源:GenerateFormResourcesTestFixture.cs


示例18: ToolStripTemplateNode

 public ToolStripTemplateNode(IComponent component, string text, Image image)
 {
     this.component = component;
     this.activeItem = component as ToolStripItem;
     this._designerHost = (IDesignerHost) component.Site.GetService(typeof(IDesignerHost));
     this._designer = this._designerHost.GetDesigner(component);
     this._designSurface = (DesignSurface) component.Site.GetService(typeof(DesignSurface));
     if (this._designSurface != null)
     {
         this._designSurface.Flushed += new EventHandler(this.OnLoaderFlushed);
     }
     if (!isScalingInitialized)
     {
         if (System.Windows.Forms.DpiHelper.IsScalingRequired)
         {
             TOOLSTRIP_TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x16);
             TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x13);
             TOOLSTRIP_TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x5c);
             TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x1f);
             TEMPLATE_HOTREGION_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(9);
             MINITOOLSTRIP_DROPDOWN_BUTTON_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(11);
             MINITOOLSTRIP_TEXTBOX_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(90);
         }
         isScalingInitialized = true;
     }
     this.SetupNewEditNode(this, text, image, component);
     this.commands = new MenuCommand[] {
         new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveRight), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Delete), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Cut), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Copy), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeRight), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthIncrease),
         new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightDecrease)
      };
     this.addCommands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Undo), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Redo) };
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:32,代码来源:ToolStripTemplateNode.cs


示例19: LoadDesigner

		void LoadDesigner (Stream stream) {
			LoggingService.Info("ReportDesigner LoadDesigner_Start");
			panel = CreatePanel();
			defaultServiceContainer = CreateAndInitServiceContainer();
			
			LoggingService.Info("Create DesignSurface and add event's");
			designSurface = CreateDesignSurface(defaultServiceContainer);
			SetDesignerEvents();
			
			var ambientProperties = new AmbientProperties();
			defaultServiceContainer.AddService(typeof(AmbientProperties), ambientProperties);
			
			defaultServiceContainer.AddService(typeof(ITypeResolutionService), new TypeResolutionService());
			defaultServiceContainer.AddService(typeof(ITypeDiscoveryService),new TypeDiscoveryService());
			                                   
			defaultServiceContainer.AddService(typeof(IMenuCommandService),
				new ICSharpCode.Reporting.Addin.Services.MenuCommandService(panel, designSurface));
			
			defaultServiceContainer.AddService(typeof(MemberRelationshipService),new DefaultMemberRelationshipService());
			defaultServiceContainer.AddService(typeof(OpenedFile),base.PrimaryFile);
			
			LoggingService.Info("Load DesignerOptionService");
			var designerOptionService = CreateDesignerOptions();
			defaultServiceContainer.AddService( typeof( DesignerOptionService ), designerOptionService );
			
			LoggingService.Info("Create ReportDesignerLoader"); 
			
			loader = new ReportDesignerLoader(generator, stream);
			designSurface.BeginLoad(this.loader);
			if (!designSurface.IsLoaded) {
				//				throw new FormsDesignerLoadException(FormatLoadErrors(designSurface));
				LoggingService.Error("designer not loaded");
			}
			//-------------
			
			defaultServiceContainer.AddService(typeof(INameCreationService),new NameCreationService());
			                                   
			
			var selectionService = (ISelectionService)this.designSurface.GetService(typeof(ISelectionService));
			selectionService.SelectionChanged  += SelectionChangedHandler;
			/*
			undoEngine = new ReportDesignerUndoEngine(Host);
			*/
			var componentChangeService = (IComponentChangeService)this.designSurface.GetService(typeof(IComponentChangeService));
			
			
			componentChangeService.ComponentChanged += OnComponentChanged;
			componentChangeService.ComponentAdded   += OnComponentListChanged;
			componentChangeService.ComponentRemoved += OnComponentListChanged;
			componentChangeService.ComponentRename  += OnComponentListChanged;
			
			this.Host.TransactionClosed += TransactionClose;
		
			UpdatePropertyPad();
	
			hasUnmergedChanges = false;
			
			LoggingService.Info("ReportDesigner LoadDesigner_End");
		}	
开发者ID:krunalc,项目名称:SharpDevelop,代码行数:59,代码来源:DesignerView.cs


示例20: DesignSurfaceEventArgs

 public DesignSurfaceEventArgs(DesignSurface surface)
 {
     if (surface == null)
     {
         throw new ArgumentNullException("surface");
     }
     this._surface = surface;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DesignSurfaceEventArgs.cs



注:本文中的System.ComponentModel.Design.DesignSurface类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Design.DesignerActionItemCollection类代码示例发布时间:2022-05-26
下一篇:
C# Design.ComponentEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap