Windows Forms Designer Generated Code

yousuf42

Well-known member
Joined
Feb 12, 2006
Messages
101
Programming Experience
1-3
Dear vis781,

I don't understand the following phrase. Can you give more explaination please.It will help us more.

Increase your winforms load times. Open the windows forms generated bit and delete...

Control.size = new ...
Control.location = new point...

Instead use ..

Control.setbounds()// 9-12% speed increase.
 
Last edited by a moderator:
Yousuf42. Let me try to explain it. When you add controls from toolbox the ide writes all the code for the placement/size etc for that control in the...

Windows Forms Designer Generated Code Region.

Now i know that we are not supposed to mess with this, but that doesn't mean to say you cant. The ide sets two propeties for the location and size of the controls..

Control.location
Control.size

You can make this more effiecient if you delete these two line and insted use the ...

ControlSetbounds method. Another thing, notice that the ide uses the

me.controls.add(control) to add the controls to it's control collection. You can improve performance further by using the parent property.

Me.control.parent(me)
 
This is similar to that question vis, I made a few custom controls in a separate project and built them as a dll. Originally the windows form generator (ide? i dont know what ide stands for) was setting say the BackColor for the control. So instead I coded into my control the BackColor that it will always be, therefore removing 10 lines of Me.egControl.BackColor = egColor from my actual application.

Does this sought of stuff speed up the application? It might be obvious but I'm just thinking that maybe it is slower because it has to load the values externally. But then again it is only 1 line of code compared to however many.
 
So... it doesn't really matter if it loads them from an external library or from within the form generator, no great advantage for either?


What does IDE stand for if you don't mind.
 
Sure i don't mind. Take a look at the article below (btw, IDE is exactly the thing that you see ahead of you ... VS.NET is an IDE):)

From Wikipedia, the free encyclopedia


Jump to: navigation, search
An integrated development environment (IDE), also known as integrated design environment and integrated debugging environment, is a type of computer software that assists computer programmers to develop software.
IDEs normally consist of a source code editor, a compiler and/or interpreter, build-automation tools, and (usually) a debugger. Sometimes a version control system and various tools to simplify the construction of a GUI are integrated as well. Many modern IDEs also integrate a class browser, an object inspector and a class hierarchy diagram, for use with object oriented software development. Although some multiple-language IDEs are in use, such as the Eclipse IDE, NetBeans or Microsoft Visual Studio, typically an IDE is devoted to a specific programming language, as in the Visual Basic IDE.
 
As this enquiry was totally off topic from GDI+ "irregular shaped forms" I made a split to this VS General "Windows Forms Designer Generated Code".
 
That's all very well vis but that code is regenerated every time you change any thing in the designer. If you change the auto-generated code to use SetBounds and then change some property in the designer all your manual changes are wiped out as the IDE rewrites the entire auto-generated section.
 
Back
Top