Quick Guide - Implementation
Quick Guide - Implementation
Contents
1. Introduction .........................................................................................................................1
1.1. Documentation.............................................................................................................1
1.2. Comments ....................................................................................................................2
1.3. Demonstration .............................................................................................................2
2. How to implement the project in my existing project? ........................................................3
3. How to use the custom forms? ............................................................................................4
3.1. Create main form .........................................................................................................4
3.2. Create child forms ........................................................................................................6
3.3. How to change the properties? ....................................................................................7
3.4. How to change the width of the child form? ................................................................7
4. How to use custom controls? ...............................................................................................8
4.1. Example 1- Design the main form ................................................................................9
4.2. Example 2- Design a child form ..................................................................................11
5. How to modify the project components?...........................................................................12
1. Introduction
Hello colleague , RJ Code greets you. First of all, I want to thank you for acquiring the project,
I really hope this adds a little more to your skills and that you gain new knowledge.
Well, the project itself is NOT a template. The main objective of the project is to teach how to
make custom forms and controls to build modern and elegant user interfaces, which is why I
categorize it as a written tutorial. There are 3 help components for this: the documentation, the
comments and the demo.
1.1. Documentation
It should be mentioned that it does not refer to the documentation of the life cycle of a software,
but rather it is a simple documentation for the end user (For you).
The documentation describes each of the components of the project, this facilitates the
interaction with the source code, so that you can know the functionality of each of the fields,
properties and methods, or be able to quickly locate a class, method or property in a context
determined, thus being able to modify or add new functions or appearance properties.
The trick is to look at the class diagrams, because with this you will already know from which
class a control or form inherits, as well as knowing which fields, properties and methods it
implements. For example, suppose we have the dropdown menu control (RJDropdownMenu):
1
1.2. Comments
Comments describe or specify the function of a field, property, method, or class. As seen in
the following screenshot of the DropdownMenuColors class.
Therefore, it is not so necessary to read the description of the fields, properties and methods
in the documentation, as they are often similar.
1.3. Demonstration
The demo basically consists of all the forms already
designed in the project that test and demonstrate how to
use the controls and custom forms (Most of these forms
group and describe a specific control).
2
2. How to implement the project in my existing project?
You can easily add the RJ Code Moden UI-M1 project to your existing project by following the
steps below:
1. Right click on the solution or solution folder of your Visual Studio project -> Hover
over the Add option -> Select the Existing Project option.
2. We locate the RJCodeUI_M1.csproj file in the downloaded package -> We select the
RJCodeUI_M1.csproj file -> Finally we click on Open.
3. You can now use and work on the project RJ Code Moden UI-M1 (Don't forget to set
the project as the startup project).
RECOMMENDATION:
It is not possible to update the appearance of
your existing forms and controls with the
RJCodeUI_M1 project. Therefore, I recommend
redoing the entire User Interface (Presentation)
layer of your project in the RJCodeUI_M1
project. As explained later.
3
3. How to use the custom forms?
As stated above, you need to completely redo the User Interface layer of your existing project
in the RJCodeUI_M1 project that you added. I do not recommend editing the project's test and
demo forms (This includes LoginForm, MainForm and all forms in the TestAndDemo folder), as
these help you understand and interact with the source code. Therefore, I recommend creating
new forms.
To use custom forms base (RJBaseForm, RJMainForm, and RJChildForm), just inherit one of
them, as shown below.
2. Put a name for the form (In my case Example Main Form) and click on Add.
4
3. Go to the form code added (Right click-> View code).
5. Lastly, go to the form designer and you will have the applied appearance of the main
form as shown below.
5
3.2. Create child forms
To create a child form inherit the RJChildForm class, following the steps below:
1. Add a new Windows Form and go to the form code as before (Step 1-3).
3. Lastly, go to the form designer and you will have the appearance applied.
6
3.3. How to change the properties?
Due to the fact that the base forms RJMainForm and RJChildForm already have controls added
for appearance, it is not possible to directly select the form and change the properties. To be
able to do it you have to do it in the following way:
1. Right click on the form or the designer space-> Click on Select 'Form name'.
2. You can now change the properties of the form from the toolbox.
However, in many cases we do not need to open the child form on the desktop of the main
form and we want a different size.
7
1. To change the width of the form, go to the form properties and set the
_DesktopPanelSize property to FALSE.
2. Now you can change the width of the form at will (If you only want to change the
height of the form, it is not necessary (nor do I recommend it) to perform these steps).
8
4.1. Example 1- Design the main form
It is worth mentioning that in the project there are specific controls that you can add to the
main form, these are:
RJMenuButton (It is optimized only to be used in the side menu of the main form).
RJMenuIcon (By default it is optimized to be used in the title bar of the main form, you
can change that by setting the BackIcon property to true).
RJDropdownMenu (Drop-down menu that you can associate with the above controls:
RJMenuButton and RJMenuIcon, no need to code to display).
RJLabel(You can set the Style property to BarCaption or BarText and use it in the title
bar of the main form.)
You can add other controls, for example RJCircularPictureBox to display the photo of the
logged in user in the application.
For now the control behaves like a normal menu button, you can turn it into a dropdown menu
button, by adding the RJDropdownMenu control and associating it with the menu button, as
demonstrated below:
9
Add a dropdown menu (RJDropdownMenu)
1) Drag control RJDropdownMenu from the toolbox to the form and add the elements
and sub-elements you want.
10
3) Result.
You may be wondering, how to use the drop down menu in child forms. Well, I remind you
again that the RJDropdownMenu control inherits from the ContextMenuStrip control,
therefore use the Show () method of the control in any event of any control, as you normally
would with the ContextMenuStrip control. For example in the Click event of the button
rjBotton1.
11
This is the demonstration of the new Show () method that makes it easy to quickly configure
the position of the drop-down menu. However, you can still use the other original Show ()
methods of the ContextMenuStrip control.
Result:
12
1) To make changes, open the control or form code: Right click on the class-> Select View
Code.
Every time you make changes to controls or forms, you must Compile / Build the project to
apply the changes at design time.
Well that's it, I hope it has helped you with any of your doubts.
13