Try to write the Form Designer (1) Start

Source: Internet
Author: User
Tags sharpdevelop

Eddie SheffieldAs the first discovery outside of Microsoft Form Designer Really amazing. .
A few years later Find some information about Form Designer, although not many or comprehensive, but after all there are still some. My materials are:
1 ,《 Dissecting a C # Application Inside sharpdevelop Chinese version 16 Chapter Special lecture Form Designer;
2 , Windowsforms.net A small example downloaded from Sharpdevelop Get the idea;
3 , Winres This tool, along Vs2005/. Net framework2.0 A resource localization tool. You can decompile it to see its source code.

Comparison 1 , 2 And 3, I found that both of them are implemented. Form Designer But the design logic is quite different. , Apparently Winres The method should be concise. The reason is: . NET 2.0 The function of the designer is enhanced and the calling method of the designer is simplified. Due to time constraints, write a fully functional Form The designer may be difficult. What I want to do is to perform some tests and write a File Based on. NET 2.0. Form The basic method of the designer.


I want to first write a small example that does not have any function but can see the designer style to test. The design functions will be added later, such as adding and deleting controls, setting properties, and saving files.
The procedure is as follows:
In Vs2005 Medium ( The version I used is RC) Create C # windowsform Solution , Add to project reference System. Design,  In Form1 OfCodeAdd

Using System. componentmodel. design;

Double-clickForm,InFormOfLoadWrite the following code in the event:

Designsurface Surface =   New Designsurface ();
Surface. beginload ( Typeof (Form ));
Control View = (Control) surface. view;
View. Dock = Dockstyle. Fill;
This . Controls. Add (View );

Then run the scheme. This is the simplest and useless Form Designer, but at least we can adjust the designedFormSize

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.