Creating Handheld Form

You have to customize an existing screen to do what you need it to, or take a UD form and force it to form and fit the handheld style.

Here is my base code I use to do that

// Add these usings
using Infragistics.Win.UltraWinToolbars;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDock;
using Infragistics.Win.UltraWinStatusBar;
using System.Reflection;
 
public class Script
{
    public void InitializeCustomCode()
    {
        // You need to add a replacement closing button
        this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
    }
 
    public void DestroyCustomCode()
    {
        this.btnClose.Click -= new System.EventHandler(this.btnClose_Click);
    }
 
    private void MoveWIPForm_Load(object sender, EventArgs args)
    {
        // Add Event Handler Code        
        RemoveToolbars();
        RemoveStatusBar();
        ReconfigureDocks();
 
        oTrans.EpiBaseForm.ControlBox = false;
        oTrans.EpiBaseForm.MaximizeBox = false;
        oTrans.EpiBaseForm.MinimizeBox = false;
        oTrans.EpiBaseForm.CancelButton = btnClose;
        oTrans.EpiBaseForm.Location = new System.Drawing.Point(0,0); 
        oTrans.EpiBaseForm.FormBorderStyle = FormBorderStyle.None;
 
        // 242 by 263 is the HH form size. Comment this out to move the base controls where you need them first
        oTrans.EpiBaseForm.Size = new System.Drawing.Size(242, 263);
    }   
 
    private void RemoveToolbars()
    {
        foreach(UltraToolbar tl in oTrans.EpiBaseForm.MainToolManager.Toolbars)
        {
            tl.Visible = false;
        }        
    }
 
    private void RemoveStatusBar()
    {
        UltraStatusBar ultraStatusBar1 = (UltraStatusBar)oTrans.StatusPanel.UltraStatusBar;
        ultraStatusBar1.Visible = false;
    }
 
    private void ReconfigureDocks()
    {    
        // Remove docking area containing EpiTreeView
        object etv1 = oTrans.EpiBaseForm.GetType().InvokeMember("epiTreeViewPanel1", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic, null, oTrans.EpiBaseForm, null);
        EpiTreeViewPanel epiTreeViewPanel1 = (EpiTreeViewPanel)etv1;
        ((DockableWindow)epiTreeViewPanel1.Parent).Pane.Close();    
 
        // Remove docking bars
        object udm = oTrans.EpiBaseForm.GetType().InvokeMember("baseDockManager", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic, null, oTrans.EpiBaseForm, null);
        UltraDockManager baseDockManager = (UltraDockManager)udm;
        foreach(var dockArea in baseDockManager.DockAreas)
        {
            dockArea.Settings.ShowCaption = Infragistics.Win.DefaultableBoolean.False;
            foreach(var pane in dockArea.Panes)
            {
                pane.Settings.ShowCaption = Infragistics.Win.DefaultableBoolean.False;
            }
        }       
    }
 
    private void btnClose_Click(object sender, System.EventArgs args)
    {
        oTrans.EpiBaseForm.Close();
    }
}
3 Likes