Options

RTC 2013 Client Add-in Label Control

rkarnoshrkarnosh Member Posts: 2
edited 2013-10-02 in NAV Three Tier
I am attempting to create a Client ControlAddin that will display a Page field as a label with different Fonts. I would like more options than the current Style Property gives me.

I have created the add-in, but the sizing of it does not seem to work. When I apply the ApplySize function to the control, it errors with no information.

When I comment out the ApplySize function, the control load into the client, but size and display are very strange.

Anyone ever attempt this? What am I missing on the Sizing of my control

Control Add-in Source:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Dynamics.Framework.UI.Extensibility;
using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;
using System.Windows.Forms;
using System.Drawing;

namespace AddInSamples
{
#region "Custom.NAV.FontLabel"
[ControlAddInExport("Custom.NAV.FontLabel")]
public class FontLabelAddin : StringControlAddInBase
{
protected override void OnInitialize()
{
base.OnInitialize();

this.ApplySize(new DisplaySize(101, 600, 1000), new DisplaySize(10, 20, 200));
}

/// Defines the Label control.
protected override Control CreateControl()
{
Label myFontLabel = new Label();
myFontLabel.Font = new Font("Tahoma", 12, FontStyle.Bold);
myFontLabel.Dock = DockStyle.Fill;
myFontLabel.BackColor = Color.White;
myFontLabel.DoubleClick += myFontLabel_DoubleClick;
return myFontLabel;
}
/// Raises an event when the user double-clicks the label.
private void myFontLabel_DoubleClick(object sender, EventArgs e)
{
int index = 1;
string data = "Raised A Double Click Event";
this.RaiseControlAddInEvent(index, data);

}
}
#endregion
}

Comments

  • Options
    wakestarwakestar Member Posts: 207
    Hi there

    I used ApplySize like this and it seems to work:
    public class MyAddIn: WinFormsControlAddInBase, IObjectControlAddInDefinition 
    {
            protected override Control CreateControl()
            {                        
                AddInPanel = new Panel();                         
               <... code removed ...> 
                this.ApplySize(new DisplaySize(101, 600, 1000), new DisplaySize(10, 20, 200));
                return AddInPanel;
            }
    }
    
Sign In or Register to comment.