Changed: scrolling container

This commit is contained in:
Ray 2020-05-07 23:31:03 +01:00
parent 3b4f19ae40
commit 9575ae8ffb
12 changed files with 111 additions and 77 deletions

View File

@ -149,11 +149,11 @@
<Compile Include="Windows\Forms\Tile\TileGroupLabel.Designer.cs">
<DependentUpon>TileGroupLabel.cs</DependentUpon>
</Compile>
<Compile Include="Windows\Forms\Tile\TileContainer.cs">
<Compile Include="Windows\Forms\Tile\TileLayoutContainer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Windows\Forms\Tile\TileContainer.Designer.cs">
<DependentUpon>TileContainer.cs</DependentUpon>
<Compile Include="Windows\Forms\Tile\TileLayoutContainer.Designer.cs">
<DependentUpon>TileLayoutContainer.cs</DependentUpon>
</Compile>
<Compile Include="Windows\Forms\Tile\TileLayoutPanel.cs">
<SubType>UserControl</SubType>
@ -210,8 +210,8 @@
<EmbeddedResource Include="Windows\Forms\Tile\TileGroupLabel.resx">
<DependentUpon>TileGroupLabel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\TileContainer.resx">
<DependentUpon>TileContainer.cs</DependentUpon>
<EmbeddedResource Include="Windows\Forms\Tile\TileLayoutContainer.resx">
<DependentUpon>TileLayoutContainer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\TileLayoutPanel.resx">
<DependentUpon>TileLayoutPanel.cs</DependentUpon>

70
MainForm.Designer.cs generated
View File

@ -31,13 +31,13 @@
this.components = new System.ComponentModel.Container();
this.titlePanel1 = new AppLauncher.Windows.Forms.TitlePanel();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
@ -66,56 +66,58 @@
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(100, 76);
//
// toolStripSeparator1
// toolStripMenuItem4
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
this.toolStripMenuItem4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem2});
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(99, 22);
this.toolStripMenuItem4.Text = "&File";
//
// exitToolStripMenuItem
// toolStripMenuItem2
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 59);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(600, 369);
this.flowLayoutPanel1.TabIndex = 27;
this.flowLayoutPanel1.WrapContents = false;
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem2.Text = "&Save As...";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem3.Size = new System.Drawing.Size(99, 22);
this.toolStripMenuItem3.Text = "&View";
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem1.Text = "Always On &Top";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
// toolStripMenuItem4
// toolStripSeparator1
//
this.toolStripMenuItem4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem2});
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem4.Text = "&File";
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(96, 6);
//
// toolStripMenuItem2
// exitToolStripMenuItem
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem2.Text = "&Save As...";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 59);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(600, 361);
this.flowLayoutPanel1.TabIndex = 27;
this.flowLayoutPanel1.WrapContents = false;
//
// saveFileDialog1
//

View File

@ -30,7 +30,6 @@ namespace AppLauncher
loadSession(jsonfigFilename);
}
this.Width = flowLayoutPanel1.Width + (flowLayoutPanel1.Left * 2);
}
public async Task ToggleSize()
@ -78,12 +77,12 @@ namespace AppLauncher
List<TileGroupModel> rs = new List<TileGroupModel>();
for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
{
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TileContainer))
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TileLayoutContainer))
{
continue;
}
TileContainer container = flowLayoutPanel1.Controls[i] as TileContainer;
TileLayoutContainer container = flowLayoutPanel1.Controls[i] as TileLayoutContainer;
rs.Add(container.Model);
}
@ -177,13 +176,16 @@ namespace AppLauncher
foreach (TileGroupModel item in rs)
{
TileContainer panel = new TileContainer(item);
TileLayoutContainer panel = new TileLayoutContainer(item);
maxWidth = Math.Max(maxWidth, panel.Width);
flowLayoutPanel1.Controls.Add(panel);
}
flowLayoutPanel1.Width = maxWidth;
flowLayoutPanel1.Width = maxWidth + SystemInformation.VerticalScrollBarWidth;
//this.Width = flowLayoutPanel1.Width + (flowLayoutPanel1.Left * 2);
this.Width = flowLayoutPanel1.Width + flowLayoutPanel1.Left;
}
}

View File

@ -1,6 +1,7 @@
namespace RyzStudio.Windows.ThemedForms
{
using System;
using RyzStudio.Drawing;
using System;
using System.ComponentModel;
using System.Drawing;
@ -19,6 +20,7 @@
label1.MouseLeave += delegate { this.VisualState = ButtonState.Normal; };
label1.MouseDown += delegate { this.VisualState = ButtonState.Down; };
label1.MouseUp += delegate { this.VisualState = ButtonState.Normal; };
}
protected override void OnLoad(EventArgs e)
@ -31,9 +33,9 @@
this.StyleDefault = new ButtonStyle(Color.White, Color.Black, this.DefaultImage);
this.VisualState = ButtonState.Normal;
}
}
protected ButtonState VisualState
protected ButtonState VisualState
{
get { return buttonState; }
set
@ -71,9 +73,16 @@
label1.ForeColor = style.PenColour;
label1.BackColor = style.BackColour;
label1.Image = style.ForeImage;
}
[Browsable(true)]
//var rect = label1.ClientRectangle;
////rect.Inflate(-3, -3);
//Rectangoid area = new Rectangoid(rect, 3, 1);
//label1.Region = new Region(area.ToGraphicsPath());
}
[Browsable(true)]
[Category("Appearance")]
public string LabelText { get => label1.Text; set => label1.Text = value; }

View File

@ -28,12 +28,12 @@
base.OnPaintBackground(e);
Graphics g = e.Graphics;
//// g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
//// g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
//// g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
//// g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
//g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
//g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
//g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
updateBackground(g, styleActive);
updateBackground(g, styleActive);
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]

View File

@ -11,7 +11,7 @@ namespace AppLauncher.Windows.Forms
private Button button1;
private PickerBox pickerBox1;
private TextBox textBox1;
protected TileContainer parentContainer = null;
protected TileLayoutContainer parentContainer = null;
public EditGroupForm() : base()
{
@ -19,7 +19,7 @@ namespace AppLauncher.Windows.Forms
initialiseComponents2();
}
public EditGroupForm(TileContainer container) : base()
public EditGroupForm(TileLayoutContainer container) : base()
{
parentContainer = container;
@ -162,7 +162,7 @@ namespace AppLauncher.Windows.Forms
if (parentContainer != null)
{
textBox1.Text = parentContainer.Model.Title;
pickerBox1.ComboBox.SelectedIndex = (parentContainer.Model.IsExpanded ? 1 : 0);
pickerBox1.ComboBox.SelectedIndex = (parentContainer.Model.IsExclusive ? 1 : 0);
}
}

View File

@ -42,6 +42,7 @@
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
@ -69,32 +70,33 @@
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem2,
this.toolStripMenuItem5,
this.toolStripMenuItem1,
this.toolStripSeparator2,
this.toolStripMenuItem4,
this.toolStripSeparator1,
this.toolStripMenuItem3});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(133, 104);
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 148);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem2.Text = "&Add Group";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem1.Text = "&Edit";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(129, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
//
// toolStripMenuItem4
//
@ -104,46 +106,46 @@
this.downToolStripMenuItem,
this.bottomToolStripMenuItem});
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem4.Text = "&Move";
//
// topToolStripMenuItem
//
this.topToolStripMenuItem.Name = "topToolStripMenuItem";
this.topToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.topToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.topToolStripMenuItem.Text = "&Top";
this.topToolStripMenuItem.Click += new System.EventHandler(this.topToolStripMenuItem_Click);
//
// upToolStripMenuItem
//
this.upToolStripMenuItem.Name = "upToolStripMenuItem";
this.upToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.upToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.upToolStripMenuItem.Text = "&Up";
this.upToolStripMenuItem.Click += new System.EventHandler(this.upToolStripMenuItem_Click);
//
// downToolStripMenuItem
//
this.downToolStripMenuItem.Name = "downToolStripMenuItem";
this.downToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.downToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.downToolStripMenuItem.Text = "&Down";
this.downToolStripMenuItem.Click += new System.EventHandler(this.downToolStripMenuItem_Click);
//
// bottomToolStripMenuItem
//
this.bottomToolStripMenuItem.Name = "bottomToolStripMenuItem";
this.bottomToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.bottomToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.bottomToolStripMenuItem.Text = "&Bottom";
this.bottomToolStripMenuItem.Click += new System.EventHandler(this.bottomToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(129, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem3.Text = "&Remove";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
//
@ -167,6 +169,13 @@
this.pictureBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick);
this.pictureBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick);
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem5.Text = "Add &Row";
this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
//
// TileGroupLabel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -199,5 +208,6 @@
private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
}
}

View File

@ -30,7 +30,7 @@ namespace AppLauncher.Windows.Forms
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public TileContainer TileGroupPanel { get; set; } = null;
public TileLayoutContainer TileGroupPanel { get; set; } = null;
protected void panel_MouseClick(object sender, MouseEventArgs e)
{
@ -92,5 +92,10 @@ namespace AppLauncher.Windows.Forms
if (this.TileGroupPanel != null) this.TileGroupPanel.Remove();
}
private void toolStripMenuItem5_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.AddRow();
}
}
}

View File

@ -1,6 +1,6 @@
namespace AppLauncher.Windows.Forms
{
partial class TileContainer
partial class TileLayoutContainer
{
/// <summary>
/// Required designer variable.

View File

@ -8,14 +8,14 @@ using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public partial class TileContainer : AUserControl
public partial class TileLayoutContainer : AUserControl
{
protected int collapseIncrement = 6;
protected int expandIncrement = 8;
protected TileGroupModel groupInfo = null;
protected bool isAnimating = false;
public TileContainer(TileGroupModel model) : base()
public TileLayoutContainer(TileGroupModel model) : base()
{
InitializeComponent();
@ -200,13 +200,18 @@ namespace AppLauncher.Windows.Forms
return;
}
this.FlowLayoutPanel.Controls.Add(new TileContainer(new TileGroupModel()
this.FlowLayoutPanel.Controls.Add(new TileLayoutContainer(new TileGroupModel()
{
Title = "New Group",
GridSize = new Size(8, 1)
}));
}
public void AddRow()
{
panel1.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1));
}
public void EditGroup()
{
EditGroupForm editForm = new EditGroupForm(this);
@ -220,6 +225,7 @@ namespace AppLauncher.Windows.Forms
label1.TitleText = groupInfo.Title;
panel1.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
this.Width = panel1.Width;
label1.Checked = groupInfo.IsExpanded;
if (loadTiles)

View File

@ -30,7 +30,7 @@ namespace AppLauncher.Windows.Forms
InitializeComponent();
this.AllowDrop = true;
this.BackColor = System.Drawing.Color.Transparent;
this.BackColor = Color.Transparent;
}
private void InitializeComponent()
@ -63,7 +63,7 @@ namespace AppLauncher.Windows.Forms
}
}
public TileContainer TileContainer
public TileLayoutContainer TileContainer
{
get
{
@ -72,12 +72,12 @@ namespace AppLauncher.Windows.Forms
return null;
}
if (this.Parent.GetType() != typeof(TileContainer))
if (this.Parent.GetType() != typeof(TileLayoutContainer))
{
return null;
}
return (TileContainer)this.Parent;
return (TileLayoutContainer)this.Parent;
}
}