Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions Source/Krypton Components/TestForm/StartScreen.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions Source/Krypton Components/TestForm/StartScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/
#endregion

using System.Reflection;
using System.Windows.Forms;

namespace TestForm;

public partial class StartScreen : KryptonForm
Expand Down Expand Up @@ -38,6 +41,7 @@ public StartScreen()
btnRestoreSize.Click += OnBtnRestoreSizeClick;

SetupFilterBox();
SetupExitButton();
SetupTableLayoutPanel();
AddButtons();
SortButtons();
Expand All @@ -58,7 +62,6 @@ private void AddButtons()
CreateButton("FormBorder Test", string.Empty, typeof(FormBorderTest));
CreateButton("Header Examples", string.Empty, typeof(HeaderExamples));
CreateButton("Menu/Tool/Status Strips", string.Empty, typeof(MenuToolBarStatusStripTest));
//CreateButton("Powered By Button", string.Empty, typeof(PoweredByButtonForm));
CreateButton("ProgressBar", "Checkout if progress has been made.", typeof(ProgressBarTest));
CreateButton("Ribbon / Navigator / Workspace", string.Empty, typeof(RibbonNavigatorWorkspaceTest));
CreateButton("Splash Screen", string.Empty, typeof(SplashScreenExample));
Expand Down Expand Up @@ -146,6 +149,12 @@ private void CreateButton(string heading, string description, Type formType, Ima
_buttons.Add(button);
}

private void SetupExitButton()
{
FontFamily family = KryptonManager.CurrentGlobalPalette.GetContentShortTextFont(PaletteContentStyle.InputControlStandalone, PaletteState.Normal)!.FontFamily;
kbtnExit.StateCommon.Content.ShortText.Font = new Font(family, 14F, FontStyle.Regular);
}

private void SetupFilterBox()
{
tbFilter.Clear();
Expand Down Expand Up @@ -192,12 +201,11 @@ private void SortButtons()

private void SetupTableLayoutPanel()
{
SetTableLayoutPanelDoubleBuffered(true);
tlpMain.RowCount = 0;
tlpMain.ColumnCount = 1;

tlpMain.AutoSize = false;
tlpMain.MaximumSize = new Size(_panelWidth, 0);
tlpMain.MinimumSize = new Size(_panelWidth, 464);
tlpMain.BackColor = Color.Transparent;
tlpMain.Padding = new Padding(0);
tlpMain.Margin = new Padding(0);
Expand All @@ -207,6 +215,19 @@ private void SetupTableLayoutPanel()
tlpMain.ColumnStyles.Clear();
tlpMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
}

private void SetTableLayoutPanelDoubleBuffered(bool enableDoubleBuffering)
{
PropertyInfo? propertyInfo = typeof(TableLayoutPanel).GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
if (propertyInfo is not null)
{
propertyInfo.SetValue(tlpMain, enableDoubleBuffering);
}
else
{
throw new NullReferenceException(nameof(propertyInfo));
}
}

private void AddButtonsToTlpMain()
{
Expand Down