Hi guys,
I have a some issue, add 4 buttons to the sap order form
i do this job by number of steps below.
1)Catch order form draw event
2) Add button to the form ( do this step 4 times for each btn)
My problem is when i open order form buttons will drawing at self on the form and this take a lot of time ( 5-8 seconds).
Anyone know another solution to perform this action? maybe my code is wrong?
My code for adding btn to the form.
public static void AddItemBtnLink(SAPbouiCOM.Form oForm,string refItemName,string btnName,string caption)
{
try
{
setBtnLocation(oForm.TypeEx, btnName);
if (oForm.Items.Item(btnName) != null)
return;
else
{
SAPbouiCOM.Item refItem;
refItem = oForm.Items.Item(refItemName);
SAPbouiCOM.Item oCustMastItem1 = oForm.Items.Add(btnName, SAPbouiCOM.BoFormItemTypes.it_BUTTON);
oCustMastItem1.Width = btnWidth;
oCustMastItem1.Height = btnHeight;
oCustMastItem1.Top = refItem.Top + btnTop;
oCustMastItem1.Left = refItem.Left + btnLeft;
SAPbouiCOM.Button oCustMastButton = ((SAPbouiCOM.Button)(oCustMastItem1.Specific));
oCustMastButton.Caption = caption;
}
}
catch
{
SAPbouiCOM.Item refItem;
refItem = oForm.Items.Item(refItemName);
SAPbouiCOM.Item oCustMastItem1 = oForm.Items.Add(btnName, SAPbouiCOM.BoFormItemTypes.it_BUTTON);
oCustMastItem1.Width = btnWidth;
oCustMastItem1.Height = btnHeight;
oCustMastItem1.Top = refItem.Top + btnTop;
oCustMastItem1.Left = refItem.Left + btnLeft;
SAPbouiCOM.Button oCustMastButton = ((SAPbouiCOM.Button)(oCustMastItem1.Specific));
oCustMastButton.Caption = caption;
}
}
Thanks.