property Ribbon.RequiredHeight as Long
Indicates the height to fit all elements within the control.

TypeDescription
Long A long expression that specifies the height to fit all elements within the control.
The RequiredHeight property gets the height (in pixels) required by the control all all visible items fit the control's client area. The RequiredWidth property gets the width (in pixels) required by the control all all visible items fit the control's client area.

The following samples show how you can get the required size, so all elements of the control fits its client area

VBA (MS Access, Excell...)

With Ribbon1
	With .Items
		.Add "Item 1"
		.Add "Item 2"
	End With
	.Refresh 
	Debug.Print( .RequiredWidth )
	Debug.Print( .RequiredHeight )
End With

VB6

With Ribbon1
	With .Items
		.Add "Item 1"
		.Add "Item 2"
	End With
	.Refresh 
	Debug.Print( .RequiredWidth )
	Debug.Print( .RequiredHeight )
End With

VB.NET

With Exribbon1
	With .Items
		.Add("Item 1")
		.Add("Item 2")
	End With
	.Refresh()
	Debug.Print( .RequiredWidth )
	Debug.Print( .RequiredHeight )
End With

VB.NET for /COM

With AxRibbon1
	With .Items
		.Add("Item 1")
		.Add("Item 2")
	End With
	.Refresh()
	Debug.Print( .RequiredWidth )
	Debug.Print( .RequiredHeight )
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXRIBBONLib' for the library: 'ExRibbon 1.0 Control Library'

	#import <ExRibbon.dll>
	using namespace EXRIBBONLib;
*/
EXRIBBONLib::IRibbonPtr spRibbon1 = GetDlgItem(IDC_RIBBON1)->GetControlUnknown();
EXRIBBONLib::IItemsPtr var_Items = spRibbon1->GetItems();
	var_Items->Add(L"Item 1",vtMissing,vtMissing);
	var_Items->Add(L"Item 2",vtMissing,vtMissing);
spRibbon1->Refresh();
OutputDebugStringW( _bstr_t(spRibbon1->GetRequiredWidth()) );
OutputDebugStringW( _bstr_t(spRibbon1->GetRequiredHeight()) );

C++ Builder

Exribbonlib_tlb::IItemsPtr var_Items = Ribbon1->Items;
	var_Items->Add(L"Item 1",TNoParam(),TNoParam());
	var_Items->Add(L"Item 2",TNoParam(),TNoParam());
Ribbon1->Refresh();
OutputDebugString( PChar(Ribbon1->RequiredWidth) );
OutputDebugString( PChar(Ribbon1->RequiredHeight) );

C#

exontrol.EXRIBBONLib.Items var_Items = exribbon1.Items;
	var_Items.Add("Item 1",null,null);
	var_Items.Add("Item 2",null,null);
exribbon1.Refresh();
System.Diagnostics.Debug.Print( exribbon1.RequiredWidth.ToString() );
System.Diagnostics.Debug.Print( exribbon1.RequiredHeight.ToString() );

JScript/JavaScript

<BODY onload='Init()'>
<OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="Ribbon1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	var var_Items = Ribbon1.Items;
		var_Items.Add("Item 1",null,null);
		var_Items.Add("Item 2",null,null);
	Ribbon1.Refresh();
	alert( Ribbon1.RequiredWidth );
	alert( Ribbon1.RequiredHeight );
}
</SCRIPT>
</BODY>

VBScript

<BODY onload='Init()'>
<OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="Ribbon1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With Ribbon1
		With .Items
			.Add "Item 1"
			.Add "Item 2"
		End With
		.Refresh 
		alert( .RequiredWidth )
		alert( .RequiredHeight )
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

EXRIBBONLib.Items var_Items = axRibbon1.Items;
	var_Items.Add("Item 1",null,null);
	var_Items.Add("Item 2",null,null);
axRibbon1.Refresh();
System.Diagnostics.Debug.Print( axRibbon1.RequiredWidth.ToString() );
System.Diagnostics.Debug.Print( axRibbon1.RequiredHeight.ToString() );

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Items;
	anytype var_Items;
	;

	super();

	var_Items = exribbon1.Items(); com_Items = var_Items;
		com_Items.Add("Item 1");
		com_Items.Add("Item 2");
	exribbon1.Refresh();
	print( exribbon1.RequiredWidth() );
	print( exribbon1.RequiredHeight() );
}

Delphi 8 (.NET only)

with AxRibbon1 do
begin
	with Items do
	begin
		Add('Item 1',Nil,Nil);
		Add('Item 2',Nil,Nil);
	end;
	Refresh();
	OutputDebugString( RequiredWidth );
	OutputDebugString( RequiredHeight );
end

Delphi (standard)

with Ribbon1 do
begin
	with Items do
	begin
		Add('Item 1',Null,Null);
		Add('Item 2',Null,Null);
	end;
	Refresh();
	OutputDebugString( RequiredWidth );
	OutputDebugString( RequiredHeight );
end

VFP

with thisform.Ribbon1
	with .Items
		.Add("Item 1")
		.Add("Item 2")
	endwith
	.Refresh
	DEBUGOUT( .RequiredWidth )
	DEBUGOUT( .RequiredHeight )
endwith

dBASE Plus

local oRibbon,var_Items

oRibbon = form.Activex1.nativeObject
var_Items = oRibbon.Items
	var_Items.Add("Item 1")
	var_Items.Add("Item 2")
oRibbon.Refresh()
? Str(oRibbon.RequiredWidth) 
? Str(oRibbon.RequiredHeight) 

XBasic (Alpha Five)

Dim oRibbon as P
Dim var_Items as P

oRibbon = topparent:CONTROL_ACTIVEX1.activex
var_Items = oRibbon.Items
	var_Items.Add("Item 1")
	var_Items.Add("Item 2")
oRibbon.Refresh()
? oRibbon.RequiredWidth 
? oRibbon.RequiredHeight 

Visual Objects

local var_Items as IItems

var_Items := oDCOCX_Exontrol1:Items
	var_Items:Add("Item 1",nil,nil)
	var_Items:Add("Item 2",nil,nil)
oDCOCX_Exontrol1:Refresh()
OutputDebugString(String2Psz( AsString(oDCOCX_Exontrol1:RequiredWidth) ))
OutputDebugString(String2Psz( AsString(oDCOCX_Exontrol1:RequiredHeight) ))

PowerBuilder

OleObject oRibbon,var_Items

oRibbon = ole_1.Object
var_Items = oRibbon.Items
	var_Items.Add("Item 1")
	var_Items.Add("Item 2")
oRibbon.Refresh()
MessageBox("Information",string( String(oRibbon.RequiredWidth) ))
MessageBox("Information",string( String(oRibbon.RequiredHeight) ))

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Variant voItems
	Get ComItems to voItems
	Handle hoItems
	Get Create (RefClass(cComItems)) to hoItems
	Set pvComObject of hoItems to voItems
		Get ComAdd of hoItems "Item 1" Nothing Nothing to Nothing
		Get ComAdd of hoItems "Item 2" Nothing Nothing to Nothing
	Send Destroy to hoItems
	Send ComRefresh
	Showln (ComRequiredWidth(Self))
	Showln (ComRequiredHeight(Self))
End_Procedure

XBase++

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oItems
	LOCAL oRibbon

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oRibbon := XbpActiveXControl():new( oForm:drawingArea )
	oRibbon:CLSID  := "Exontrol.Ribbon.1" /*{DDF58CFA-750F-45E0-8A00-CFBE431702E2}*/
	oRibbon:create(,, {10,60},{610,370} )

		oItems := oRibbon:Items()
			oItems:Add("Item 1")
			oItems:Add("Item 2")
		oRibbon:Refresh()
		DevOut( Transform(oRibbon:RequiredWidth(),"") )
		DevOut( Transform(oRibbon:RequiredHeight(),"") )

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN