VisionCore ICE Architecture
Previous pagePrevious Print this TopicPrint

How to Hide and Move Controls on any Form

Using the ICE Architecture in VisionCore, you are able to easily hide and move Controls to customize a form the way you want. To do this, you will need a copy of Visual Studio 2005 and VisionCore.  Here is an example of how to customize the Customer Form.

 

Here is a how the default Customer form in VisionCore looks

 

Here is how the Customer form will look after you are finished with this exercise

(Notice several tabs and controls are hidden and rearranged)

 

 

Creating a customized Customer form
 

1)Open Visual Studio 2005 and create a new Windows Application project with the name HideAndMoveControls.
 

 

2)In the Solution Explorer window double click on My Project
 

 
3)In the References tab add the following VisionCore and DevExpress References.
 

 
4)Add a new Windows Form that you will use for customizing the Customer Form.  Name this new form CustomCustomer.vb.
 

 

 
5)In the Solution Explorer make sure you have Show All Files enabled.
 

 
6)Double click CustomCustomer.Designer.vb to open the code window.  Highlight the code past the Inherits line and delete it.
 

 
7)Inherit the VisionCore Customer form by replacing the original Inherits code with ComtechSolutions.VisionCore.ContactManager.Forms.Sales.Customer.
 

 
8)In the Solution Explorer double click CustomCustomer.vb and after several seconds you should see the default VisionCore customer form in design view.  The code you changed in above step replaces the default inherited Windows Form with the VisionCore Customer form.
 

 
9)Now you can hide any tab or control by simply changing a property for the selected control.  Click the Tab control on the Customer form to select it or in the Property window select xtabCustomer  DevExpress.XtraTab.xtraTabControl.  Then inside the Properties window change the SelectedTabPage property to xpgeData to select the Data tab.
 

 
10)Scroll down to the PageVisible property and change it to False to hide the Data tab.
 

 
11)You can repeat the steps above for any other tabs you wish to hide.  In this example we will also hide the Documents, Activity, Notes, Contacts, Pricing, Analysis, Email, Rewards and Web tabs.
 
12)To hide form controls (text boxes, combo boxes, labels, etc) simply select the control you want to hide using the mouse.  For example, to hide the Salutation combo box click on the General tab to see the controls in that tab and click on the Salutation combo box to highlight it.  In the Properties window change the Visible property to False.
 

 
13)You can repeat the steps above to hide any other controls such as Attention, Department, Industry, Alt Phone, Currency, PO Required, Show Notes, and Verify.
 
14)If you want to move a control from one tab to another you need to do this in the code window.  For example, to move the Notes Field in the Detail tab of Customer form to the General tab, apply the following Code in the InitializeComponent of the Designer Code. The added code is best placed on the line before the execution of the Me.ResumeLayout(False) Event.
 

 
This will require 2 lines of code.  The first line of code is used to remove the Notes Field (memGeneralNotes) from the Notes Detail tab (xpgeDetailNotes).
Me.xpgeDetailNotes.Controls.Remove(Me.memGeneralNotes)

The second line of code is used to add the Notes Field to the General Tab (xpgeGeneral).

Me.xpgeGeneral.Controls.Add(Me.memGeneralNotes)
 

 
Before moving the Notes control
 

 
 
After moving the Notes control
 

 

15)To set the Tabbing Order, you need to enable the Layout Toolbar in Visual Studio 2005.  Then select a Particular Tab and Click the small Tab Order Button on the upper part of the Visual Studio Window.
 

 
The Customer form will now display numbers next to each control which you can click with your mouse to select the order you want the cursor to tab between them.
 

 
16)You can move or size any of the controls simply by selecting them with your mouse.  Then drag and drop or size them any way you want.
 
17)You can hide selected Toolbar Buttons through the forms code.  You need to set the visibility of the Menu Buttons in the Shown Event of your Customized Form.  The code below is used to hide the Codes and Types menu buttons on the Customer form.
 

 
 

 

 
 
 

 


Page url: http://www.comtechsolutions.com/csdemos/ice_sample/index.html?how_to_hide_and_move_controls.htm