简体   繁体   English

如何创建自己的表单设计器?

[英]How can I create my own form designer?

I'm starting my first C# project, and I want to make a "form designer" (like the one in VS). 我正在开始我的第一个C#项目,我想创建一个“表单设计器”(就像VS中的那个)。

The idea is, there will be a visual form designer with a limited toolbox, which will generate Python code (later more) to create the same form. 我们的想法是,将有一个带有限工具箱的可视化表单设计器,它将生成Python代码(后来更多)以创建相同的表单。

Problem is, I have no idea how to even get started. 问题是,我不知道如何开始。 First of all, I have the form designer in VS: how do I make a "form-within-a-form?" 首先,我在VS中拥有表单设计器:如何制作“表单内的表单”?

Next... I have no idea how complicated this is going to be. 接下来......我不知道这会有多复杂。 I suppose I could just make little boxes appear beside each control created on the form when it is clicked, for resizing, and make a textbox appear on it when double clicked or something, to change the text in it... Things like this. 我想我可以在单击表单时在表单上创建的每个控件旁边显示小框,用于调整大小,并在双击或其他内容时使文本框显示在其上,以更改其中的文本......这样的事情。

So another thing I would like to know is this: 所以我想知道的另一件事是:
I do have programming experience in C and C++, I've done PHP for a number of years and am starting with Python as of recently. 我确实有C和C ++的编程经验,我已经做了很多年的PHP,并且最近开始使用Python。 I've generated forms dynamically in VB6. 我在VB6中动态生成了表单。 Given this experience, am I in way over my head with this project? 鉴于这种经历,我对这个项目的态度是什么?

this looks like a really good place to start. 看起来是一个非常好的起点。 It has a pretty good example to get you started. 它有一个很好的例子来帮助你入门。 You can even download his source (registration required). 你甚至可以下载他的来源(需要注册)。

It sounds like you're aware it's non-trivial for a C# first-timer. 听起来你知道这对C#first-timer来说并不重要。 If you keep it pretty simple, it sounds like you're heading in the right direction (although a web-based form designer might be easier). 如果你保持它非常简单,听起来你正朝着正确的方向前进(尽管基于网络的表单设计师可能更容易)。

SharpDevelop would be an example of a full-featured IDE that can be re-purposed, but that's way over the top. SharpDevelop将是一个功能齐全的IDE的例子,可以重新定位,但这是最重要的。

Good luck! 祝好运!

For most people starting out in C#, this project would be too much. 对于大多数从C#开始的人来说,这个项目太多了。 With your VB6 background, you may be able to pull it off, though. 有了你的VB6背景,你可以把它拉下来。

Here's a hint: the Visual Studio Windows Forms designer draws controls on its surface - by asking the controls to draw themselves. 这是一个提示:Visual Studio Windows窗体设计器在其表面绘制控件 - 通过要求控件绘制自己。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM