• Using multiple layouts [Janus GridEX WinForms Control v3.5 for .NET]

    This tutorial is intended to show you how to use multiple layouts in a Schedule control.



    Follow these steps to create multiple layouts at design time:



    1) Create a new Visual Basic or C# project using "Windows Application" Template



    2) Add a Schedule control to Form1.



    3) In the Designer window of the Schedule control, modify the layout as you want, changing the view, dates, owner, etc.



    4) Select the "Layout Manager" Tab. A List View will appear with a "Draft Layout" in it. The Draft Layout contains the changes you just made to the Schedule but it is not saved as a layout in the Layouts collection.



    5) Click on "Save Current Layout" button and set the name "MonthView" to the draft layout.



    6) Once the "MonthView" layout has been saved, add a new layout for products. To add a new layout click on the "New Layout" button and Layout1 will appear.



    7) Change the name of Layout1 for "WeekView".



    8) Double click in the "WeekView" layout to select this empty layout. This action will set the "WeekView" layout you just created as the CurrentLayout in the Schedule control and all the changes you do will affect this layout only.



    9) Change any properties in the new layout like view or owners.



    10) Select "Layout Manager" Tab again.



    11) Click in the "New Layout" button and Layout1 will appear.



    12) Change the name of Layout1 for "WorkWeek".



    13) Double click in the "WorkWeek" layout to select this empty layout. This action will set the "WorkWeek" layout you just created as the CurrentLayout in the Schedule control and all the changes you do will affect this layout only.



    14) Change any properties in the new layout like view or owners.



    15) You have finished adding layouts for the tutorial. To change a property in any of the layouts you have in the Layouts collection, select the layout from Layouts combo in the tool bar of the Schedule designer.



    16) To select a layout at run time use the CurrentLayout property of the Schedule class. In the tutorial we are going to do that using buttons. So, add a button "Button1" and

    change its Text property to "Show MonthView". In the Click event for this button write the following code that set the "MonthView" layout as the current layout in the Schedule control:



    In VB:



    If Schedule1.CurrentLayout Is Nothing OrElse Schedule1.CurrentLayout.Key <> "MonthView" Then

    Schedule1.CurrentLayout = Schedule1.Layouts("MonthView")

    End If



    In C#



    if (schedule1.CurrentLayout==null || schedule1.CurrentLayout.Key!="MonthView")

    {

    schedule1.CurrentLayout = schedule1.Layouts["MonthView"];

    }



    17) Add a buttons to show "WeekView" and "WorkWeek" layouts with similar code in the Click event for those buttons.





    18) Run the project.

    Source Of Information : Janus v3.5 Help Files for VS 2008


0 comments:

Leave a Reply