Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / October 2007

Tip: Looking for answers? Try searching our database.

Using behavior service in a custom root designer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Husselmann - 22 May 2006 01:08 GMT
Hi everyone,

I'm currently writing a custom root designer for a report designer running
inside VS.  While learning about the rest of the designer framework, I
stumbled upon the Windows Forms way of doing smart tags, resize handles and
the like - the Behavior Service.

Unfortunately it seems the behavior service was only meant to work with
Windows Forms; not with any other designers.  This is manifested in the
VS.NET designer host not even giving me a reference when I do a
GetService(typeof(BehaviorService)).

My question is whether there is any way to make the behavior service (and
all the other good stuff like adorners, glyphs and behaviors) work with a
custom designer that is not winforms?

Any hints will be greatly appreciated.  At this stage I have two options:
either duplicate the entire behavior service framework as it stands in .NET,
or fake a windows forms designer to design my reports in (which is quite
kludgy in my opinion).

Regards
David Husselmann
David Husselmann - 23 May 2006 06:06 GMT
Well, I got around the problem by subclassing the DocumentDesigner class and
staying inside the windows forms architecture - it seems that it's simply
impossible to reuse the behavior mechanisms outside this framework.

Regards,
David Husselmann
N!ls - 26 Oct 2007 12:47 GMT
As per my uderstanding of the DesignTimeArch, you can have a BehaviourService for any Designer (even if its not of typeof FormDesigner).

In your customDesigner class while initializing u need to add add adorners and glyphs.
That's all...
See this sample code:

class myControlDesigner: ControlDesigner
{
  public override void Initialize(IComponent component)
  {
           base.Initialize(component);
           adorner = new Adorner();
           adorner.Glyphs.Add(new MyCustomGlyph(BehaviorService, this.Control));
           this.BehaviorService.Adorners.Add(adorner);    
  }
}
. and you are done... It will do the functionality mentioned in your MyCustomGlyph class on whichever control this Designer applied to.
Ping me back for any trouble...
r[.]nilesh[@]gmail[.]co

From http://www.developmentnow.com/g/32_2006_5_0_0_759183/Using-behavior-service-in-a
-custom-root-designer.ht


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.