Runtime Editable Control - The Code Project -...
来源:百度文库 编辑:神马文学网 时间:2024/06/30 21:58:43
3,672,741 members and growing! 9,311 now online.txjchen |My Settings |My Bookmarks |My Articles |Sign out
HomeMFC/C++C#ASP.NET.NETVB.NETAll Topics Help!ArticlesMessage BoardsStoreFrontLounge
All Topics,C#,.NET >>C# Controls >>General
Runtime Editable Control
ByMiljenko Cvjetko.
Inheritable (super class) UserForm that enables runtime moving of controls (editing).
C#
Windows, .NET (.NET 1.0, .NET 1.1, .NET 2.0)
Win32, VS (VS2005), WinForms
Dev
Posted: 6 Dec 2004
Views: 23,485
Announcements
Sitemap |Add to IE Search
9 votes for this article.
Popularity: 3.82. Rating: 4 out of 5.
You are signed up for one or morenewsletters but unfortunately we are unable to send you emails. Please clickhere to have an email sent that will allow us to confirm your email address.
Download demo exe - 7.26 KbDownload source + project - 9.23 Kb
Note
This is a simple example developed with VS.NET 2005 Beta 1 codename Whidbey. So, project and solution are not usable with previous versions, while code should run in previous versions without problems.
Introduction and background
Faced with and, as the matter of fact, astonished by user requirement specification for one project, where one of the requirements were that controls (some or all) on the form must be movable (runtime editable in narrower sense).
So after "brainstorming", the decision was made to make a framework to implement a UserControl for runtime movable controls called EditableControl. EditableControl should be super class for any custom made control with arbitrary number and type of controls.
The idea is to allow users to adjust his/hers look and feel through positions of controls, whereby business logic behind the control stays the same (actually, user is not able to change anything except presentation).
The control should be reusable, so it inherits from UserControl, and any other business logic control that inherits from EditableControl will be editable too.
Original control
Control after runtime "editing"
Design
EditableControl has four member variables for layout editing (moving): points for the origin of the moved control, destination, reference to control being moved, and an ArrayList of controls that can be moved (for other controls).
///
To accomplish drag&drop of the control, three mouse events must be handled by containing (hosting control, parent) as well as by every contained (child) control. Those events are: MouseDown to detect selection of the control, MouseMove to animate movement, and MouseUp to detect destination point. Actually, only two events are needed: MouseDown and MouseUp, but animation can‘t hurt. Initialization hooks events to all contained child controls.
///
And events which are handled for each movable control and do not interfere with control‘s behavior (events and logic):
///
To make any control (let‘s say SomeUserControl) runtime editable, inherit from EditableControl.
///
Resizable runtime controls Keys to control selection of moving control (Alt, Ctrl)
History
First version by moljac++ - 2004.12.03.
Miljenko Cvjetko
Clickhere to view Miljenko Cvjetko‘s online profile.
Other popular C# Controls articles:
Themed Windows XP style Explorer Bar A fully customizable Windows XP style Explorer Bar that supports Windows XP themes and animated expand/collapse with transparency.
XPTable - .NET ListView meets Java‘s JTable A fully customisable ListView style control based on Java‘s JTable.
SourceGrid - Open Source C# Grid Control SourceGrid is a free open source grid control. Supports virtual grid, custom cells and editors, advanced formatting options and many others features
TaskbarNotifier, a skinnable MSN Messenger-like popup in C# and now in VB.NET too The TaskbarNotifier class allows to display an MSN Messenger-like animated popup with a skinned background
[Top] Rate this Article for us! PoorExcellent
View Normal (slow) Preview (slow) Message View Topic View Thread View Expanded (Supporters only) Per page 10 25 50
Subject Author Date
I am really amazed with you code, but while I tried to implement the code in my application it is not applying, and I can not run the sample as I do not have dotnet 2.0 installed with me.
Can you please send me a dotnet 1.1 version source code?
Thanks in advance.
Regards
Nhilesh Baua
[Reply |Email |View Thread |Get Link] Rate this message:12345 (out of 5)
Report asSpam orAbuse
http://msdn.microsoft.com/msdnmag/issues/04/12/CustomFormsDesigner/default.aspx[^]
This article discusses:
Design-time environment fundamentals
Forms designer architecture
The implementation of the forms designer in Visual Studio .NET
Services you need to implement to write a forms designer for your own application
Code download available at:
http://download.microsoft.com/download/d/3/1/d31fff33-fd97-488f-9bbd-4b7402905716/CustomFormsDesigner.exe[^]
And a commercial componment in beta stage at the moment.
seems to be the only runtime form designer component available as for the moment.
Unfortunately commercial.
Form Designer .NET
Runtime Form Designer Control
for C#, VB.NET and Delphi 8
version 1.0 beta 2, November 29, 2004
Form Designer .NET allows you move and resize any control on your .NET application form at runtime. You need not prepare your form to use Form Designer .NET. Just drop Form Designer .NET control onto any form, assign the DesignedForm property, set Active property to true and enjoy!
http://www.greatis.com/dotnet/formdes/[^]
Demo (Beta2):
http://www.greatis.com/fdnetdemo.zip[^]
[Reply |Email |View Thread |Get Link] Rate this message:12345 (out of 5)
Report asSpam orAbuse
http://www.codeproject.com/cs/miscctrl/CSPickBoxSample1.asp?target=pickbox
[Reply |Email |View Thread |Get Link] Rate this message:12345 (out of 5)
Report asSpam orAbuse
http://www.windowsforms.com/Forums/ShowPost.aspx?tabIndex=1&tabId=41&PostID=12082#17945[^]
wdyl
[Reply |Email |View Thread |Get Link] Rate this message:12345 (out of 5)
Report asSpam orAbuse
Last Visit: 11:20 Tuesday 2nd January, 2007 First Prev Next
Updated: 6 Dec 2004 Article content copyright Miljenko Cvjetko, 2004
everything else Copyright ©CodeProject, 1999-2006.
Web17 |Advertise on The Code Project |Privacy
The Ultimate Toolbox •ASP Alliance •Developer Fusion •Developersdex •DevGuru •Programmers Heaven •Planet Source Code •Tek-Tips Forums •
Help!
Articles
Message Boards
StoreFront
Lounge
What is ‘The Code Project‘?
General FAQ
Post a Question
Site Directory
About Us
Latest
Most Popular
Search
Site Directory
Submit an Article
Update an Article
Article Competition
Windows Vista
Visual C++
ATL / WTL / STL
COM
C++/CLI
C#
ASP.NET
VB.NET
Web Development
.NET Framework
Mobile Development
SQL / ADO / ADO.NET
XML / XSL
OS / SysAdmin
Work Issues
Article Requests
Collaboration
General Discussions
Hardware
Algorithms / Math
Design and Architecture
Subtle Bugs
Suggestions
The Soapbox