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
}
0
Comments
I used ApplySize like this and it seems to work: