private void CreateViewElements()
{
// Create redirector for the accessing the background palette
_redirectCaption = new PaletteDoubleRedirect(_redirect, PaletteBackStyle.HeaderForm, PaletteBorderStyle.HeaderForm, NeedPaintDelegate);
// Create a top half for use in KryptonForm and another for use inside this caption area
_captionAppButton = new ViewLayoutRibbonAppButton(_ribbon, false);
_otherAppButton = new ViewLayoutRibbonAppButton(_ribbon, false);
// Connect up the application button controller to the two button elements
_appButtonController = new AppButtonController(_ribbon);
_appButtonController.Target1 = _captionAppButton.AppButton;
_appButtonController.Target2 = _otherAppButton.AppButton;
_appButtonController.NeedPaint += new NeedPaintHandler(OnAppButtonNeedPaint);
_captionAppButton.MouseController = _appButtonController;
_otherAppButton.MouseController = _appButtonController;
_appTabController = new AppTabController(_ribbon);
_appTabController.NeedPaint += new NeedPaintHandler(OnAppButtonNeedPaint);
// When not showing the app button we show this spacer instead
_spaceInsteadOfAppButton = new ViewLayoutSeparator(0);
_spaceInsteadOfAppButton.Visible = false;
// Quick access toolbar, minibar versions
_captionQAT = new ViewLayoutRibbonQATMini(_ribbon, _needIntegratedDelegate);
_nonCaptionQAT = new ViewLayoutRibbonQATMini(_ribbon, NeedPaintDelegate);
// Layout needed to position and draw the context titles
_contextTiles = new ViewLayoutRibbonContextTitles(_ribbon, this);
_contextTiles.ReverseRenderOrder = true;
// Create composition right border and attach to composition area
_compRightBorder = new ViewDrawRibbonCompoRightBorder();
_compositionArea.CompRightBorder = _compRightBorder;
// Place app button on left side and fill remainder with context titles
Add(_contextTiles, ViewDockStyle.Fill);
Add(_nonCaptionQAT, ViewDockStyle.Left);
Add(_otherAppButton, ViewDockStyle.Left);
// Update base class to use correct palette interface
base.SetPalettes(_redirectCaption.PaletteBack, _redirectCaption.PaletteBorder);
}