From caec9c731713c5b6ff68fe851e01d2e5900647cb Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 27 Apr 2020 13:17:13 +0100 Subject: [PATCH] WIP: dialog box --- LinearAppLauncher.csproj | 130 +++++ LinearAppLauncher.csproj.user | 6 + MainForm.Designer.cs | 79 +--- MainForm.cs | 8 +- Properties/Resources.Designer.cs | 140 ++++++ Properties/Resources.resx | 42 ++ Resources/button16_file_add.png | Bin 0 -> 372 bytes Resources/button16_file_add2.png | Bin 0 -> 323 bytes Resources/button16_folder_add.png | Bin 0 -> 352 bytes Resources/button16_folder_add2.png | Bin 0 -> 288 bytes Resources/form16_close.png | Bin 0 -> 347 bytes Resources/form16_close2.png | Bin 0 -> 352 bytes Resources/form16_maximise.png | Bin 0 -> 300 bytes Resources/form16_maximise2.png | Bin 0 -> 275 bytes Resources/form16_menu.png | Bin 0 -> 297 bytes Resources/form16_menu2.png | Bin 0 -> 282 bytes Resources/form16_minimise.png | Bin 0 -> 276 bytes Resources/form16_minimise2.png | Bin 0 -> 291 bytes Resources/form16_restore.png | Bin 0 -> 318 bytes Resources/form16_restore2.png | Bin 0 -> 317 bytes RyzStudio/Data/SQLite/SQLiteDatabase.cs | 444 ++++++++++++++++++ RyzStudio/Drawing/LeftRectangoid.cs | 137 ++++++ RyzStudio/Drawing/Rectangoid.cs | 124 +++++ RyzStudio/IO/FileType.cs | 56 +++ RyzStudio/IO/SessionFileFormatBase.cs | 290 ++++++++++++ RyzStudio/IO/SharpZipLib.cs | 76 +++ RyzStudio/Net/HttpWeb.cs | 168 +++++++ RyzStudio/String.cs | 36 ++ .../Forms/HorizontalSeparator.Designer.cs | 37 ++ .../Windows/Forms/HorizontalSeparator.cs | 30 ++ RyzStudio/Windows/Forms/ImageBox.cs | 54 +++ RyzStudio/Windows/Forms/PanelBook.Designer.cs | 37 ++ RyzStudio/Windows/Forms/PanelBook.cs | 159 +++++++ RyzStudio/Windows/Forms/PanelCollection.cs | 80 ++++ RyzStudio/Windows/Forms/StackLayoutPanel.cs | 69 +++ .../ThemedForms/BorderlessForm.Designer.cs | 191 ++++++++ .../Windows/ThemedForms/BorderlessForm.cs | 410 ++++++++++++++++ .../Windows/ThemedForms/BorderlessForm.resx | 158 +++++++ .../BorderlessToolForm.Designer.cs | 191 ++++++++ .../Windows/ThemedForms/BorderlessToolForm.cs | 394 ++++++++++++++++ .../ThemedForms/BorderlessToolForm.resx | 138 ++++++ RyzStudio/Windows/ThemedForms/Button.cs | 103 ++++ .../Windows/ThemedForms/Button.designer.cs | 61 +++ RyzStudio/Windows/ThemedForms/Button.resx | 120 +++++ RyzStudio/Windows/ThemedForms/ButtonState.cs | 9 + RyzStudio/Windows/ThemedForms/ButtonStyle.cs | 25 + .../ThemedForms/DialogForm.Designer.cs | 123 +++++ RyzStudio/Windows/ThemedForms/DialogForm.cs | 306 ++++++++++++ RyzStudio/Windows/ThemedForms/DialogForm.resx | 129 +++++ .../Windows/ThemedForms/Form.Designer.cs | 52 ++ RyzStudio/Windows/ThemedForms/Form.cs | 173 +++++++ RyzStudio/Windows/ThemedForms/Form.resx | 120 +++++ RyzStudio/Windows/ThemedForms/LeftButton.cs | 111 +++++ .../ThemedForms/LeftButton.designer.cs | 61 +++ RyzStudio/Windows/ThemedForms/LeftButton.resx | 120 +++++ .../Windows/ThemedForms/LeftUserControl.cs | 53 +++ .../ThemedForms/LeftUserControl.designer.cs | 37 ++ RyzStudio/Windows/ThemedForms/PickerBox.cs | 98 ++++ .../Windows/ThemedForms/PickerBox.designer.cs | 59 +++ RyzStudio/Windows/ThemedForms/PickerBox.resx | 120 +++++ .../ThemedForms/ProgressBar.Designer.cs | 72 +++ RyzStudio/Windows/ThemedForms/ProgressBar.cs | 29 ++ .../Windows/ThemedForms/ProgressBar.resx | 120 +++++ .../ThemedForms/ProgressBarInner.Designer.cs | 63 +++ .../Windows/ThemedForms/ProgressBarInner.cs | 197 ++++++++ .../Windows/ThemedForms/ProgressBarInner.resx | 120 +++++ RyzStudio/Windows/ThemedForms/TextBox.cs | 96 ++++ .../Windows/ThemedForms/TextBox.designer.cs | 60 +++ RyzStudio/Windows/ThemedForms/TextBox.resx | 120 +++++ .../Windows/ThemedForms/TextButtonBox.cs | 127 +++++ .../ThemedForms/TextButtonBox.designer.cs | 81 ++++ .../Windows/ThemedForms/TextButtonBox.resx | 120 +++++ RyzStudio/Windows/ThemedForms/ThemeStyle.cs | 34 ++ RyzStudio/Windows/ThemedForms/UserControl.cs | 89 ++++ .../ThemedForms/UserControl.designer.cs | 37 ++ .../ThemedForms/res/button16_file_add.png | Bin 0 -> 426 bytes .../ThemedForms/res/button16_file_add2.png | Bin 0 -> 371 bytes .../ThemedForms/res/button16_folder_add.png | Bin 0 -> 463 bytes .../ThemedForms/res/button16_folder_add2.png | Bin 0 -> 361 bytes .../ThemedForms/res/button16_refresh.png | Bin 0 -> 639 bytes .../ThemedForms/res/button16_refresh2.png | Bin 0 -> 421 bytes .../Windows/ThemedForms/res/form16_close.png | Bin 0 -> 347 bytes .../Windows/ThemedForms/res/form16_close2.png | Bin 0 -> 352 bytes .../ThemedForms/res/form16_maximise.png | Bin 0 -> 300 bytes .../ThemedForms/res/form16_maximise2.png | Bin 0 -> 275 bytes .../Windows/ThemedForms/res/form16_menu.png | Bin 0 -> 297 bytes .../Windows/ThemedForms/res/form16_menu2.png | Bin 0 -> 282 bytes .../ThemedForms/res/form16_minimise.png | Bin 0 -> 276 bytes .../ThemedForms/res/form16_minimise2.png | Bin 0 -> 291 bytes .../ThemedForms/res/form16_restore.png | Bin 0 -> 318 bytes .../ThemedForms/res/form16_restore2.png | Bin 0 -> 317 bytes .../Windows/ThemedForms/res/form20_close.png | Bin 0 -> 493 bytes .../Windows/ThemedForms/res/form20_close2.png | Bin 0 -> 386 bytes .../ThemedForms/res/form20_maximise.png | Bin 0 -> 280 bytes .../ThemedForms/res/form20_maximise2.png | Bin 0 -> 281 bytes .../Windows/ThemedForms/res/form20_menu.png | Bin 0 -> 296 bytes .../Windows/ThemedForms/res/form20_menu2.png | Bin 0 -> 298 bytes .../ThemedForms/res/form20_minimise.png | Bin 0 -> 289 bytes .../ThemedForms/res/form20_minimise2.png | Bin 0 -> 301 bytes .../ThemedForms/res/form20_restore.png | Bin 0 -> 319 bytes .../ThemedForms/res/form20_restore2.png | Bin 0 -> 323 bytes .../Windows/ThemedForms/res/settings16.png | Bin 0 -> 729 bytes .../Windows/ThemedForms/res/settings16_2.png | Bin 0 -> 483 bytes .../ThemedForms/res/settings16_white.png | Bin 0 -> 516 bytes Windows/Forms/EditTileForm.cs | 349 ++++++++++++++ Windows/Forms/EditTileForm.resx | 131 ++++++ Windows/Forms/Tile/TilePanel.Designer.cs | 33 ++ Windows/Forms/Tile/TilePanel.cs | 14 + Windows/Forms/Tile/TilePanel.resx | 3 + 109 files changed, 7397 insertions(+), 62 deletions(-) create mode 100644 LinearAppLauncher.csproj.user create mode 100644 Resources/button16_file_add.png create mode 100644 Resources/button16_file_add2.png create mode 100644 Resources/button16_folder_add.png create mode 100644 Resources/button16_folder_add2.png create mode 100644 Resources/form16_close.png create mode 100644 Resources/form16_close2.png create mode 100644 Resources/form16_maximise.png create mode 100644 Resources/form16_maximise2.png create mode 100644 Resources/form16_menu.png create mode 100644 Resources/form16_menu2.png create mode 100644 Resources/form16_minimise.png create mode 100644 Resources/form16_minimise2.png create mode 100644 Resources/form16_restore.png create mode 100644 Resources/form16_restore2.png create mode 100644 RyzStudio/Data/SQLite/SQLiteDatabase.cs create mode 100644 RyzStudio/Drawing/LeftRectangoid.cs create mode 100644 RyzStudio/Drawing/Rectangoid.cs create mode 100644 RyzStudio/IO/FileType.cs create mode 100644 RyzStudio/IO/SessionFileFormatBase.cs create mode 100644 RyzStudio/IO/SharpZipLib.cs create mode 100644 RyzStudio/Net/HttpWeb.cs create mode 100644 RyzStudio/String.cs create mode 100644 RyzStudio/Windows/Forms/HorizontalSeparator.Designer.cs create mode 100644 RyzStudio/Windows/Forms/HorizontalSeparator.cs create mode 100644 RyzStudio/Windows/Forms/ImageBox.cs create mode 100644 RyzStudio/Windows/Forms/PanelBook.Designer.cs create mode 100644 RyzStudio/Windows/Forms/PanelBook.cs create mode 100644 RyzStudio/Windows/Forms/PanelCollection.cs create mode 100644 RyzStudio/Windows/Forms/StackLayoutPanel.cs create mode 100644 RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/BorderlessForm.cs create mode 100644 RyzStudio/Windows/ThemedForms/BorderlessForm.resx create mode 100644 RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs create mode 100644 RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx create mode 100644 RyzStudio/Windows/ThemedForms/Button.cs create mode 100644 RyzStudio/Windows/ThemedForms/Button.designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/Button.resx create mode 100644 RyzStudio/Windows/ThemedForms/ButtonState.cs create mode 100644 RyzStudio/Windows/ThemedForms/ButtonStyle.cs create mode 100644 RyzStudio/Windows/ThemedForms/DialogForm.Designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/DialogForm.cs create mode 100644 RyzStudio/Windows/ThemedForms/DialogForm.resx create mode 100644 RyzStudio/Windows/ThemedForms/Form.Designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/Form.cs create mode 100644 RyzStudio/Windows/ThemedForms/Form.resx create mode 100644 RyzStudio/Windows/ThemedForms/LeftButton.cs create mode 100644 RyzStudio/Windows/ThemedForms/LeftButton.designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/LeftButton.resx create mode 100644 RyzStudio/Windows/ThemedForms/LeftUserControl.cs create mode 100644 RyzStudio/Windows/ThemedForms/LeftUserControl.designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/PickerBox.cs create mode 100644 RyzStudio/Windows/ThemedForms/PickerBox.designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/PickerBox.resx create mode 100644 RyzStudio/Windows/ThemedForms/ProgressBar.Designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/ProgressBar.cs create mode 100644 RyzStudio/Windows/ThemedForms/ProgressBar.resx create mode 100644 RyzStudio/Windows/ThemedForms/ProgressBarInner.Designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/ProgressBarInner.cs create mode 100644 RyzStudio/Windows/ThemedForms/ProgressBarInner.resx create mode 100644 RyzStudio/Windows/ThemedForms/TextBox.cs create mode 100644 RyzStudio/Windows/ThemedForms/TextBox.designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/TextBox.resx create mode 100644 RyzStudio/Windows/ThemedForms/TextButtonBox.cs create mode 100644 RyzStudio/Windows/ThemedForms/TextButtonBox.designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/TextButtonBox.resx create mode 100644 RyzStudio/Windows/ThemedForms/ThemeStyle.cs create mode 100644 RyzStudio/Windows/ThemedForms/UserControl.cs create mode 100644 RyzStudio/Windows/ThemedForms/UserControl.designer.cs create mode 100644 RyzStudio/Windows/ThemedForms/res/button16_file_add.png create mode 100644 RyzStudio/Windows/ThemedForms/res/button16_file_add2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/button16_folder_add.png create mode 100644 RyzStudio/Windows/ThemedForms/res/button16_folder_add2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/button16_refresh.png create mode 100644 RyzStudio/Windows/ThemedForms/res/button16_refresh2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_close.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_close2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_maximise.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_maximise2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_menu.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_menu2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_minimise.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_minimise2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_restore.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form16_restore2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_close.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_close2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_maximise.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_maximise2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_menu.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_menu2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_minimise.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_minimise2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_restore.png create mode 100644 RyzStudio/Windows/ThemedForms/res/form20_restore2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/settings16.png create mode 100644 RyzStudio/Windows/ThemedForms/res/settings16_2.png create mode 100644 RyzStudio/Windows/ThemedForms/res/settings16_white.png create mode 100644 Windows/Forms/EditTileForm.cs create mode 100644 Windows/Forms/EditTileForm.resx diff --git a/LinearAppLauncher.csproj b/LinearAppLauncher.csproj index a53b0f6..547fbca 100644 --- a/LinearAppLauncher.csproj +++ b/LinearAppLauncher.csproj @@ -67,6 +67,70 @@ True Resources.resx + + + UserControl + + + HorizontalSeparator.cs + + + Component + + + UserControl + + + Button.cs + + + + + Form + + + DialogForm.cs + + + Form + + + BorderlessToolForm.cs + + + Form + + + Form.cs + + + UserControl + + + PickerBox.cs + + + UserControl + + + TextBox.cs + + + UserControl + + + TextButtonBox.cs + + + + UserControl + + + UserControl.cs + + + Form + Form @@ -107,6 +171,30 @@ ResXFileCodeGenerator Resources.Designer.cs + + Button.cs + + + DialogForm.cs + + + BorderlessToolForm.cs + + + Form.cs + + + PickerBox.cs + + + TextBox.cs + + + TextButtonBox.cs + + + EditTileForm.cs + TileGroupLabel.cs @@ -157,5 +245,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LinearAppLauncher.csproj.user b/LinearAppLauncher.csproj.user new file mode 100644 index 0000000..6cbe588 --- /dev/null +++ b/LinearAppLauncher.csproj.user @@ -0,0 +1,6 @@ + + + + ProjectFiles + + \ No newline at end of file diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 34d2089..92fc8f6 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -29,30 +29,16 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.button1 = new System.Windows.Forms.Button(); this.titlePanel1 = new AppLauncher.Windows.Forms.TitlePanel(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.button2 = new System.Windows.Forms.Button(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.button3 = new System.Windows.Forms.Button(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); 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.button3 = new System.Windows.Forms.Button(); this.contextMenuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // - // button1 - // - this.button1.Location = new System.Drawing.Point(710, 243); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(78, 40); - this.button1.TabIndex = 0; - this.button1.Text = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // // titlePanel1 // this.titlePanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -63,7 +49,7 @@ this.titlePanel1.MainMenu = this.contextMenuStrip1; this.titlePanel1.MinimumSize = new System.Drawing.Size(40, 40); this.titlePanel1.Name = "titlePanel1"; - this.titlePanel1.Size = new System.Drawing.Size(800, 40); + this.titlePanel1.Size = new System.Drawing.Size(1088, 40); this.titlePanel1.TabIndex = 8; this.titlePanel1.TitleText = "Launcher"; // @@ -74,25 +60,27 @@ this.toolStripSeparator1, this.exitToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(181, 76); + this.contextMenuStrip1.Size = new System.Drawing.Size(153, 54); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem1.Text = "Always On &Top"; + this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // - // button2 - // - this.button2.Location = new System.Drawing.Point(710, 289); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(78, 40); - this.button2.TabIndex = 21; - this.button2.Text = "button2"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // // flowLayoutPanel1 // this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; @@ -111,58 +99,29 @@ this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // - // pictureBox1 - // - this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.pictureBox1.Location = new System.Drawing.Point(695, 96); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(100, 109); - this.pictureBox1.TabIndex = 29; - this.pictureBox1.TabStop = false; - // - // toolStripMenuItem1 - // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22); - this.toolStripMenuItem1.Text = "Always On &Top"; - this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(83)))), ((int)(((byte)(93))))); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.ClientSize = new System.Drawing.Size(800, 440); - this.Controls.Add(this.pictureBox1); + this.ClientSize = new System.Drawing.Size(1088, 440); this.Controls.Add(this.button3); this.Controls.Add(this.flowLayoutPanel1); - this.Controls.Add(this.button2); this.Controls.Add(this.titlePanel1); - this.Controls.Add(this.button1); this.Name = "MainForm"; this.Text = "Form1"; this.contextMenuStrip1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); } #endregion - - private System.Windows.Forms.Button button1; private Windows.Forms.TitlePanel titlePanel1; - private System.Windows.Forms.Button button2; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.Button button3; - private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; } diff --git a/MainForm.cs b/MainForm.cs index 354fa99..9895c64 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -25,8 +25,6 @@ namespace AppLauncher public MainForm() : base() { InitializeComponent(); - - //headingPanel2.Checked = true; } private async void button1_Click(object sender, EventArgs e) @@ -205,5 +203,11 @@ namespace AppLauncher } + private void button1_Click_1(object sender, EventArgs e) + { + EditTileForm addTileForm = new EditTileForm(); + addTileForm.ShowDialog(); + + } } } diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 595fb8f..c9399a3 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -70,6 +70,46 @@ namespace AppLauncher.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap button16_file_add { + get { + object obj = ResourceManager.GetObject("button16_file_add", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap button16_file_add2 { + get { + object obj = ResourceManager.GetObject("button16_file_add2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap button16_folder_add { + get { + object obj = ResourceManager.GetObject("button16_folder_add", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap button16_folder_add2 { + get { + object obj = ResourceManager.GetObject("button16_folder_add2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -90,6 +130,106 @@ namespace AppLauncher.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_close { + get { + object obj = ResourceManager.GetObject("form16_close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_close2 { + get { + object obj = ResourceManager.GetObject("form16_close2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_maximise { + get { + object obj = ResourceManager.GetObject("form16_maximise", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_maximise2 { + get { + object obj = ResourceManager.GetObject("form16_maximise2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_menu { + get { + object obj = ResourceManager.GetObject("form16_menu", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_menu2 { + get { + object obj = ResourceManager.GetObject("form16_menu2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_minimise { + get { + object obj = ResourceManager.GetObject("form16_minimise", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_minimise2 { + get { + object obj = ResourceManager.GetObject("form16_minimise2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_restore { + get { + object obj = ResourceManager.GetObject("form16_restore", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap form16_restore2 { + get { + object obj = ResourceManager.GetObject("form16_restore2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Properties/Resources.resx b/Properties/Resources.resx index f5a53b6..c5a52dd 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -121,12 +121,54 @@ ..\Resources\arrow-right-ea-16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\button16_file_add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\button16_file_add2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\button16_folder_add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\button16_folder_add2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\chrome-ea-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\folder-ea-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\form16_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_close2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_maximise.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_maximise2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_menu.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_menu2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_minimise.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_minimise2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_restore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\form16_restore2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\grid-ea-24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Resources/button16_file_add.png b/Resources/button16_file_add.png new file mode 100644 index 0000000000000000000000000000000000000000..d0c9e5830ade13c518f1a0a7fb5c4e4f20407e41 GIT binary patch literal 372 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBufiR<}hF1en1E;5pV~B-+@}K|z?GJx_eO>q8-{0o#jg5}n z9g>X_tOiC#_t=80Zr!@IUqOk7N1;}M!R*1StE;a!K12(Z}++-JXWeQ&xW63z>H+#w~#;bXZn+`j)9pFh|njA5wmragwuLSFoy^UXf z-QJ$R*||lK?E$O9ZJ!1+Yvz}S9d3O--Y>s=VUUaD2I&+{T?OdXq84umfFr?P-?xdad}WKNiL#_{XZGGItC Nc)I$ztaD0e0s!%Bg1i6# literal 0 HcmV?d00001 diff --git a/Resources/button16_file_add2.png b/Resources/button16_file_add2.png new file mode 100644 index 0000000000000000000000000000000000000000..f3e9f6d2179af7121d2314669151bada83185afe GIT binary patch literal 323 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBufiR<}hF1en@P?<0V~B_mzch1Gq$$e+;8eZOfUvhDuXxoI>Z<;4FSAKHgGum`mj9+JAe$xE~D$Gfb_Ufni z7#v^{&B$rov*qGpw%RufHG>j*wWC%%Y+_q<#CAgOdiK0!6}xON-0+;gM&xay`G2PQ zOt+G*wXB{cw|r8~q%TRk64!0sue^WDo$FTu|J0^hdJ9TEnV5RN^Ixw)1@p4T61G!! S%?<z-+dbOt}?FI(5&63 z!&xxsRAc6>xjSk&zt`3`Z)|F7-J~QH5X=#{UFURYn3YI@fwwJ_jttCAK*V_`Ki{a*MzIbzRjOhYh_C1ebkJR#jNvvd?fa!=5|A|9&sX=bBqw z_}4JvZ^yzP0u8$9uV$_TjT-wL<FVdQ&MBb@0I8Ogm;e9( literal 0 HcmV?d00001 diff --git a/Resources/button16_folder_add2.png b/Resources/button16_folder_add2.png new file mode 100644 index 0000000000000000000000000000000000000000..d21178aa8cafb22ebfe50bf0379772d84075e671 GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sDEfH31!Z9ZwB;8sr;#}Etux0m z`({cN-g>d1b*@z9#RhA)7pn!Ax7qqdta#{pJI^3+VJW*+#mk31-fh|?`8{_S-y0oW z`^Bn$it?(JjOTVb)$O~faH{@5KU<52yXeMiVqQy{0_Lhp%~1Zkc=O`wSeX!(3x_|< hFBYubZFY>sKU2UnWXUOwlRytJc)I$ztaD0e0suaOZf^hp literal 0 HcmV?d00001 diff --git a/Resources/form16_close.png b/Resources/form16_close.png new file mode 100644 index 0000000000000000000000000000000000000000..6cfa679bd607c6b908b548bcf40bc01d1a39548b GIT binary patch literal 347 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSL74G){)!Z!phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7?o?)`q9B-hSo1QL? zAr}5igQNMH37r$1dW zIV&sUDDL@9toFVQbZW|Ifgf?i&Hz>~gTDkOAk z`MKOFQpc`Lsbb;%kXUv?{()#S=gApT*;(Au1*T7A7R>AH$^3Co^wS6J6GzNDB)7Pv z_OFyPda!NzRM~%*&PMGHz1eKMrdA^3>;L$~ukI>ge~(3+;dPVqetB_*{8J_wl?z|h pum0ZUvu6@V#-=Y;&ttF4&I{z{Ir%_twL8$044$rjF6*2UngAD?hj;)0 literal 0 HcmV?d00001 diff --git a/Resources/form16_close2.png b/Resources/form16_close2.png new file mode 100644 index 0000000000000000000000000000000000000000..e29862795b75be961aeb829c660687489eab467a GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ;P+JIo?1u7d>4ZLoEE421oNX83@RHRXXOfS8e%%wVj9frxfshaH*LU@jXz;XN_j! zB+a*FWf2+T8o#xB>JR-AH%ytdRXOi2t6^o+=klsuI;+Z*_!c}=ZQQ!yt#eW4gGn(w z&z)Cu?&m%AtVN)#kacEpPUn)wkM2?XJ4L&a^q*KBugG`1)Np?pC*!iUt*ch{!PC{xWt~$(69BD)iE;n{ literal 0 HcmV?d00001 diff --git a/Resources/form16_maximise.png b/Resources/form16_maximise.png new file mode 100644 index 0000000000000000000000000000000000000000..93017d3887c4f870863df4fbb72e98c6454d5edb GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ;P+JIo?1ub3I)gLoED{PWI+Itia>)(s!3<^)sDYr&Vkj9+eAB(>c-es&%Q>DrYgt zOqNZ@{2MlWzGt7@BfsO|-Hf#BL8lHU9)30}s48);?zEg%aV9D5cMF_2^1lfkP(B-E z-fjElFXNYc0#LT=By}Z;C1rt3( zJ;P+JIo?1uEuJopAr}5`CvW6BY{294KK;_a!YuJwx}`7kEq*TQk-Reb&A|zZpQ4IB z0#LT=By}Z;C1rt3( zJ;P+JIo?1uvpiiKLoEESPPXQ2G2n42mV9tV#QP*`5zB(xYNy^SXa*nXxpvfRH%G9- z5fA^K9$PLYvvWK3S~fIrg{i)oTYPS90#LT=By}Z;C1rt3( zJ;P+JIo?1u-JULvAr}5`gAKVF40!gOUtxbO?1Ha$o%7v4y^EXUZgDm7y?pTOpy~uQ zcP`5XGTb3~jfK{g8k&2JUn#oF+)Ic(oD<5kSK6{M@q25?jD24>^K6>bn`(Q=?0E2j z9dcz6@tXPK`-Cq%+Rgh<|3#tj0>g@FD|gKObP0l+XkKbG>C= literal 0 HcmV?d00001 diff --git a/Resources/form16_minimise.png b/Resources/form16_minimise.png new file mode 100644 index 0000000000000000000000000000000000000000..3bde4b5f9b258bee440ef37d66793ceaa0bbb1cd GIT binary patch literal 276 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSL74G){)!Z!phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7?o?)`q9B-hSNuDl_ zAr}63CtLHi81T3hOHMNm-k>UeLXb(;cglUopk)n`51W`cgV(f_Em7BbEV*<;@ArNE zhI$JceL2&g2c0^;V8PC1Q`~CUd5xkQlO2)|+k|jD^wwwovBdFL)Yo!Bxuzg}O`EU#py&90#LT=By}Z;C1rt3( zJ;P+JIo?1uQ#@T9LoEF7PTt7ZY{294K0WH+3^k8bZO1h~SrT5~H!!-ed9oLef+aJz zx~+TBoM1Nj0DjT9#5Qj2n>{Dqv@EMvvX6Ukc=mGhiD}|SO{rJiR>oX^6)pC2()rxo zm-4smmOLWiyF$-U7TZrPguwl44f?K*d0)m+BrgIjg3=1o;Ul#t;Z!}}tKZ?cQg g%qhnzTYlTr@ki*KHT#$<40IoZr>mdKI;Vst074IEbN~PV literal 0 HcmV?d00001 diff --git a/Resources/form16_restore.png b/Resources/form16_restore.png new file mode 100644 index 0000000000000000000000000000000000000000..b6651db303506754b53656d22adcf3f56efea8c4 GIT binary patch literal 318 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QJXPB%t#~Y|-kEe@c zh=u>z$&P$Y1_G`-d#c3qPdHsart8kYe_;w=dBMYFr`4|fFI8|^DsuP7WO1v@Gv_ZW z;YvQUF84M!heFz+TgzVW%57wwy|?&XL;lR>YgGZ46$}E`OxgPFM4Z$IkEPExAC>#I zPx6SwWS&{30uyZ?eOBMGJoPi%j(*`sa(Cih>|CCj$y{)?K&1G8VnFCsWj`r}fB*RE zesSB}6KY<@)_6YX^UYayPuVJbFO&+dt>qJT7vi3^M)rA>i&?qjb&a~2T{mQa{$TKQ L^>bP0l+XkKwy=4S literal 0 HcmV?d00001 diff --git a/Resources/form16_restore2.png b/Resources/form16_restore2.png new file mode 100644 index 0000000000000000000000000000000000000000..b61682c370d6d0ad0aaf8717e81cdc60632e2751 GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ;P+JIo?1u>pWc?LoEESPIlxwq#)q>+~`$ol>@ihE@zMJG7G;N>D?*0>GH>TLX>ZE zTgg*@xt5b3oE!X0-tb-dB`s;+xTK|;-Ky1g>RIK;`eQkvPwokRX-S;qwD!zbrE0?u z6LU0QPxYT{#}nkG<&w>&^jK=m?$VgW1|Jx04nF2y$2!;X_50MXV%PtjNVqMVQ`0K( z*gs8|M}Vj1bd>JCPYeP)nj2O#z0^&7 0); + } + + public bool DoQueryExist(string query, params string[] args) + { + string sql = SQLiteDatabase.PrepareQuery(query, args); + + return DoQueryExist(sql); + } + + public bool HasTable(string table_name) + { + lastError = string.Empty; + if (database == null) + { + return false; + } + + int rv = this.DoQueryCount("SELECT 1 FROM sqlite_master WHERE type='table' AND name='" + escapeSQL(table_name) + "'"); + + return (rv > 0); + } + + public bool CheckRequiredTables() + { + bool rv = true; + foreach (string tbl in requiredTableList) + { + if (string.IsNullOrEmpty(tbl)) + { + continue; + } + + if (!this.HasTable(tbl)) + { + rv = false; + break; + } + } + + return rv; + } + + + protected bool PrepareConfig() + { + if (HasTable(tableNameConfig)) + { + return true; + } + + bool rv = this.DoNonQuery(@" + BEGIN TRANSACTION; + CREATE TABLE " + tableNameConfig + @" (cfg_name TEXT, cfg_value TEXT); + COMMIT; + "); + + return rv; + } + + public bool SetConfig(string name, string value) + { + if (!PrepareConfig()) + { + return false; + } + + string sql = string.Empty; + int rv = this.DoQueryCount("SELECT 1 FROM " + tableNameConfig + " WHERE cfg_name='" + escapeSQL(name) + "'"); + if (rv <= 0) + { + sql = "INSERT INTO " + tableNameConfig + " (cfg_name, cfg_value) VALUES ('[^1]', '[^2]');"; + } + else + { + sql = "UPDATE " + tableNameConfig + " SET cfg_value='[^2]' WHERE cfg_name='[^1]';"; + } + + sql = PrepareQuery(sql, new string[] { name, value }); + + return this.DoNonQuery(sql); + } + + public string GetConfig(string name, string default_value = "") + { + if (!PrepareConfig()) + { + return default_value; + } + + bool rv = this.DoQueryExist("SELECT 1 FROM " + tableNameConfig + " WHERE cfg_name='" + escapeSQL(name) + "'"); + if (!rv) + { + return default_value; + } + + return this.DoQuerySingle("SELECT cfg_value FROM " + tableNameConfig + " WHERE cfg_name='" + escapeSQL(name) + "'"); + } + + #endregion + + protected virtual bool Prepare() + { + return true; + } + } +} \ No newline at end of file diff --git a/RyzStudio/Drawing/LeftRectangoid.cs b/RyzStudio/Drawing/LeftRectangoid.cs new file mode 100644 index 0000000..b421a98 --- /dev/null +++ b/RyzStudio/Drawing/LeftRectangoid.cs @@ -0,0 +1,137 @@ +namespace RyzStudio.Drawing +{ + using System.Drawing; + using System.Drawing.Drawing2D; + + public struct LeftRectangoid + { + private int X; + private int Y; + private int Width; + private int Height; + private int Radius; + + public LeftRectangoid(Rectangle rect, int radius) + { + X = rect.X; + Y = rect.Y; + Width = rect.Width; + Height = rect.Height; + Radius = radius; + } + + public LeftRectangoid(Rectangle rect, int radius, int borderWidth) + { + rect.Inflate((-1 * borderWidth), (-1 * borderWidth)); + + X = rect.X; + Y = rect.Y; + Width = rect.Width; + Height = rect.Height; + Radius = radius; + } + + public LeftRectangoid(int x, int y, int width, int height, int radius) + { + X = x; + Y = y; + Width = width; + Height = height; + Radius = radius; + } + + public LeftRectangoid(int x, int y, int width, int height) + { + X = x; + Y = y; + Width = width; + Height = height; + Radius = 0; + } + + public LeftRectangoid(int width, int height, int radius) + { + X = 0; + Y = 0; + Width = width; + Height = height; + Radius = radius; + } + + public LeftRectangoid(int width, int height) + { + X = 0; + Y = 0; + Width = width; + Height = height; + Radius = 0; + } + + public LeftRectangoid(int width) + { + X = 0; + Y = 0; + Width = width; + Height = width; + Radius = 0; + } + + public GraphicsPath ToGraphicsPath() + { + GraphicsPath rv = new GraphicsPath(); + + rv.AddLine(X + Width, Y + Height, X + this.Radius, Y + Height); + + if (this.Radius > 0) + { + rv.AddArc(X, Y + Height - (this.Radius * 2), this.Radius * 2, this.Radius * 2, 90, 90); + } + + rv.AddLine(X, Y + Height - (this.Radius * 2), X, Y + this.Radius); + + if (this.Radius > 0) + { + rv.AddArc(X, Y, this.Radius * 2, this.Radius * 2, 180, 90); + } + + rv.AddLine(X + Width, Y, X + this.Radius, Y); + + return rv; + } + + public GraphicsPath ToClosedGraphicsPath() + { + GraphicsPath rv = new GraphicsPath(); + + rv.AddLine(X + this.Radius, Y, X + Width, Y); + rv.AddLine(X + Width + this.Radius, Y + this.Radius, X + Width + this.Radius, Y + Height); + + rv.AddLine(X + Width + this.Radius, Y + Height, X + this.Radius, Y + Height); + + if (this.Radius > 0) + { + rv.AddArc(X, Y + Height - (this.Radius * 2), this.Radius * 2, this.Radius * 2, 90, 90); + } + + rv.AddLine(X, Y + Height - (this.Radius * 2), X, Y + this.Radius); + + if (this.Radius > 0) + { + rv.AddArc(X, Y, this.Radius * 2, this.Radius * 2, 180, 90); + } + + rv.AddLine(X + Width + this.Radius, Y, X + this.Radius, Y); + + return rv; + } + + public PointF GetOrigin() + { + PointF rv = new PointF(); + rv.X = ((float)Width / 2) + X; + rv.Y = ((float)Height / 2) + Y; + + return rv; + } + } +} \ No newline at end of file diff --git a/RyzStudio/Drawing/Rectangoid.cs b/RyzStudio/Drawing/Rectangoid.cs new file mode 100644 index 0000000..59a24d8 --- /dev/null +++ b/RyzStudio/Drawing/Rectangoid.cs @@ -0,0 +1,124 @@ +using System.Drawing; +using System.Drawing.Drawing2D; + +namespace RyzStudio.Drawing +{ + public struct Rectangoid + { + private int X; + private int Y; + private int Width; + private int Height; + private int Radius; + + public Rectangoid(Rectangle rect, int radius) + { + X = rect.X; + Y = rect.Y; + Width = rect.Width; + Height = rect.Height; + Radius = radius; + } + + public Rectangoid(Rectangle rect, int radius, int borderWidth) + { + rect.Inflate((-1 * borderWidth), (-1 * borderWidth)); + + X = rect.X; + Y = rect.Y; + Width = rect.Width; + Height = rect.Height; + Radius = radius; + } + + public Rectangoid(int x, int y, int width, int height, int radius) + { + X = x; + Y = y; + Width = width; + Height = height; + Radius = radius; + } + + public Rectangoid(int x, int y, int width, int height) + { + X = x; + Y = y; + Width = width; + Height = height; + Radius = 0; + } + + public Rectangoid(int width, int height, int radius) + { + X = 0; + Y = 0; + Width = width; + Height = height; + Radius = radius; + } + + public Rectangoid(int width, int height) + { + X = 0; + Y = 0; + Width = width; + Height = height; + Radius = 0; + } + + public Rectangoid(int width) + { + X = 0; + Y = 0; + Width = width; + Height = width; + Radius = 0; + } + + public GraphicsPath ToGraphicsPath() + { + GraphicsPath rv = new GraphicsPath(); + rv.AddLine(X + this.Radius, Y, X + Width - (this.Radius * 2), Y); + + if (this.Radius > 0) + { + rv.AddArc(X + Width - (this.Radius * 2), Y, this.Radius * 2, this.Radius * 2, 270, 90); + } + + rv.AddLine(X + Width, Y + this.Radius, X + Width, Y + Height - (this.Radius * 2)); + + if (this.Radius > 0) + { + rv.AddArc(X + Width - (this.Radius * 2), Y + Height - (this.Radius * 2), this.Radius * 2, this.Radius * 2, 0, 90); + } + + rv.AddLine(X + Width - (this.Radius * 2), Y + Height, X + this.Radius, Y + Height); + + if (this.Radius > 0) + { + rv.AddArc(X, Y + Height - (this.Radius * 2), this.Radius * 2, this.Radius * 2, 90, 90); + } + + rv.AddLine(X, Y + Height - (this.Radius * 2), X, Y + this.Radius); + + if (this.Radius > 0) + { + rv.AddArc(X, Y, this.Radius * 2, this.Radius * 2, 180, 90); + } + + rv.CloseFigure(); + + return rv; + } + + public PointF GetOrigin() + { + PointF rv = new PointF(); + rv.X = ((float)Width / 2) + X; + rv.Y = ((float)Height / 2) + Y; + + return rv; + } + } +} \ No newline at end of file diff --git a/RyzStudio/IO/FileType.cs b/RyzStudio/IO/FileType.cs new file mode 100644 index 0000000..3c8b616 --- /dev/null +++ b/RyzStudio/IO/FileType.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace RyzStudio.IO +{ + public class FileType + { + protected static readonly byte[] BMP = { 66, 77 }; + protected static readonly byte[] GIF = { 71, 73, 70, 56 }; + protected static readonly byte[] ICO = { 0, 0, 1, 0 }; + protected static readonly byte[] JPG = { 255, 216, 255 }; + protected static readonly byte[] PNG = { 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82 }; + + public static bool IsImage(byte[] byteArray) + { + if (byteArray == null) + { + return false; + } + + if (byteArray.Length <= 0) + { + return false; + } + + if (byteArray.Take(2).SequenceEqual(BMP)) + { + return true; + } + + if (byteArray.Take(4).SequenceEqual(GIF)) + { + return true; + } + + if (byteArray.Take(4).SequenceEqual(ICO)) + { + return true; + } + + if (byteArray.Take(3).SequenceEqual(JPG)) + { + return true; + } + + if (byteArray.Take(16).SequenceEqual(PNG)) + { + return true; + } + + return false; + } + } +} diff --git a/RyzStudio/IO/SessionFileFormatBase.cs b/RyzStudio/IO/SessionFileFormatBase.cs new file mode 100644 index 0000000..3ae2887 --- /dev/null +++ b/RyzStudio/IO/SessionFileFormatBase.cs @@ -0,0 +1,290 @@ +using System; +using System.IO; +using System.Text; +using System.Xml; +using System.Windows.Forms; +using ICSharpCode.SharpZipLib.Zip; + +namespace RyzStudio.IO +{ + public abstract class SessionFileFormatBase + { + protected string CONST_KEYPASS = ""; + protected string CONST_PRODUCT = ""; + protected string CONST_STREAM_FILE_NAME = ""; + + protected bool enableErrorReporting = false; + protected string lastUsedFileName = ""; + + #region public properties + + public string passkey + { + get { return CONST_KEYPASS; } + set { CONST_KEYPASS = value; } + } + + /*public string LastFilename + { + get { return lastUsedFileName; } + set { lastUsedFileName = value; } + }*/ + + #endregion + + #region public methods + +/* public bool loadFromRyz() + { + return loadFromRyz(lastUsedFileName); + }*/ + + public bool loadFromRyz(string file_name) + { + lastUsedFileName = file_name; + if (!File.Exists(file_name)) + { + return false; + } + + bool rv = false; + + try + { + ZipInputStream zipIn = new ZipInputStream(File.OpenRead(file_name)); + zipIn.Password = CONST_KEYPASS; + ZipEntry theEntry = null; + + while ((theEntry = zipIn.GetNextEntry()) != null) + { + string streamFileName = Path.GetFileName(theEntry.Name); + if (streamFileName.Equals(CONST_STREAM_FILE_NAME)) + { + MemoryStream oxStream = new MemoryStream(); + StreamWriter streamWriter = new StreamWriter(oxStream); + int size = 2048; + byte[] data = new byte[size]; + while (true) + { + size = zipIn.Read(data, 0, data.Length); + if (size <= 0) break; + streamWriter.BaseStream.Write(data, 0, size); + } + + oxStream.Position = 0; + + StreamReader sr2 = new StreamReader(oxStream, Encoding.UTF8); + XmlDocument xDoc = new XmlDocument(); + xDoc.LoadXml(sr2.ReadToEnd()); + + loadFromXmlDocument(ref xDoc); + } + } + + zipIn.Close(); + + rv = true; + } + catch (Exception exc) + { + if (enableErrorReporting) + { + MessageBox.Show(exc.Message); + } + } + + return rv; + } + + public bool loadFromXml() + { + return loadFromXml(lastUsedFileName); + } + + public bool loadFromXml(string file_name) + { + lastUsedFileName = file_name; + if (!File.Exists(file_name)) + { + return false; + } + + bool rv = false; + + try + { + StreamReader sr2 = new StreamReader(file_name, Encoding.UTF8); + XmlDocument xDoc = new XmlDocument(); + xDoc.LoadXml(sr2.ReadToEnd()); + + loadFromXmlDocument(ref xDoc); + sr2.Close(); + + rv = true; + } + catch (Exception exc) + { + if (enableErrorReporting) + { + MessageBox.Show(exc.Message); + } + } + + return rv; + } + +/* public bool saveToRyz() + { + return saveToRyz(lastUsedFileName); + } +*/ + + public bool saveToRyz(string file_name) + { + bool rv = false; + lastUsedFileName = file_name; + byte[] buffer = new byte[4096]; + + try + { + File.Delete(file_name); + FileInfo fileinfo1 = new FileInfo(file_name); + if (!Directory.Exists(fileinfo1.DirectoryName)) + { + Directory.CreateDirectory(fileinfo1.DirectoryName); + } + } + catch (Exception exc) + { + if (enableErrorReporting) + { + MessageBox.Show(exc.Message); + } + } + + try + { + ZipOutputStream zipOutStream1 = new ZipOutputStream(File.Create(file_name)); + zipOutStream1.SetLevel(9); + zipOutStream1.Password = CONST_KEYPASS; + + MemoryStream oxIndexStream = new MemoryStream(); + XmlTextWriter oxTW = new XmlTextWriter(oxIndexStream, Encoding.UTF8); + saveToXmlTextWriter(ref oxTW); + oxTW.Flush(); + + // write to file + zipOutStream1.PutNextEntry(new ZipEntry(CONST_STREAM_FILE_NAME)); + oxIndexStream.Position = 0; + StreamReader sr2 = new StreamReader(oxIndexStream, Encoding.UTF8); + int sourceBytes; + do + { + sourceBytes = sr2.BaseStream.Read(buffer, 0, buffer.Length); + zipOutStream1.Write(buffer, 0, sourceBytes); + } + while (sourceBytes > 0); + + sr2.Close(); + oxTW.Close(); + zipOutStream1.Finish(); + zipOutStream1.Close(); + + rv = true; + } + catch (Exception exc) + { + if (enableErrorReporting) + { + MessageBox.Show(exc.Message); + } + } + + return rv; + } + + public bool saveToXml() + { + return saveToXml(lastUsedFileName); + } + + public bool saveToXml(string file_name) + { + bool rv = false; + + lastUsedFileName = file_name; + try + { + File.Delete(file_name); + FileInfo fileinfo1 = new FileInfo(file_name); + if (!Directory.Exists(fileinfo1.DirectoryName)) + { + Directory.CreateDirectory(fileinfo1.DirectoryName); + } + } + catch (Exception exc) + { + if (enableErrorReporting) + { + MessageBox.Show(exc.Message); + } + } + + try + { + XmlTextWriter oxTW = new XmlTextWriter(file_name, Encoding.UTF8); + saveToXmlTextWriter(ref oxTW); + oxTW.Flush(); + oxTW.Close(); + + rv = true; + } + catch (Exception exc) + { + if (enableErrorReporting) + { + MessageBox.Show(exc.Message); + } + } + + return rv; + } + + #endregion + + protected virtual void loadFromXmlDocument(ref XmlDocument xml_doc) { } + protected virtual void saveToXmlTextWriter(ref XmlTextWriter writer) { } + + #region public methods (conversions) + + public int[] convIntArrayString(string s1, char c) + { + string[] sarr = s1.Split(c); + int[] iarr = new int[sarr.Length]; + for (int i = 0; i < sarr.Length; i++) + { + iarr[i] = Int32.Parse(sarr[i]); + } + + return iarr; + } + + public string convStringIntArray(int[] r, char s) + { + string t = null; + for (int i = 0; i < r.Length; i++) + { + if (i != 0) + { + t += s.ToString(); + } + + t += r[i].ToString(); + } + + return t; + } + +#endregion + } +} \ No newline at end of file diff --git a/RyzStudio/IO/SharpZipLib.cs b/RyzStudio/IO/SharpZipLib.cs new file mode 100644 index 0000000..b162124 --- /dev/null +++ b/RyzStudio/IO/SharpZipLib.cs @@ -0,0 +1,76 @@ +using System; +using System.IO; +using ICSharpCode.SharpZipLib.Zip; + +namespace RyzStudio.IO +{ + public class SharpZipLib + { + /// + /// Is zip file encrypted + /// + /// Filename + /// Is encrypted + public static bool IsZipEncrypted(string fn) + { + bool ret_val = false; + try + { + ZipInputStream zipIn = new ZipInputStream(System.IO.File.OpenRead(fn)); + ZipEntry theEntry = null; + while ((theEntry = zipIn.GetNextEntry()) != null) + { + if (theEntry.IsCrypted) + { + ret_val = true; + } + + break; + } + + zipIn.Close(); + } + catch + { + // do nothing + } + + return ret_val; + } + + public static void AddFile(ZipOutputStream zipstream, string filename, string prefixpath = null) + { + byte[] buffer = new byte[4096]; + + string f1 = ""; + if (prefixpath != null) + { + f1 = Path.GetDirectoryName(filename).TrimEnd('\\') + "\\"; + f1 = f1.Replace(prefixpath, "").TrimEnd('\\') + "\\"; + f1 = f1 + Path.GetFileName(filename); + f1 = f1.TrimStart('\\'); + } + + ZipEntry entry = new ZipEntry(f1); + entry.DateTime = DateTime.Now; + zipstream.PutNextEntry(entry); + + FileStream fs = File.OpenRead(filename); + int sourceBytes; + do + { + sourceBytes = fs.Read(buffer, 0, buffer.Length); + zipstream.Write(buffer, 0, sourceBytes); + } + while (sourceBytes > 0); + } + + public static void AddFolder(ZipOutputStream zipstream, string folderpath, string prefixpath = null) + { + foreach (string fn in Directory.GetFiles(folderpath, "*.*", System.IO.SearchOption.AllDirectories)) + { + AddFile(zipstream, fn, prefixpath); + } + } + } +} \ No newline at end of file diff --git a/RyzStudio/Net/HttpWeb.cs b/RyzStudio/Net/HttpWeb.cs new file mode 100644 index 0000000..bafff2e --- /dev/null +++ b/RyzStudio/Net/HttpWeb.cs @@ -0,0 +1,168 @@ +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Windows.Forms; + +namespace RyzStudio.Net +{ + public class HttpWeb + { + public string defaultUserAgent = "Momozilla/5.0 (" + Environment.OSVersion.Platform.ToString() + " ; " + Environment.OSVersion.VersionString + "; " + Application.CurrentCulture.TwoLetterISOLanguageName + ")"; + public int defaultTimeout = 6000; + public int defaultMaxRedirect = 8; + public bool defaultAllowRedirect = true; + public CookieContainer defaultCookierContainer = null; + + public HttpWeb() + { + } + + public HttpWebRequest CreateRequest(string url) + { + return this.CreateRequest(url, url); + } + + public HttpWebRequest CreateRequest(string url, string referrerURL) + { + if (defaultCookierContainer == null) + { + defaultCookierContainer = new CookieContainer(); + } + + HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); + webRequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); + webRequest.MaximumAutomaticRedirections = defaultMaxRedirect; + webRequest.CookieContainer = defaultCookierContainer; + webRequest.UserAgent = defaultUserAgent; + webRequest.AllowAutoRedirect = defaultAllowRedirect; + webRequest.Timeout = defaultTimeout; + + return webRequest; + } + + public int GetResponse(out string sourceCode, string url, string referrerURL = "") + { + HttpWebRequest webRequest = this.CreateRequest(url, referrerURL); + + return GetResponse(out sourceCode, webRequest); + } + + public int GetResponse(out string sourceCode, HttpWebRequest webRequest) + { + sourceCode = string.Empty; + + int rv = 0; + + try + { + HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); + + rv = (int)webResponse.StatusCode; + + StreamReader readContent = new StreamReader(webResponse.GetResponseStream()); + sourceCode = readContent.ReadToEnd(); + + webResponse.Close(); + webResponse = null; + } + catch (WebException xc) + { + if (xc.Response is HttpWebResponse) + { + HttpWebResponse rs = xc.Response as HttpWebResponse; + StreamReader readContent = new StreamReader(rs.GetResponseStream()); + if (readContent != null) + { + sourceCode = readContent.ReadToEnd(); + } + + rv = (int)rs.StatusCode; + } + else + { + rv = (int)xc.Status; + sourceCode = xc.Message; + } + } + catch (Exception xc) + { + sourceCode = xc.Message; + } + + return rv; + } + + public static HttpWebRequest AddBasicAuthentication(HttpWebRequest webRequest, string username, string password) + { + webRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(string.Concat(username, ":", password))); + webRequest.PreAuthenticate = true; + + return webRequest; + } + + + public int GetPOSTResponse(out string sourceCode, HttpWebRequest webRequest, string postData) + { + sourceCode = ""; + int rv = 0; + byte[] buffer = Encoding.UTF8.GetBytes(postData); + + webRequest.ContentLength = buffer.Length; + + try + { + Stream dataStream = webRequest.GetRequestStream(); + dataStream.Write(buffer, 0, buffer.Length); + dataStream.Close(); + } + catch (Exception xc) + { + sourceCode = xc.Message; + return rv; + } + + return this.GetResponse(out sourceCode, webRequest); + } + + public int GetHeader(out WebHeaderCollection headerCollection, string url, string referrerURL = "") + { + headerCollection = null; + + int rv = 0; + + HttpWebRequest webRequest = this.CreateRequest(url, referrerURL); + webRequest.Method = "HEAD"; + + try + { + HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); + headerCollection = webResponse.Headers; + + rv = (int)webResponse.StatusCode; + + webResponse.Close(); + webResponse = null; + } + catch (WebException xc) + { + if (xc.Response is HttpWebResponse) + { + HttpWebResponse rs = xc.Response as HttpWebResponse; + + rv = (int)rs.StatusCode; + } + else + { + rv = (int)xc.Status; + } + } + catch + { + // do nothing + } + + return rv; + } + } +} \ No newline at end of file diff --git a/RyzStudio/String.cs b/RyzStudio/String.cs new file mode 100644 index 0000000..c6c4510 --- /dev/null +++ b/RyzStudio/String.cs @@ -0,0 +1,36 @@ +using System; +using System.IO; +using System.Security.Cryptography; +using System.Text; + +namespace RyzStudio +{ + public class String + { + public static string EncodeTo64(string value) + { + try + { + byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(value); + return System.Convert.ToBase64String(toEncodeAsBytes); + } + catch + { + return string.Empty; + } + } + + public static string DecodeFrom64(string value) + { + try + { + byte[] encodedDataAsBytes = System.Convert.FromBase64String(value); + return System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes); + } + catch + { + return string.Empty; + } + } + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/Forms/HorizontalSeparator.Designer.cs b/RyzStudio/Windows/Forms/HorizontalSeparator.Designer.cs new file mode 100644 index 0000000..7fa6fd6 --- /dev/null +++ b/RyzStudio/Windows/Forms/HorizontalSeparator.Designer.cs @@ -0,0 +1,37 @@ +namespace RyzStudio.Windows.Forms +{ + partial class HorizontalSeparator + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/RyzStudio/Windows/Forms/HorizontalSeparator.cs b/RyzStudio/Windows/Forms/HorizontalSeparator.cs new file mode 100644 index 0000000..1c7aeba --- /dev/null +++ b/RyzStudio/Windows/Forms/HorizontalSeparator.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace RyzStudio.Windows.Forms +{ + public partial class HorizontalSeparator : System.Windows.Forms.UserControl + { + public HorizontalSeparator() + { + InitializeComponent(); + + this.MaximumSize = new Size(SystemInformation.VirtualScreen.Width, 2); + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + base.OnPaintBackground(e); + + Graphics g = e.Graphics; + g.FillRectangle(new SolidBrush(Color.FromArgb(213, 223, 229)), new Rectangle(this.DisplayRectangle.Left, 0, this.DisplayRectangle.Width, 1)); + g.FillRectangle(new SolidBrush(Color.FromArgb(249, 251, 253)), new Rectangle(this.DisplayRectangle.Left, 1, this.DisplayRectangle.Width, 1)); + } + } +} diff --git a/RyzStudio/Windows/Forms/ImageBox.cs b/RyzStudio/Windows/Forms/ImageBox.cs new file mode 100644 index 0000000..eebcc75 --- /dev/null +++ b/RyzStudio/Windows/Forms/ImageBox.cs @@ -0,0 +1,54 @@ +using System; +using System.ComponentModel; +using System.Drawing; + +namespace RyzStudio.Windows.Forms +{ + public class ImageBox : System.Windows.Forms.PictureBox + { + public ImageBox() : base() + { + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.ErrorImage = null; + this.InitialImage = null; + this.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + } + + protected override void OnCreateControl() + { + OnMouseLeave(null); + + base.OnCreateControl(); + } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Image Image { get => base.Image; set { base.Image = value; } } + + [Category("Appearance"), Browsable(true)] + public Image NormalImage { get; set; } + + [Category("Appearance"), Browsable(true)] + public Image HighlightImage { get; set; } + + protected override void OnMouseEnter(EventArgs e) + { + this.Image = this.HighlightImage; + + base.OnMouseEnter(e); + } + + protected override void OnMouseLeave(EventArgs e) + { + this.Image = this.NormalImage; + + base.OnMouseLeave(e); + } + + protected override void OnLostFocus(EventArgs e) + { + this.Image = this.NormalImage; + + base.OnLostFocus(e); + } + } +} diff --git a/RyzStudio/Windows/Forms/PanelBook.Designer.cs b/RyzStudio/Windows/Forms/PanelBook.Designer.cs new file mode 100644 index 0000000..576b43a --- /dev/null +++ b/RyzStudio/Windows/Forms/PanelBook.Designer.cs @@ -0,0 +1,37 @@ +namespace RyzStudio.Windows.Forms +{ + partial class PanelBook + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/RyzStudio/Windows/Forms/PanelBook.cs b/RyzStudio/Windows/Forms/PanelBook.cs new file mode 100644 index 0000000..190ec28 --- /dev/null +++ b/RyzStudio/Windows/Forms/PanelBook.cs @@ -0,0 +1,159 @@ +namespace RyzStudio.Windows.Forms +{ + using System; + using System.ComponentModel; + using System.Windows.Forms; + + [ToolboxItem(true)] + public partial class PanelBook : UserControl + { + protected PanelCollection panelCollection = null; + + public PanelBook() + { + InitializeComponent(); + + panelCollection = new PanelCollection(this); + + } + + public Panel ActivePanel { get; set; } = null; + + [Category("Collection")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + public PanelCollection Pages + { + get { return panelCollection; } + } + + [Category("Collection")] + public int SelectedIndex + { + get + { + if (panelCollection.Count <= 0) + { + return -1; + } + + return panelCollection.IndexOf(this.ActivePanel); + } + set + { + if (panelCollection.Count <= 0) + { + return; + } + + if (value < 0) + { + return; + } + + if (value > (panelCollection.Count - 1)) + { + return; + } + + if (value == this.SelectedIndex) + { + return; + } + + ActivatePanel(value); + } + } + + protected internal int PageIndex + { + get + { + return panelCollection.IndexOf(this.ActivePanel); + } + set + { + if (panelCollection.Count <= 0) + { + ActivatePanel(-1); + return; + } + + if ((value < -1) || (value >= panelCollection.Count)) + { + throw new ArgumentOutOfRangeException("PageIndex", value, "The page index must be between 0 and " + Convert.ToString(panelCollection.Count - 1)); + } + + ActivatePanel(value); + } + } + + protected internal void ActivatePanel(int index) + { + if ((panelCollection.Count == 0) && (index >= panelCollection.Count) && (index <= 0)) + { + return; + } + + Panel p = (Panel)panelCollection[index]; + + ActivatePage(p); + } + + protected internal void ActivatePage(Panel page) + { + if (this.ActivePanel != null) + { + this.ActivePanel.Visible = false; + } + + this.ActivePanel = page; + if (this.ActivePanel != null) + { + this.ActivePanel.Parent = this; + if (!this.Contains(this.ActivePanel)) + { + this.Container.Add(this.ActivePanel); + } + + this.ActivePanel.Dock = DockStyle.Fill; + this.ActivePanel.Visible = true; + this.ActivePanel.BringToFront(); + } + + if (this.ActivePanel != null) + { + this.ActivePanel.Invalidate(); + } + else + { + this.Invalidate(); + } + } + +#if DEBUG + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + if (this.DesignMode) + { + this.Invalidate(); + } + } + +#endif + + protected override void DestroyHandle() + { + base.DestroyHandle(); + + foreach (Panel p in panelCollection) + { + p.Dispose(); + } + } + + + } +} diff --git a/RyzStudio/Windows/Forms/PanelCollection.cs b/RyzStudio/Windows/Forms/PanelCollection.cs new file mode 100644 index 0000000..af9838b --- /dev/null +++ b/RyzStudio/Windows/Forms/PanelCollection.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RyzStudio.Windows.Forms +{ + [ToolboxItem(true)] + public class PanelCollection : CollectionBase + { + protected PanelBook panelBook = null; + + public PanelCollection() + { + + } + + public PanelCollection(PanelBook parent) : base() + { + panelBook = parent; + } + + public PanelBook Parent => panelBook; + + public Panel this[int index] { get => (Panel)List[index]; set => List[index] = value; } + + public int Add(Panel value) => List.Add(value); + + public void AddRange(Panel[] pages) + { + foreach (Panel page in pages) + { + this.Add(page); + } + } + + public int IndexOf(Panel value) => (List.IndexOf(value)); + + public void Insert(int index, Panel value) => List.Insert(index, value); + + public void Remove(Panel value) => List.Remove(value); + + public bool Contains(Panel value) => List.Contains(value); + + protected override void OnInsertComplete(int index, object value) + { + base.OnInsertComplete(index, value); + + if (panelBook != null) + { + panelBook.PageIndex = index; + } + } + + protected override void OnRemoveComplete(int index, object value) + { + base.OnRemoveComplete(index, value); + + if (panelBook != null) + { + if (panelBook.PageIndex == index) + { + if (index < InnerList.Count) + { + panelBook.PageIndex = index; + } + else + { + panelBook.PageIndex = InnerList.Count - 1; + } + } + } + } + + } +} diff --git a/RyzStudio/Windows/Forms/StackLayoutPanel.cs b/RyzStudio/Windows/Forms/StackLayoutPanel.cs new file mode 100644 index 0000000..8cdeae5 --- /dev/null +++ b/RyzStudio/Windows/Forms/StackLayoutPanel.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RyzStudio.Windows.Forms +{ + public class StackLayoutPanel : FlowLayoutPanel + { + public StackLayoutPanel() : base() + { + this.AutoScroll = true; + this.FlowDirection = FlowDirection.TopDown; + this.WrapContents = false; + } + + protected override void OnResize(EventArgs eventargs) + { + base.OnResize(eventargs); + + //int w = this.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth; + int w = this.ClientRectangle.Width - 1; + + foreach (Control item in this.Controls) + { + if (item.Width != w) + { + item.Width = w; + } + } + } + + protected override void OnControlAdded(ControlEventArgs e) + { + base.OnControlAdded(e); + + OnResize(null); + } + + protected override void OnControlRemoved(ControlEventArgs e) + { + base.OnControlRemoved(e); + + OnResize(null); + } + + public void AddControl(Control value) + { + if (this.InvokeRequired) + { + this.Invoke(new MethodInvoker(() => + { + value.Margin = new Padding(0, 3, 0, 3); + + this.Controls.Add(value); + })); + } + else + { + value.Margin = new Padding(0, 3, 0, 3); + + this.Controls.Add(value); + } + } + + } +} diff --git a/RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs b/RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs new file mode 100644 index 0000000..04e71d5 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs @@ -0,0 +1,191 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class BorderlessForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BorderlessForm)); + this.label1 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.area1 = new System.Windows.Forms.Panel(); + this.pictureBox4 = new RyzStudio.Windows.Forms.ImageBox(); + this.pictureBox2 = new RyzStudio.Windows.Forms.ImageBox(); + this.pictureBox1 = new RyzStudio.Windows.Forms.ImageBox(); + this.pictureBox3 = new RyzStudio.Windows.Forms.ImageBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); + this.label1.Location = new System.Drawing.Point(1, 1); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(48, 0, 0, 0); + this.label1.Size = new System.Drawing.Size(454, 48); + this.label1.TabIndex = 148; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label1.DoubleClick += new System.EventHandler(this.label1_DoubleClick); + this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); + this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown); + this.label1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label1_MouseMove); + this.label1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label1_MouseUp); + // + // panel1 + // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.panel1.BackColor = System.Drawing.Color.Transparent; + this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNWSE; + this.panel1.Location = new System.Drawing.Point(594, 674); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(6, 6); + this.panel1.TabIndex = 150; + this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); + this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); + this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp); + // + // area1 + // + this.area1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.area1.BackColor = System.Drawing.Color.Transparent; + this.area1.Cursor = System.Windows.Forms.Cursors.SizeNS; + this.area1.Location = new System.Drawing.Point(1, 674); + this.area1.Name = "area1"; + this.area1.Size = new System.Drawing.Size(592, 6); + this.area1.TabIndex = 152; + this.area1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown); + this.area1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove); + this.area1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseUp); + // + // pictureBox4 + // + this.pictureBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBox4.BackColor = System.Drawing.Color.Transparent; + this.pictureBox4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox4.ErrorImage = null; + this.pictureBox4.HighlightImage = global::hiim.dply.Properties.Resources.form20_menu2; + this.pictureBox4.Image = global::hiim.dply.Properties.Resources.form20_menu; + this.pictureBox4.InitialImage = null; + this.pictureBox4.Location = new System.Drawing.Point(460, 11); + this.pictureBox4.Name = "pictureBox4"; + this.pictureBox4.NormalImage = global::hiim.dply.Properties.Resources.form20_menu; + this.pictureBox4.Size = new System.Drawing.Size(28, 28); + this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox4.TabIndex = 149; + this.pictureBox4.TabStop = false; + // + // pictureBox2 + // + this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBox2.BackColor = System.Drawing.Color.Transparent; + this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox2.ErrorImage = null; + this.pictureBox2.HighlightImage = global::hiim.dply.Properties.Resources.form20_maximise2; + this.pictureBox2.Image = global::hiim.dply.Properties.Resources.form20_maximise; + this.pictureBox2.InitialImage = null; + this.pictureBox2.Location = new System.Drawing.Point(528, 11); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.NormalImage = global::hiim.dply.Properties.Resources.form20_maximise; + this.pictureBox2.Size = new System.Drawing.Size(28, 28); + this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox2.TabIndex = 147; + this.pictureBox2.TabStop = false; + // + // pictureBox1 + // + this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBox1.BackColor = System.Drawing.Color.Transparent; + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.ErrorImage = null; + this.pictureBox1.HighlightImage = global::hiim.dply.Properties.Resources.form20_minimise2; + this.pictureBox1.Image = global::hiim.dply.Properties.Resources.form20_minimise; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(494, 11); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.NormalImage = global::hiim.dply.Properties.Resources.form20_minimise; + this.pictureBox1.Size = new System.Drawing.Size(28, 28); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox1.TabIndex = 146; + this.pictureBox1.TabStop = false; + // + // pictureBox3 + // + this.pictureBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBox3.BackColor = System.Drawing.Color.Transparent; + this.pictureBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox3.ErrorImage = null; + this.pictureBox3.HighlightImage = global::hiim.dply.Properties.Resources.form20_close2; + this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image"))); + this.pictureBox3.InitialImage = null; + this.pictureBox3.Location = new System.Drawing.Point(562, 11); + this.pictureBox3.Name = "pictureBox3"; + this.pictureBox3.NormalImage = ((System.Drawing.Image)(resources.GetObject("pictureBox3.NormalImage"))); + this.pictureBox3.Size = new System.Drawing.Size(28, 28); + this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox3.TabIndex = 145; + this.pictureBox3.TabStop = false; + // + // BorderlessForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.WhiteSmoke; + this.ClientSize = new System.Drawing.Size(600, 680); + this.Controls.Add(this.area1); + this.Controls.Add(this.panel1); + this.Controls.Add(this.pictureBox4); + this.Controls.Add(this.label1); + this.Controls.Add(this.pictureBox2); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.pictureBox3); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "BorderlessForm"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + protected internal Forms.ImageBox pictureBox2; + protected internal Forms.ImageBox pictureBox1; + protected internal Forms.ImageBox pictureBox3; + protected internal System.Windows.Forms.Label label1; + protected internal Forms.ImageBox pictureBox4; + protected internal System.Windows.Forms.Panel panel1; + protected internal System.Windows.Forms.Panel area1; + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessForm.cs b/RyzStudio/Windows/ThemedForms/BorderlessForm.cs new file mode 100644 index 0000000..c5e4efe --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/BorderlessForm.cs @@ -0,0 +1,410 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.ComponentModel; + using System.Drawing; + using System.Drawing.Design; + using System.Windows.Forms; + using Resources = hiim.dply.Properties.Resources; + + public partial class BorderlessForm : System.Windows.Forms.Form + { + protected bool isBusy = false; + + protected Color topFillColour = Color.FromArgb(15, 15, 15); + protected int topFillHeight = 48; + protected Color bottomFillColour = Color.FromArgb(15, 15, 15); + protected int bottomFillMargin = 19; + protected int bottomLeftMargin = 20; + protected int borderWidth = 1; + protected int menuFillWidth = 160; + protected Color menuFillColour = Color.FromArgb(179, 179, 179); + + private bool windowDragging = false; + private Point windowOffset = new Point(); + private Point windowSize = new Point(); + + public BorderlessForm() : base() + { + this.InitializeComponent(); + + this.BackColor = Color.FromArgb(247, 247, 247); + this.FormBorderStyle = FormBorderStyle.None; + this.Padding = new Padding(1); + + this.topFillColour = Color.FromArgb(51, 51, 51); + this.topFillHeight = 48; + this.bottomFillColour = Color.FromArgb(0, 152, 167); + this.bottomFillMargin = 6; + + pictureBox1.Click += pictureBox1_Click; + pictureBox2.Click += pictureBox2_Click; + pictureBox3.Click += pictureBox3_Click; + pictureBox4.Click += pictureBox4_Click; + + updatePictureBox2Image(); + } + + protected override void OnClosing(CancelEventArgs e) + { + base.OnClosing(e); + + if (this.IsBusy) + { + e.Cancel = true; + } + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + Graphics g = e.Graphics; + + Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, this.Padding.Top, this.DisplayRectangle.Width, topFillHeight); + Rectangle areaBottom = new Rectangle(this.DisplayRectangle.Left, (this.DisplayRectangle.Height - bottomFillMargin + this.Padding.Top), this.DisplayRectangle.Width, bottomFillMargin); + Rectangle areaBorder = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width - borderWidth, this.ClientRectangle.Height - borderWidth); + + Rectangle areaMenu = new Rectangle(this.DisplayRectangle.Left, this.DisplayRectangle.Top + topFillHeight, menuFillWidth, (this.DisplayRectangle.Height - bottomFillMargin - topFillHeight)); + + // draw header + if (topFillHeight > 0) + { + g.FillRectangle(new SolidBrush(topFillColour), areaTop); + } + + // fill menu + g.FillRectangle(new SolidBrush(menuFillColour), areaMenu); + + // draw footer + if (bottomFillMargin > 0) + { + g.FillRectangle(new SolidBrush(bottomFillColour), areaBottom); + } + + // draw logo + if (this.TitleLogo != null) + { + g.DrawImageUnscaled(this.TitleLogo, this.Padding.Left, this.Padding.Top); + } + + if (this.Banner != null) + { + g.DrawImageUnscaled(this.Banner, this.Padding.Left + bottomLeftMargin, (this.DisplayRectangle.Height - this.Banner.Height - bottomFillMargin + this.Padding.Top), (this.DisplayRectangle.Width - (this.Padding.Left + this.Padding.Right)), this.Banner.Height); + } + + g.DrawRectangle(new Pen(Color.Black, borderWidth), areaBorder); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + updatePictureBox2Image(); + + this.Invalidate(); + } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Color BackColor { get => base.BackColor; set => base.BackColor = value; } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Padding { get => base.Padding; set => base.Padding = value; } + + [Category("Appearance"), Browsable(true)] + public string Description + { + get + { + return label1.Text?.Replace("\n", "\\n"); + } + set + { + label1.Text = value?.Replace("\\n", "\n"); + } + } + + [Category("Appearance"), Browsable(true)] + public Image TitleLogo { get; set; } + + [Category("Appearance"), Browsable(true)] + public Image Banner { get; set; } + + [Category("Appearance"), Browsable(true)] + public bool ShowMenuButton { get => pictureBox4.Visible; set => pictureBox4.Visible = value; } + + protected virtual bool IsBusy { get => isBusy; set => isBusy = value; } + + private void pictureBox4_Click(object sender, System.EventArgs e) + { + //this.WindowState = FormWindowState.Minimized; + } + + private void pictureBox1_Click(object sender, System.EventArgs e) + { + MouseEventArgs mouseEvent = (MouseEventArgs)e; + if (mouseEvent != null) + { + if (mouseEvent.Button != MouseButtons.Left) + { + return; + } + } + + this.WindowState = FormWindowState.Minimized; + } + + private void pictureBox2_Click(object sender, System.EventArgs e) + { + MouseEventArgs mouseEvent = (MouseEventArgs)e; + if (mouseEvent != null) + { + if (mouseEvent.Button != MouseButtons.Left) + { + return; + } + } + + if (this.WindowState == FormWindowState.Maximized) + { + this.WindowState = FormWindowState.Normal; + pictureBox2.NormalImage = Resources.form20_maximise; + pictureBox2.HighlightImage = Resources.form20_maximise2; + } + else + { + this.WindowState = FormWindowState.Maximized; + pictureBox2.NormalImage = Resources.form20_restore; + pictureBox2.HighlightImage = Resources.form20_restore2; + } + } + + private void pictureBox3_Click(object sender, System.EventArgs e) + { + MouseEventArgs mouseEvent = (MouseEventArgs)e; + if (mouseEvent != null) + { + if (mouseEvent.Button != MouseButtons.Left) + { + return; + } + } + + this.Close(); + } + + public void SetValue(Label sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void SetValue(GroupBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void AddValue(ListBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Add(value); })); + } + else + { + sender.Items.Add(value); + } + } + + public void AddControl(FlowLayoutPanel sender, Control value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => + { + sender.Controls.Add(value); + })); + } + else + { + sender.Controls.Add(value); + } + } + + public void ClearValues(ListBox sender) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Clear(); })); + } + else + { + sender.Items.Clear(); + } + } + + public string GetValue(ListBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); })); + } + else + { + rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); + } + + return rv; + } + + public string GetValue(TextBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = sender.Text.Trim(); })); + } + else + { + rv = sender.Text.Trim(); + } + + return rv; + } + + public int GetValue(NumericUpDown sender) + { + int rv = 0; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (int)sender.Value; })); + } + else + { + rv = (int)sender.Value; + } + + return rv; + } + + protected void updatePictureBox2Image() + { + if (this.WindowState == FormWindowState.Maximized) + { + pictureBox2.NormalImage = Resources.form20_restore; + pictureBox2.HighlightImage = Resources.form20_restore2; + } + else + { + pictureBox2.NormalImage = Resources.form20_maximise; + pictureBox2.HighlightImage = Resources.form20_maximise2; + } + } + + private void label1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + } + + private void label1_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + private void label1_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + Point currentScreenPos = PointToScreen(e.Location); + Location = new Point(currentScreenPos.X - windowOffset.X, currentScreenPos.Y - windowOffset.Y); + } + } + + private void label1_DoubleClick(object sender, EventArgs e) => pictureBox2_Click(sender, e); + + private void label1_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Middle) + { + this.TopMost = !this.TopMost; + } + } + + private void panel1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + windowSize = new Point(this.Width, this.Height); + } + + private void panel1_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + private void panel1_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + this.Size = new Size(e.X - windowOffset.X + this.Width, e.Y - windowOffset.Y + this.Height); + } + } + + private void panel2_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + windowSize = new Point(this.Width, this.Height); + } + + private void panel2_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + private void panel2_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + this.Size = new Size(windowSize.X, e.Y - windowOffset.Y + this.Height); + } + } + + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessForm.resx b/RyzStudio/Windows/ThemedForms/BorderlessForm.resx new file mode 100644 index 0000000..db173e1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/BorderlessForm.resx @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + + + iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADnSURBVDhP1ZVB + DoIwEEW7whNo9Cri/QCv5Y4YEoTWxK71Gvqn+W2AgEkbNvxkYPgzfWkpKcpau9NaX/u+/yC+iSFjK3Ay + RdhcU0qUChc3s67rzipRGJ8T+JYHR2ctWYGzXSC8Gzbs3rbtgZaSXDyp0QoKnJBMBK8WH5vVCUhCcvbX + bAuivwxsmmaP2TxYfyE3zJ/Ij2wLYu3/OxQoah4kYedgIt8TDTTGnFgeyfcsAodLxn205Dlo4IRkInjr + bgq8dT+bWG0L6A/WnLVo4b1eyHDHV8WHNaJwvwAkJeI9KMSGjC201tkP+AimzgF8cMEAAAAASUVORK5C + YII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADnSURBVDhP1ZVB + DoIwEEW7whNo9Cri/QCv5Y4YEoTWxK71Gvqn+W2AgEkbNvxkYPgzfWkpKcpau9NaX/u+/yC+iSFjK3Ay + RdhcU0qUChc3s67rzipRGJ8T+JYHR2ctWYGzXSC8Gzbs3rbtgZaSXDyp0QoKnJBMBK8WH5vVCUhCcvbX + bAuivwxsmmaP2TxYfyE3zJ/Ij2wLYu3/OxQoah4kYedgIt8TDTTGnFgeyfcsAodLxn205Dlo4IRkInjr + bgq8dT+bWG0L6A/WnLVo4b1eyHDHV8WHNaJwvwAkJeI9KMSGjC201tkP+AimzgF8cMEAAAAASUVORK5C + YII= + + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs new file mode 100644 index 0000000..75f86a0 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs @@ -0,0 +1,191 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class BorderlessToolForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblDescription = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.imgbxMenu = new RyzStudio.Windows.Forms.ImageBox(); + this.imgbxMaximise = new RyzStudio.Windows.Forms.ImageBox(); + this.imgbxMinimise = new RyzStudio.Windows.Forms.ImageBox(); + this.imgbxClose = new RyzStudio.Windows.Forms.ImageBox(); + this.area1 = new System.Windows.Forms.Panel(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxMenu)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxMaximise)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxMinimise)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); + this.SuspendLayout(); + // + // lblDescription + // + this.lblDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblDescription.BackColor = System.Drawing.Color.Transparent; + this.lblDescription.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblDescription.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); + this.lblDescription.Location = new System.Drawing.Point(1, 1); + this.lblDescription.Name = "lblDescription"; + this.lblDescription.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); + this.lblDescription.Size = new System.Drawing.Size(194, 30); + this.lblDescription.TabIndex = 148; + this.lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lblDescription.DoubleClick += new System.EventHandler(this.label1_DoubleClick); + this.lblDescription.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); + this.lblDescription.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown); + this.lblDescription.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label1_MouseMove); + this.lblDescription.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label1_MouseUp); + // + // panel1 + // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.panel1.BackColor = System.Drawing.Color.Transparent; + this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNWSE; + this.panel1.Location = new System.Drawing.Point(335, 595); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(5, 5); + this.panel1.TabIndex = 150; + this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); + this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); + this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp); + // + // imgbxMenu + // + this.imgbxMenu.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.imgbxMenu.BackColor = System.Drawing.Color.Transparent; + this.imgbxMenu.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.imgbxMenu.ErrorImage = null; + this.imgbxMenu.HighlightImage = global::AppLauncher.Properties.Resources.form16_menu2; + this.imgbxMenu.Image = global::AppLauncher.Properties.Resources.form16_menu; + this.imgbxMenu.InitialImage = null; + this.imgbxMenu.Location = new System.Drawing.Point(224, 4); + this.imgbxMenu.Name = "imgbxMenu"; + this.imgbxMenu.NormalImage = global::AppLauncher.Properties.Resources.form16_menu; + this.imgbxMenu.Size = new System.Drawing.Size(24, 24); + this.imgbxMenu.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.imgbxMenu.TabIndex = 149; + this.imgbxMenu.TabStop = false; + // + // imgbxMaximise + // + this.imgbxMaximise.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.imgbxMaximise.BackColor = System.Drawing.Color.Transparent; + this.imgbxMaximise.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.imgbxMaximise.ErrorImage = null; + this.imgbxMaximise.HighlightImage = global::AppLauncher.Properties.Resources.form16_maximise2; + this.imgbxMaximise.Image = global::AppLauncher.Properties.Resources.form16_maximise; + this.imgbxMaximise.InitialImage = null; + this.imgbxMaximise.Location = new System.Drawing.Point(280, 4); + this.imgbxMaximise.Name = "imgbxMaximise"; + this.imgbxMaximise.NormalImage = global::AppLauncher.Properties.Resources.form16_maximise; + this.imgbxMaximise.Size = new System.Drawing.Size(24, 24); + this.imgbxMaximise.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.imgbxMaximise.TabIndex = 147; + this.imgbxMaximise.TabStop = false; + // + // imgbxMinimise + // + this.imgbxMinimise.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.imgbxMinimise.BackColor = System.Drawing.Color.Transparent; + this.imgbxMinimise.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.imgbxMinimise.ErrorImage = null; + this.imgbxMinimise.HighlightImage = global::AppLauncher.Properties.Resources.form16_minimise2; + this.imgbxMinimise.Image = global::AppLauncher.Properties.Resources.form16_minimise; + this.imgbxMinimise.InitialImage = null; + this.imgbxMinimise.Location = new System.Drawing.Point(252, 4); + this.imgbxMinimise.Name = "imgbxMinimise"; + this.imgbxMinimise.NormalImage = global::AppLauncher.Properties.Resources.form16_minimise; + this.imgbxMinimise.Size = new System.Drawing.Size(24, 24); + this.imgbxMinimise.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.imgbxMinimise.TabIndex = 146; + this.imgbxMinimise.TabStop = false; + // + // imgbxClose + // + this.imgbxClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.imgbxClose.BackColor = System.Drawing.Color.Transparent; + this.imgbxClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.imgbxClose.ErrorImage = null; + this.imgbxClose.HighlightImage = global::AppLauncher.Properties.Resources.form16_close2; + this.imgbxClose.Image = global::AppLauncher.Properties.Resources.form16_close; + this.imgbxClose.InitialImage = null; + this.imgbxClose.Location = new System.Drawing.Point(308, 4); + this.imgbxClose.Name = "imgbxClose"; + this.imgbxClose.NormalImage = global::AppLauncher.Properties.Resources.form16_close; + this.imgbxClose.Size = new System.Drawing.Size(24, 24); + this.imgbxClose.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.imgbxClose.TabIndex = 145; + this.imgbxClose.TabStop = false; + // + // area1 + // + this.area1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.area1.BackColor = System.Drawing.Color.Transparent; + this.area1.Cursor = System.Windows.Forms.Cursors.SizeNS; + this.area1.Location = new System.Drawing.Point(0, 595); + this.area1.Name = "area1"; + this.area1.Size = new System.Drawing.Size(334, 5); + this.area1.TabIndex = 151; + this.area1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown); + this.area1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove); + this.area1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseUp); + // + // BorderlessToolForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.WhiteSmoke; + this.ClientSize = new System.Drawing.Size(340, 600); + this.Controls.Add(this.area1); + this.Controls.Add(this.panel1); + this.Controls.Add(this.imgbxMenu); + this.Controls.Add(this.lblDescription); + this.Controls.Add(this.imgbxMaximise); + this.Controls.Add(this.imgbxMinimise); + this.Controls.Add(this.imgbxClose); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.MinimumSize = new System.Drawing.Size(40, 0); + this.Name = "BorderlessToolForm"; + ((System.ComponentModel.ISupportInitialize)(this.imgbxMenu)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxMaximise)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxMinimise)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + protected internal Forms.ImageBox imgbxMaximise; + protected internal Forms.ImageBox imgbxMinimise; + protected internal Forms.ImageBox imgbxClose; + protected internal System.Windows.Forms.Label lblDescription; + protected internal Forms.ImageBox imgbxMenu; + protected internal System.Windows.Forms.Panel panel1; + protected internal System.Windows.Forms.Panel area1; + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs new file mode 100644 index 0000000..7508a90 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs @@ -0,0 +1,394 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.ComponentModel; + using System.Drawing; + using System.Drawing.Design; + using System.Windows.Forms; + using Resources = AppLauncher.Properties.Resources; + + public partial class BorderlessToolForm : System.Windows.Forms.Form + { + protected bool isBusy = false; + + protected Color topFillColour = Color.FromArgb(15, 15, 15); + protected int topFillHeight = 32; + protected int borderWidth = 1; + + private bool windowDragging = false; + private Point windowOffset = new Point(); + private Point windowSize = new Point(); + + public BorderlessToolForm() : base() + { + this.InitializeComponent(); + + this.BackColor = Color.FromArgb(246, 246, 246); + this.Padding = new Padding(1); + + this.topFillColour = Color.FromArgb(51, 51, 51); + this.topFillHeight = 32; + + this.BackColor = Color.FromArgb(179, 179, 179); + this.FormBorderStyle = FormBorderStyle.None; + + imgbxMinimise.Click += pictureBox1_Click; + imgbxMaximise.Click += pictureBox2_Click; + imgbxClose.Click += pictureBox3_Click; + imgbxMenu.Click += pictureBox4_Click; + + updatePictureBox2Image(); + } + + protected override void OnClosing(CancelEventArgs e) + { + base.OnClosing(e); + + if (this.IsBusy) + { + e.Cancel = true; + } + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + Graphics g = e.Graphics; + + Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, this.Padding.Top, this.DisplayRectangle.Width, topFillHeight); + Rectangle areaBorder = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width - borderWidth, this.ClientRectangle.Height - borderWidth); + + // draw header + if (topFillHeight > 0) + { + g.FillRectangle(new SolidBrush(topFillColour), areaTop); + } + + // draw logo + //if (this.TitleLogo != null) + //{ + // g.DrawImageUnscaled(this.TitleLogo, this.Padding.Left, this.Padding.Top); + //} + + g.DrawRectangle(new Pen(Color.Black, borderWidth), areaBorder); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + updatePictureBox2Image(); + + this.Invalidate(); + } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Color BackColor { get => base.BackColor; set => base.BackColor = value; } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Padding { get => base.Padding; set => base.Padding = value; } + + [Category("Appearance"), Browsable(true)] + public string Description + { + get + { + return lblDescription.Text?.Replace("\n", "\\n"); + } + set + { + lblDescription.Text = value?.Replace("\\n", "\n"); + } + } + + //[Category("Appearance"), Browsable(true)] + //public Image TitleLogo { get; set; } + + [Category("Appearance"), Browsable(true)] + public Image Banner { get; set; } + + [Category("Appearance"), Browsable(true)] + public bool ShowMenuButton { get => imgbxMenu.Visible; set => imgbxMenu.Visible = value; } + + [Category("Appearance"), Browsable(true)] + public bool ShowMinimiseButton { get => imgbxMinimise.Visible; set => imgbxMinimise.Visible = value; } + + [Category("Appearance"), Browsable(true)] + public bool ShowMaximiseButton { get => imgbxMaximise.Visible; set => imgbxMaximise.Visible = value; } + + protected virtual bool IsBusy { get => isBusy; set => isBusy = value; } + + private void pictureBox4_Click(object sender, System.EventArgs e) + { + //this.WindowState = FormWindowState.Minimized; + } + + private void pictureBox1_Click(object sender, System.EventArgs e) + { + MouseEventArgs mouseEvent = (MouseEventArgs)e; + if (mouseEvent != null) + { + if (mouseEvent.Button != MouseButtons.Left) + { + return; + } + } + + this.WindowState = FormWindowState.Minimized; + } + + private void pictureBox2_Click(object sender, System.EventArgs e) + { + MouseEventArgs mouseEvent = (MouseEventArgs)e; + if (mouseEvent != null) + { + if (mouseEvent.Button != MouseButtons.Left) + { + return; + } + } + + if (this.WindowState == FormWindowState.Maximized) + { + this.WindowState = FormWindowState.Normal; + imgbxMaximise.NormalImage = Resources.form16_maximise; + imgbxMaximise.HighlightImage = Resources.form16_maximise2; + } + else + { + this.WindowState = FormWindowState.Maximized; + imgbxMaximise.NormalImage = Resources.form16_restore; + imgbxMaximise.HighlightImage = Resources.form16_restore2; + } + } + + private void pictureBox3_Click(object sender, System.EventArgs e) + { + MouseEventArgs mouseEvent = (MouseEventArgs)e; + if (mouseEvent != null) + { + if (mouseEvent.Button != MouseButtons.Left) + { + return; + } + } + + this.Close(); + } + + public void SetValue(Label sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void SetValue(GroupBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void AddValue(ListBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Add(value); })); + } + else + { + sender.Items.Add(value); + } + } + + public void AddControl(FlowLayoutPanel sender, Control value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => + { + sender.Controls.Add(value); + })); + } + else + { + sender.Controls.Add(value); + } + } + + public void ClearValues(ListBox sender) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Clear(); })); + } + else + { + sender.Items.Clear(); + } + } + + public string GetValue(ListBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); })); + } + else + { + rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); + } + + return rv; + } + + public string GetValue(TextBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = sender.Text.Trim(); })); + } + else + { + rv = sender.Text.Trim(); + } + + return rv; + } + + public int GetValue(NumericUpDown sender) + { + int rv = 0; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (int)sender.Value; })); + } + else + { + rv = (int)sender.Value; + } + + return rv; + } + + protected void updatePictureBox2Image() + { + if (this.WindowState == FormWindowState.Maximized) + { + imgbxMaximise.NormalImage = Resources.form16_restore; + imgbxMaximise.HighlightImage = Resources.form16_restore2; + } + else + { + imgbxMaximise.NormalImage = Resources.form16_maximise; + imgbxMaximise.HighlightImage = Resources.form16_maximise2; + } + } + + private void label1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + } + + private void label1_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + private void label1_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + Point currentScreenPos = PointToScreen(e.Location); + Location = new Point(currentScreenPos.X - windowOffset.X, currentScreenPos.Y - windowOffset.Y); + } + } + + private void label1_DoubleClick(object sender, EventArgs e) => pictureBox2_Click(sender, e); + + private void label1_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Middle) + { + this.TopMost = !this.TopMost; + } + } + + private void panel1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + windowSize = new Point(this.Width, this.Height); + } + + private void panel1_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + private void panel1_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + this.Size = new Size(e.X - windowOffset.X + this.Width, e.Y - windowOffset.Y + this.Height); + } + } + + private void panel2_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + windowSize = new Point(this.Width, this.Height); + } + + private void panel2_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + + } + + private void panel2_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + this.Size = new Size(windowSize.X, e.Y - windowOffset.Y + this.Height); + } + } + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx new file mode 100644 index 0000000..8c98a25 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/Button.cs b/RyzStudio/Windows/ThemedForms/Button.cs new file mode 100644 index 0000000..e15b8de --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/Button.cs @@ -0,0 +1,103 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.ComponentModel; + using System.Drawing; + + public partial class Button : RyzStudio.Windows.ThemedForms.UserControl + { + protected ButtonState buttonState = ButtonState.Normal; + + public Button() : base() + { + InitializeComponent(); + + label1.ImageAlign = ContentAlignment.MiddleCenter; + + label1.Click += delegate { this.OnClick(null); }; + label1.MouseEnter += delegate { this.VisualState = ButtonState.Hover; }; + 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) + { + base.OnLoad(e); + + // customise + this.StyleOver = new ButtonStyle(Color.FromArgb(51, 51, 51), Color.White, this.OverImage); + this.StyleDown = new ButtonStyle(Color.FromArgb(179, 179, 179), Color.Black, this.DownImage); + this.StyleDefault = new ButtonStyle(Color.White, Color.Black, this.DefaultImage); + + this.VisualState = ButtonState.Normal; + } + + protected ButtonState VisualState + { + get { return buttonState; } + set + { + switch (value) + { + case ButtonState.Normal: + if (this.VisualState == ButtonState.Down) + { + updateButton(StyleOver); + } + else + { + updateButton(StyleDefault); + } + + break; + case ButtonState.Hover: + updateButton(StyleOver); + break; + case ButtonState.Down: + updateButton(StyleDown); + break; + default: + updateButton(StyleDefault); + break; + } + + buttonState = value; + } + } + + protected void updateButton(ButtonStyle style) + { + label1.ForeColor = style.PenColour; + label1.BackColor = style.BackColour; + label1.Image = style.ForeImage; + } + + [Browsable(true)] + [Category("Appearance")] + public string LabelText { get => label1.Text; set => label1.Text = value; } + + [Browsable(true)] + [Category("Appearance")] + public Image OverImage { get; set; } = null; + + [Browsable(true)] + [Category("Appearance")] + public Image DownImage { get; set; } = null; + + [Browsable(true)] + [Category("Appearance")] + public Image DefaultImage { get; set; } = null; + + [Browsable(false)] + public ButtonStyle StyleOver { get; set; } = new ButtonStyle(Color.FromArgb(71, 142, 203), Color.FromArgb(250, 250, 250)); + + [Browsable(false)] + public ButtonStyle StyleDown { get; set; } = new ButtonStyle(Color.FromArgb(61, 132, 193), Color.FromArgb(250, 250, 250)); + + [Browsable(false)] + public ButtonStyle StyleDefault { get; set; } = new ButtonStyle(Color.FromArgb(51, 122, 183), Color.FromArgb(250, 250, 250)); + + public void PerformClick() => this.OnClick(null); + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/Button.designer.cs b/RyzStudio/Windows/ThemedForms/Button.designer.cs new file mode 100644 index 0000000..0e6b247 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/Button.designer.cs @@ -0,0 +1,61 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class Button + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Location = new System.Drawing.Point(4, 4); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(121, 25); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Button + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Name = "Button"; + this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); + this.Size = new System.Drawing.Size(128, 32); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/RyzStudio/Windows/ThemedForms/Button.resx b/RyzStudio/Windows/ThemedForms/Button.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/Button.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/ButtonState.cs b/RyzStudio/Windows/ThemedForms/ButtonState.cs new file mode 100644 index 0000000..9ca2060 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ButtonState.cs @@ -0,0 +1,9 @@ +namespace RyzStudio.Windows.ThemedForms +{ + public enum ButtonState + { + Normal = 0, + Hover, + Down + } +} diff --git a/RyzStudio/Windows/ThemedForms/ButtonStyle.cs b/RyzStudio/Windows/ThemedForms/ButtonStyle.cs new file mode 100644 index 0000000..57c7cb5 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ButtonStyle.cs @@ -0,0 +1,25 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System.Drawing; + + public class ButtonStyle + { + public Color BackColour { get; set; } + public Color PenColour { get; set; } + public Image ForeImage { get; set; } = null; + + public ButtonStyle(Color backColour, Color penColour) + { + this.BackColour = backColour; + this.PenColour = penColour; + this.ForeImage = null; + } + + public ButtonStyle(Color backColour, Color penColour, Image foreImage) + { + this.BackColour = backColour; + this.PenColour = penColour; + this.ForeImage = foreImage; + } + } +} diff --git a/RyzStudio/Windows/ThemedForms/DialogForm.Designer.cs b/RyzStudio/Windows/ThemedForms/DialogForm.Designer.cs new file mode 100644 index 0000000..7eb9bf3 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/DialogForm.Designer.cs @@ -0,0 +1,123 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class DialogForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblDescription = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.imgbxClose = new RyzStudio.Windows.Forms.ImageBox(); + this.area1 = new System.Windows.Forms.Panel(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); + this.SuspendLayout(); + // + // lblDescription + // + this.lblDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblDescription.BackColor = System.Drawing.Color.Transparent; + this.lblDescription.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblDescription.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); + this.lblDescription.Location = new System.Drawing.Point(1, 1); + this.lblDescription.Name = "lblDescription"; + this.lblDescription.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); + this.lblDescription.Size = new System.Drawing.Size(301, 30); + this.lblDescription.TabIndex = 148; + this.lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lblDescription.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); + this.lblDescription.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown); + this.lblDescription.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label1_MouseMove); + this.lblDescription.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label1_MouseUp); + // + // panel1 + // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.panel1.BackColor = System.Drawing.Color.Transparent; + this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNWSE; + this.panel1.Location = new System.Drawing.Point(335, 595); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(5, 5); + this.panel1.TabIndex = 150; + this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); + this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); + this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp); + // + // imgbxClose + // + this.imgbxClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.imgbxClose.BackColor = System.Drawing.Color.Transparent; + this.imgbxClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.imgbxClose.ErrorImage = null; + this.imgbxClose.HighlightImage = global::AppLauncher.Properties.Resources.form16_close2; + this.imgbxClose.Image = global::AppLauncher.Properties.Resources.form16_close; + this.imgbxClose.InitialImage = null; + this.imgbxClose.Location = new System.Drawing.Point(308, 4); + this.imgbxClose.Name = "imgbxClose"; + this.imgbxClose.NormalImage = global::AppLauncher.Properties.Resources.form16_close; + this.imgbxClose.Size = new System.Drawing.Size(24, 24); + this.imgbxClose.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.imgbxClose.TabIndex = 145; + this.imgbxClose.TabStop = false; + // + // area1 + // + this.area1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.area1.BackColor = System.Drawing.Color.Transparent; + this.area1.Cursor = System.Windows.Forms.Cursors.SizeNS; + this.area1.Location = new System.Drawing.Point(0, 595); + this.area1.Name = "area1"; + this.area1.Size = new System.Drawing.Size(334, 5); + this.area1.TabIndex = 151; + this.area1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown); + this.area1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove); + this.area1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseUp); + // + // DialogForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(249)))), ((int)(((byte)(250))))); + this.ClientSize = new System.Drawing.Size(340, 600); + this.Controls.Add(this.area1); + this.Controls.Add(this.panel1); + this.Controls.Add(this.lblDescription); + this.Controls.Add(this.imgbxClose); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.MinimumSize = new System.Drawing.Size(40, 0); + this.Name = "DialogForm"; + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + protected internal Forms.ImageBox imgbxClose; + protected internal System.Windows.Forms.Label lblDescription; + protected internal System.Windows.Forms.Panel panel1; + protected internal System.Windows.Forms.Panel area1; + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/DialogForm.cs b/RyzStudio/Windows/ThemedForms/DialogForm.cs new file mode 100644 index 0000000..f990153 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/DialogForm.cs @@ -0,0 +1,306 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.ComponentModel; + using System.Drawing; + using System.Drawing.Design; + using System.Windows.Forms; + using Resources = AppLauncher.Properties.Resources; + + public partial class DialogForm : System.Windows.Forms.Form + { + protected bool isBusy = false; + + protected Color topFillColour = Color.FromArgb(15, 15, 15); + protected int topFillHeight = 32; + protected int borderWidth = 1; + + private bool windowDragging = false; + private Point windowOffset = new Point(); + private Point windowSize = new Point(); + + public DialogForm() : base() + { + this.InitializeComponent(); + + this.BackColor = Color.FromArgb(246, 246, 246); + this.Padding = new Padding(1); + + this.topFillColour = Color.FromArgb(51, 51, 51); + this.topFillHeight = 32; + + this.BackColor = Color.FromArgb(248, 249, 250); + this.FormBorderStyle = FormBorderStyle.None; + + imgbxClose.Click += pictureBox3_Click; + } + + protected override void OnClosing(CancelEventArgs e) + { + base.OnClosing(e); + + if (this.IsBusy) + { + e.Cancel = true; + } + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + Graphics g = e.Graphics; + + Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, this.Padding.Top, this.DisplayRectangle.Width, topFillHeight); + Rectangle areaBorder = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width - borderWidth, this.ClientRectangle.Height - borderWidth); + + // draw header + if (topFillHeight > 0) + { + g.FillRectangle(new SolidBrush(topFillColour), areaTop); + } + + g.DrawRectangle(new Pen(Color.Black, borderWidth), areaBorder); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + this.Invalidate(); + } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Color BackColor { get => base.BackColor; set => base.BackColor = value; } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Padding { get => base.Padding; set => base.Padding = value; } + + [Category("Appearance"), Browsable(true)] + public string Description + { + get + { + return lblDescription.Text?.Replace("\n", "\\n"); + } + set + { + lblDescription.Text = value?.Replace("\\n", "\n"); + } + } + + protected virtual bool IsBusy { get => isBusy; set => isBusy = value; } + + private void pictureBox3_Click(object sender, System.EventArgs e) + { + MouseEventArgs mouseEvent = (MouseEventArgs)e; + if (mouseEvent != null) + { + if (mouseEvent.Button != MouseButtons.Left) + { + return; + } + } + + this.Close(); + } + + public void SetValue(Label sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void SetValue(GroupBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void AddValue(ListBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Add(value); })); + } + else + { + sender.Items.Add(value); + } + } + + public void AddControl(FlowLayoutPanel sender, Control value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => + { + sender.Controls.Add(value); + })); + } + else + { + sender.Controls.Add(value); + } + } + + public void ClearValues(ListBox sender) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Clear(); })); + } + else + { + sender.Items.Clear(); + } + } + + public string GetValue(ListBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); })); + } + else + { + rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); + } + + return rv; + } + + public string GetValue(TextBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = sender.Text.Trim(); })); + } + else + { + rv = sender.Text.Trim(); + } + + return rv; + } + + public int GetValue(NumericUpDown sender) + { + int rv = 0; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (int)sender.Value; })); + } + else + { + rv = (int)sender.Value; + } + + return rv; + } + + private void label1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + } + + private void label1_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + private void label1_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + Point currentScreenPos = PointToScreen(e.Location); + Location = new Point(currentScreenPos.X - windowOffset.X, currentScreenPos.Y - windowOffset.Y); + } + } + + private void label1_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Middle) + { + this.TopMost = !this.TopMost; + } + } + + private void panel1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + windowSize = new Point(this.Width, this.Height); + } + + private void panel1_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + private void panel1_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + this.Size = new Size(e.X - windowOffset.X + this.Width, e.Y - windowOffset.Y + this.Height); + } + } + + private void panel2_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + windowSize = new Point(this.Width, this.Height); + } + + private void panel2_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + + } + + private void panel2_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + this.Size = new Size(windowSize.X, e.Y - windowOffset.Y + this.Height); + } + } + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/DialogForm.resx b/RyzStudio/Windows/ThemedForms/DialogForm.resx new file mode 100644 index 0000000..983de50 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/DialogForm.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/Form.Designer.cs b/RyzStudio/Windows/ThemedForms/Form.Designer.cs new file mode 100644 index 0000000..a50fcc7 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/Form.Designer.cs @@ -0,0 +1,52 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class Form + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // Form + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.WhiteSmoke; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.ClientSize = new System.Drawing.Size(584, 381); + this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ForeColor = System.Drawing.Color.Black; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimumSize = new System.Drawing.Size(600, 420); + this.Name = "Form"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/Form.cs b/RyzStudio/Windows/ThemedForms/Form.cs new file mode 100644 index 0000000..3a9dfa9 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/Form.cs @@ -0,0 +1,173 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.ComponentModel; + using System.Drawing; + using System.Windows.Forms; + + public partial class Form : System.Windows.Forms.Form + { + protected Color topFillColour = Color.FromArgb(15, 15, 15); + protected int topFillHeight = 52; + + protected Color bottomFillColour = Color.FromArgb(15, 15, 15); + protected int bottomFillMargin = 19; + + protected int borderWidth = 1; + + public Form() + { + this.InitializeComponent(); + + this.BackColor = Color.FromArgb(246, 246, 246); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + this.Invalidate(); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + Graphics g = e.Graphics; + + Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, this.Padding.Top, this.DisplayRectangle.Width, topFillHeight); + Rectangle areaBottom = new Rectangle(this.DisplayRectangle.Left, (this.DisplayRectangle.Height - bottomFillMargin), this.DisplayRectangle.Width, bottomFillMargin); + Rectangle areaBorder = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width - borderWidth, this.ClientRectangle.Height - borderWidth); + + // draw header + if (topFillHeight > 0) + { + g.FillRectangle(new SolidBrush(topFillColour), areaTop); + } + + // draw footer + if (bottomFillMargin > 0) + { + g.FillRectangle(new SolidBrush(bottomFillColour), areaBottom); + } + + // draw logo + if (this.TitleLogo != null) + { + g.DrawImageUnscaled(this.TitleLogo, this.Padding.Left, this.Padding.Top); + } + + if (this.Banner != null) + { + g.DrawImageUnscaled(this.Banner, this.Padding.Left, (this.DisplayRectangle.Height - this.Banner.Height - bottomFillMargin), (this.DisplayRectangle.Width - (this.Padding.Left + this.Padding.Right)), this.Banner.Height); + } + + g.DrawRectangle(new Pen(Color.Black, borderWidth), areaBorder); + } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Color BackColor { get => base.BackColor; set { base.BackColor = value; } } + + [Category("Appearance"), Browsable(true)] + public Image TitleLogo { get; set; } + + [Category("Appearance"), Browsable(true)] + public Image Banner { get; set; } + + public void SetValue(Label sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void SetValue(GroupBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + public void AddValue(ListBox sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Add(value); })); + } + else + { + sender.Items.Add(value); + } + } + + public void ClearValues(ListBox sender) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Items.Clear(); })); + } + else + { + sender.Items.Clear(); + } + } + + public string GetValue(ListBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); })); + } + else + { + rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); + } + + return rv; + } + + public string GetValue(TextBox sender) + { + string rv = string.Empty; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = sender.Text.Trim(); })); + } + else + { + rv = sender.Text.Trim(); + } + + return rv; + } + + public int GetValue(NumericUpDown sender) + { + int rv = 0; + + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { rv = (int)sender.Value; })); + } + else + { + rv = (int)sender.Value; + } + + return rv; + } + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/Form.resx b/RyzStudio/Windows/ThemedForms/Form.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/Form.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/LeftButton.cs b/RyzStudio/Windows/ThemedForms/LeftButton.cs new file mode 100644 index 0000000..ca98f5a --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/LeftButton.cs @@ -0,0 +1,111 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.ComponentModel; + using System.Drawing; + + public partial class LeftButton : RyzStudio.Windows.ThemedForms.LeftUserControl + { + protected ButtonState buttonState = ButtonState.Normal; + + public LeftButton() : base() + { + InitializeComponent(); + + label1.ImageAlign = ContentAlignment.MiddleCenter; + + label1.Click += delegate { this.OnClick(null); }; + label1.MouseEnter += delegate { this.VisualState = ButtonState.Hover; }; + 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) + { + base.OnLoad(e); + + // customise + this.StyleOver = new ButtonStyle(Color.FromArgb(0, 152, 167), Color.White, this.OverImage); + this.StyleDown = new ButtonStyle(Color.FromArgb(179, 179, 179), Color.Black, this.DownImage); + this.StyleDefault = new ButtonStyle(Color.White, Color.Black, this.DefaultImage); + + //this.StyleOver.ForeImage = this.OverImage; + //this.StyleDown.ForeImage = this.DownImage; + //this.StyleDefault.ForeImage = this.DefaultImage; + + this.VisualState = ButtonState.Normal; + } + + protected ButtonState VisualState + { + get { return buttonState; } + set + { + switch (value) + { + case ButtonState.Normal: + if (this.VisualState == ButtonState.Down) + { + updateButton(StyleOver); + } + else + { + updateButton(StyleDefault); + } + + break; + case ButtonState.Hover: + updateButton(StyleOver); + break; + case ButtonState.Down: + updateButton(StyleDown); + break; + default: + updateButton(StyleDefault); + break; + } + + buttonState = value; + } + } + + protected void updateButton(ButtonStyle style) + { + label1.ForeColor = style.PenColour; + label1.BackColor = style.BackColour; + label1.Image = style.ForeImage; + } + + [Browsable(true)] + [Category("Appearance")] + public string LabelText { get => label1.Text; set => label1.Text = value; } + + [Browsable(true)] + [Category("Appearance")] + public System.Windows.Forms.Label Label { get => label1; set => label1 = value; } + + [Browsable(true)] + [Category("Appearance")] + public Image OverImage { get; set; } = null; + + [Browsable(true)] + [Category("Appearance")] + public Image DownImage { get; set; } = null; + + [Browsable(true)] + [Category("Appearance")] + public Image DefaultImage { get; set; } = null; + + [Browsable(false)] + public ButtonStyle StyleOver { get; set; } = new ButtonStyle(Color.FromArgb(71, 142, 203), Color.FromArgb(250, 250, 250)); + + [Browsable(false)] + public ButtonStyle StyleDown { get; set; } = new ButtonStyle(Color.FromArgb(61, 132, 193), Color.FromArgb(250, 250, 250)); + + [Browsable(false)] + public ButtonStyle StyleDefault { get; set; } = new ButtonStyle(Color.FromArgb(51, 122, 183), Color.FromArgb(250, 250, 250)); + + public void PerformClick() => this.OnClick(null); + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/LeftButton.designer.cs b/RyzStudio/Windows/ThemedForms/LeftButton.designer.cs new file mode 100644 index 0000000..6c359d6 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/LeftButton.designer.cs @@ -0,0 +1,61 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class LeftButton + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Location = new System.Drawing.Point(4, 4); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(121, 25); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Button + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Name = "Button"; + this.Padding = new System.Windows.Forms.Padding(4, 4, 0, 3); + this.Size = new System.Drawing.Size(128, 32); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/RyzStudio/Windows/ThemedForms/LeftButton.resx b/RyzStudio/Windows/ThemedForms/LeftButton.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/LeftButton.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/LeftUserControl.cs b/RyzStudio/Windows/ThemedForms/LeftUserControl.cs new file mode 100644 index 0000000..89353ec --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/LeftUserControl.cs @@ -0,0 +1,53 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.Drawing; + using System.Windows.Forms; + using RyzStudio.Drawing; + using System.ComponentModel; + + public partial class LeftUserControl : System.Windows.Forms.UserControl + { + protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White); + + public LeftUserControl() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + this.BackColor = Color.Transparent; + } + + + protected override void OnPaintBackground(PaintEventArgs e) + { + 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; + + updateBackground(g, styleActive); + } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Padding { get => base.Padding; set => base.Padding = value; } + + protected virtual void updateBackground(Graphics g, ThemeStyle style) + { + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Padding = new Padding(b, b, 0, (b - 1)); + + LeftRectangoid area = new LeftRectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth); + g.FillPath(new SolidBrush(style.BackColour), area.ToClosedGraphicsPath()); + g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath()); + } + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/LeftUserControl.designer.cs b/RyzStudio/Windows/ThemedForms/LeftUserControl.designer.cs new file mode 100644 index 0000000..792cd21 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/LeftUserControl.designer.cs @@ -0,0 +1,37 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class LeftUserControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/RyzStudio/Windows/ThemedForms/PickerBox.cs b/RyzStudio/Windows/ThemedForms/PickerBox.cs new file mode 100644 index 0000000..74cb07f --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/PickerBox.cs @@ -0,0 +1,98 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using RyzStudio.Drawing; + using System; + using System.ComponentModel; + using System.Drawing; + using System.Windows.Forms; + + public partial class PickerBox : RyzStudio.Windows.ThemedForms.UserControl + { + protected readonly Padding textboxPadding = new Padding(6, 2, 4, 2); + + public PickerBox() : base() + { + InitializeComponent(); + + this.Font = new Font(this.Font, FontStyle.Regular); + this.Margin = new Padding(10, 4, 10, 4); + + comboBox1.Font = this.Font; + comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; + comboBox1.PreviewKeyDown += textBox_PreviewKeyDown; + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Height = comboBox1.Height + (b + textboxPadding.Top) + ((b - 1) + textboxPadding.Bottom); + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + + comboBox1.Focus(); + } + + protected void textBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Enter: + if (this.SubmitButton != null) + { + this.SubmitButton.PerformClick(); + } + + break; + case Keys.Escape: + tryClose(); + break; + default: break; + } + } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public System.Windows.Forms.ComboBox ComboBox { get => comboBox1; set => comboBox1 = value; } + + //[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + //[Category("Appearance")] + //public new string Text + //{ + // get => textBox1.Text; + // set + // { + // textBox1.Text = value; + // textBox1.SelectionStart = textBox1.Text.Length; + // } + //} + + //[Browsable(true)] + //[Category("Appearance")] + //public ComboBox.ObjectCollection Items { get => comboBox1.Items; set => comboBox1.Items = value; } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public Button SubmitButton { get; set; } = null; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Margin { get => base.Margin; set => base.Margin = value; } + + protected override void updateBackground(Graphics g, ThemeStyle style) + { + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Padding = new Padding((b + textboxPadding.Left), (b + textboxPadding.Top), ((b - 1) + textboxPadding.Right), ((b - 1) + textboxPadding.Bottom)); + + Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth); + g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath()); + g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath()); + } + + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/PickerBox.designer.cs b/RyzStudio/Windows/ThemedForms/PickerBox.designer.cs new file mode 100644 index 0000000..5b8a324 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/PickerBox.designer.cs @@ -0,0 +1,59 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class PickerBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // comboBox1 + // + this.comboBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(4, 4); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(121, 21); + this.comboBox1.TabIndex = 0; + // + // PickerBox + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.comboBox1); + this.Name = "PickerBox"; + this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); + this.Size = new System.Drawing.Size(128, 32); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ComboBox comboBox1; + } +} diff --git a/RyzStudio/Windows/ThemedForms/PickerBox.resx b/RyzStudio/Windows/ThemedForms/PickerBox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/PickerBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/ProgressBar.Designer.cs b/RyzStudio/Windows/ThemedForms/ProgressBar.Designer.cs new file mode 100644 index 0000000..032705b --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ProgressBar.Designer.cs @@ -0,0 +1,72 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class ProgressBar + { + private System.ComponentModel.IContainer components = null; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label3 = new System.Windows.Forms.Label(); + this.userControl1 = new RyzStudio.Windows.ThemedForms.ProgressBarInner(); + this.SuspendLayout(); + // + // label3 + // + this.label3.BackColor = System.Drawing.Color.Transparent; + this.label3.Dock = System.Windows.Forms.DockStyle.Fill; + this.label3.Font = new System.Drawing.Font("Segoe UI", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(4, 4); + this.label3.Margin = new System.Windows.Forms.Padding(0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(803, 47); + this.label3.TabIndex = 144; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // userControl1 + // + this.userControl1.BarColour = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(225)))), ((int)(((byte)(249))))); + this.userControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.userControl1.Location = new System.Drawing.Point(4, 4); + this.userControl1.Margin = new System.Windows.Forms.Padding(0); + this.userControl1.Maximum = 100; + this.userControl1.Minimum = 0; + this.userControl1.Name = "userControl1"; + this.userControl1.Size = new System.Drawing.Size(803, 47); + this.userControl1.TabIndex = 145; + this.userControl1.Value = 50; + // + // ProgressBar + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.userControl1); + this.Controls.Add(this.label3); + this.Margin = new System.Windows.Forms.Padding(0); + this.Name = "ProgressBar"; + this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); + this.Size = new System.Drawing.Size(810, 54); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label3; + private ProgressBarInner userControl1; + } +} diff --git a/RyzStudio/Windows/ThemedForms/ProgressBar.cs b/RyzStudio/Windows/ThemedForms/ProgressBar.cs new file mode 100644 index 0000000..6660601 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ProgressBar.cs @@ -0,0 +1,29 @@ +using System; +using System.Drawing; + +namespace RyzStudio.Windows.ThemedForms +{ + public partial class ProgressBar : RyzStudio.Windows.ThemedForms.UserControl + { + public ProgressBar() : base() + { + InitializeComponent(); + + styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White); + } + + public int Minimum { get => userControl1.Minimum; set => userControl1.Minimum = value; } + public int Maximum { get => userControl1.Maximum; set => userControl1.Maximum = value; } + public int Value { get => userControl1.Value; set => userControl1.Value = value; } + + public Color BarColour { get => userControl1.BarColour; set => userControl1.BarColour = value; } + public Color BarTextColour { get => userControl1.BarTextColour; set => userControl1.BarTextColour = value; } + + protected override void OnSizeChanged(EventArgs e) + { + base.OnSizeChanged(e); + + this.Invalidate(); + } + } +} diff --git a/RyzStudio/Windows/ThemedForms/ProgressBar.resx b/RyzStudio/Windows/ThemedForms/ProgressBar.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ProgressBar.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/ProgressBarInner.Designer.cs b/RyzStudio/Windows/ThemedForms/ProgressBarInner.Designer.cs new file mode 100644 index 0000000..8a0fc5c --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ProgressBarInner.Designer.cs @@ -0,0 +1,63 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class ProgressBarInner + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label3 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label3 + // + this.label3.BackColor = System.Drawing.Color.Transparent; + this.label3.Dock = System.Windows.Forms.DockStyle.Fill; + this.label3.Font = new System.Drawing.Font("Segoe UI", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(4, 4); + this.label3.Margin = new System.Windows.Forms.Padding(0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(803, 47); + this.label3.TabIndex = 144; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // ProgressBarInner + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label3); + this.Margin = new System.Windows.Forms.Padding(0); + this.Name = "ProgressBarInner"; + this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); + this.Size = new System.Drawing.Size(810, 54); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label3; + } +} diff --git a/RyzStudio/Windows/ThemedForms/ProgressBarInner.cs b/RyzStudio/Windows/ThemedForms/ProgressBarInner.cs new file mode 100644 index 0000000..acf6004 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ProgressBarInner.cs @@ -0,0 +1,197 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace RyzStudio.Windows.ThemedForms +{ + public partial class ProgressBarInner : System.Windows.Forms.UserControl + { + protected int minimum = 0; + protected int maximum = 100; + protected int value = 0; + + public ProgressBarInner() : base() + { + InitializeComponent(); + + this.Padding = new Padding(0); + } + + public int Minimum + { + get + { + return minimum; + } + set + { + if (this.InvokeRequired) + { + this.Invoke(new MethodInvoker(() => { + setMinimum(value); + })); + } + else + { + setMinimum(value); + } + } + } + + public int Maximum + { + get + { + return maximum; + } + set + { + if (this.InvokeRequired) + { + this.Invoke(new MethodInvoker(() => { + setMaximum(value); + })); + } + else + { + setMaximum(value); + } + } + } + + public int Value + { + get + { + return value; + } + set + { + if (this.InvokeRequired) + { + this.Invoke(new MethodInvoker(() => { + setValue(value); + })); + } + else + { + setValue(value); + } + } + } + + public Color BarColour { get; set; } = Color.FromArgb(158, 225, 249); + + public Color BarTextColour + { + get => label3.ForeColor; + set => label3.ForeColor = value; + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + Rectangle canvas = this.DisplayRectangle; + Graphics g = e.Graphics; + + if (this.Value > 0) + { + decimal result = decimal.Divide(canvas.Width, this.Maximum) * this.Value; + + canvas.Width = (int)Math.Round(result); + + g.FillRectangle(new SolidBrush(this.BarColour), canvas); + } + } + + protected void updateText() + { + if (label3.InvokeRequired) + { + label3.Invoke(new MethodInvoker(() => + { + label3.Text = string.Format("{0}/{1}", this.Value.ToString(), this.Maximum.ToString()); + })); + } + else + { + label3.Text = string.Format("{0}/{1}", this.Value.ToString(), this.Maximum.ToString()); + } + } + + protected void setMinimum(int value) + { + int m = value; + if (m < 0) + { + m = 0; + } + + if (m > this.Maximum) + { + m = this.Maximum; + } + + if (this.Value < m) + { + this.Value = m; + } + + if (this.value > this.Maximum) + { + this.value = this.Maximum; + } + + minimum = m; + updateText(); + this.Invalidate(); + } + + protected void setMaximum(int value) + { + int m = value; + if (m < 0) + { + m = 0; + } + + if (m < this.Minimum) + { + m = this.Minimum; + } + + if (this.Value > m) + { + this.Value = m; + } + + if (this.value < this.Minimum) + { + this.value = this.Minimum; + } + + maximum = m; + updateText(); + this.Invalidate(); + } + + protected void setValue(int value) + { + int m = value; + if (m < this.Minimum) + { + m = this.Minimum; + } + + if (m > this.Maximum) + { + m = this.Maximum; + } + + this.value = m; + updateText(); + this.Invalidate(); + } + } +} diff --git a/RyzStudio/Windows/ThemedForms/ProgressBarInner.resx b/RyzStudio/Windows/ThemedForms/ProgressBarInner.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ProgressBarInner.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/TextBox.cs b/RyzStudio/Windows/ThemedForms/TextBox.cs new file mode 100644 index 0000000..2671771 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/TextBox.cs @@ -0,0 +1,96 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using RyzStudio.Drawing; + using System; + using System.ComponentModel; + using System.Drawing; + using System.Windows.Forms; + + public partial class TextBox : RyzStudio.Windows.ThemedForms.UserControl + { + protected readonly Padding textboxPadding = new Padding(6, 6, 6, 6); + + public TextBox() : base() + { + InitializeComponent(); + + this.Margin = new Padding(10, 6, 10, 6); + this.Font = new Font(this.Font, FontStyle.Regular); + + textBox1.Font = this.Font; + textBox1.PreviewKeyDown += textBox_PreviewKeyDown; + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Height = textBox1.Height + (b + textboxPadding.Top) + ((b - 1) + textboxPadding.Bottom); + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + + textBox1.Focus(); + } + + protected void textBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Enter: + if (this.SubmitButton != null) + { + this.SubmitButton.PerformClick(); + } + + break; + case Keys.Escape: + tryClose(); + break; + default: break; + } + } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public System.Windows.Forms.TextBox InnerTextBox { get => textBox1; set => textBox1 = value; } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public new string Text + { + get => textBox1.Text; + set + { + textBox1.Text = value; + textBox1.SelectionStart = textBox1.Text.Length; + } + } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public bool UseSystemPasswordChar { get => textBox1.UseSystemPasswordChar; set => textBox1.UseSystemPasswordChar = value; } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public Button SubmitButton { get; set; } = null; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } } + + protected override void updateBackground(Graphics g, ThemeStyle style) + { + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Padding = new Padding((b + textboxPadding.Left), (b + textboxPadding.Top), ((b - 1) + textboxPadding.Right), ((b - 1) + textboxPadding.Bottom)); + + Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth); + g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath()); + g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath()); + } + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/TextBox.designer.cs b/RyzStudio/Windows/ThemedForms/TextBox.designer.cs new file mode 100644 index 0000000..29231b0 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/TextBox.designer.cs @@ -0,0 +1,60 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class TextBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.HideSelection = false; + this.textBox1.Location = new System.Drawing.Point(4, 4); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(121, 13); + this.textBox1.TabIndex = 0; + // + // TextBox + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.textBox1); + this.Name = "TextBox"; + this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); + this.Size = new System.Drawing.Size(128, 32); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + } +} diff --git a/RyzStudio/Windows/ThemedForms/TextBox.resx b/RyzStudio/Windows/ThemedForms/TextBox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/TextBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/TextButtonBox.cs b/RyzStudio/Windows/ThemedForms/TextButtonBox.cs new file mode 100644 index 0000000..1fd4ba7 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/TextButtonBox.cs @@ -0,0 +1,127 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using RyzStudio.Drawing; + using System; + using System.ComponentModel; + using System.Drawing; + using System.Windows.Forms; + + public partial class TextButtonBox : RyzStudio.Windows.ThemedForms.UserControl + { + protected readonly Padding textboxPadding = new Padding(6, 6, 6, 6); + + public TextButtonBox() : base() + { + InitializeComponent(); + + //this.Margin = new Padding(10, 6, 10, 6); + this.Margin = new Padding(10, 3, 3, 3); + this.Font = new Font(this.Font, FontStyle.Regular); + + textBox1.Font = this.Font; + textBox1.Left = this.Margin.Left; + textBox1.PreviewKeyDown += textBox_PreviewKeyDown; + + imageBox1.Click += imageBox1_Click; + + OnResize(null); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Height = textBox1.Height + (b + textboxPadding.Top) + ((b - 1) + textboxPadding.Bottom); + + imageBox1.Width = 18; + imageBox1.Height = textBox1.Height + textboxPadding.Top + textboxPadding.Bottom; + imageBox1.Left = this.Width - (this.Margin.Right + b + imageBox1.Width); + + textBox1.Left = this.Margin.Left; + textBox1.Width = imageBox1.Left - textBox1.Left - 3; + textBox1.Top = (int)Math.Ceiling(decimal.Divide((this.Height - textBox1.Height), 2)); + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + + textBox1.Focus(); + } + + protected void textBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Enter: + if (this.SubmitButton != null) + { + this.SubmitButton.PerformClick(); + } + + break; + case Keys.Escape: + tryClose(); + break; + default: break; + } + } + + private void imageBox1_Click(object sender, EventArgs e) => OnButtonClick?.Invoke(sender, e); + + [Category("Action")] + [Browsable(true)] + public event EventHandler OnButtonClick; + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public Forms.ImageBox InnerImageBox { get => imageBox1; set => imageBox1 = value; } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public System.Windows.Forms.TextBox InnerTextBox { get => textBox1; set => textBox1 = value; } + + [Category("Appearance"), Browsable(true)] + public Image NormalImage { get => imageBox1.NormalImage; set => imageBox1.NormalImage = value; } + + [Category("Appearance"), Browsable(true)] + public Image HighlightImage { get => imageBox1.HighlightImage; set => imageBox1.HighlightImage = value; } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public new string Text + { + get => textBox1.Text; + set + { + textBox1.Text = value; + textBox1.SelectionStart = textBox1.Text.Length; + } + } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public bool UseSystemPasswordChar { get => textBox1.UseSystemPasswordChar; set => textBox1.UseSystemPasswordChar = value; } + + [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] + [Category("Appearance")] + public Button SubmitButton { get; set; } = null; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } } + + protected override void updateBackground(Graphics g, ThemeStyle style) + { + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Padding = new Padding((b + textboxPadding.Left), (b + textboxPadding.Top), ((b - 1) + textboxPadding.Right), ((b - 1) + textboxPadding.Bottom)); + + Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth); + g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath()); + g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath()); + } + + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/TextButtonBox.designer.cs b/RyzStudio/Windows/ThemedForms/TextButtonBox.designer.cs new file mode 100644 index 0000000..9a15b4c --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/TextButtonBox.designer.cs @@ -0,0 +1,81 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class TextButtonBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.imageBox1 = new RyzStudio.Windows.Forms.ImageBox(); + ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.BackColor = System.Drawing.SystemColors.Window; + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.HideSelection = false; + this.textBox1.Location = new System.Drawing.Point(7, 7); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(68, 13); + this.textBox1.TabIndex = 0; + // + // imageBox1 + // + this.imageBox1.BackColor = System.Drawing.Color.Transparent; + this.imageBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.imageBox1.ErrorImage = null; + this.imageBox1.HighlightImage = null; + this.imageBox1.Image = null; + this.imageBox1.InitialImage = null; + this.imageBox1.Location = new System.Drawing.Point(107, 4); + this.imageBox1.Name = "imageBox1"; + this.imageBox1.NormalImage = null; + this.imageBox1.Size = new System.Drawing.Size(18, 25); + this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.imageBox1.TabIndex = 1; + this.imageBox1.TabStop = false; + // + // TextBox2 + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.imageBox1); + this.Controls.Add(this.textBox1); + this.Name = "TextBox2"; + this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); + this.Size = new System.Drawing.Size(128, 32); + ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private Forms.ImageBox imageBox1; + } +} diff --git a/RyzStudio/Windows/ThemedForms/TextButtonBox.resx b/RyzStudio/Windows/ThemedForms/TextButtonBox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/TextButtonBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/ThemeStyle.cs b/RyzStudio/Windows/ThemedForms/ThemeStyle.cs new file mode 100644 index 0000000..71d1dee --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/ThemeStyle.cs @@ -0,0 +1,34 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System.Drawing; + + public struct ThemeStyle + { + public int BorderWidth; + public int BorderRadius; + public int BorderPadding; + public Color BorderColour; + public Color BackColour; + public Color ForeColour; + + public ThemeStyle(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour) + { + this.BorderWidth = borderWidth; + this.BorderRadius = borderRadius; + this.BorderPadding = borderPadding; + this.BorderColour = borderColour; + this.BackColour = backColour; + this.ForeColour = Color.Black; + } + + public ThemeStyle(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour, Color foreColour) + { + this.BorderWidth = borderWidth; + this.BorderRadius = borderRadius; + this.BorderPadding = borderPadding; + this.BorderColour = borderColour; + this.BackColour = backColour; + this.ForeColour = foreColour; + } + } +} diff --git a/RyzStudio/Windows/ThemedForms/UserControl.cs b/RyzStudio/Windows/ThemedForms/UserControl.cs new file mode 100644 index 0000000..9ca33c0 --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/UserControl.cs @@ -0,0 +1,89 @@ +namespace RyzStudio.Windows.ThemedForms +{ + using System; + using System.Drawing; + using System.Windows.Forms; + using RyzStudio.Drawing; + using System.ComponentModel; + + public partial class UserControl : System.Windows.Forms.UserControl + { + //protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(112, 112, 112), Color.White); + protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White); + + public UserControl() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + this.BackColor = Color.Transparent; + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + 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; + + updateBackground(g, styleActive); + } + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new Padding Padding { get => base.Padding; set => base.Padding = value; } + + protected virtual void updateBackground(Graphics g, ThemeStyle style) + { + int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding; + + this.Padding = new Padding(b, b, (b - 1), (b - 1)); + + Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth); + g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath()); + g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath()); + } + + protected virtual void tryClose() + { + if (this.Parent == null) + { + return; + } + + if (this.Parent is Form) + { + (this.Parent as Form).Close(); + return; + } + + if (this.Parent.GetType().IsSubclassOf(typeof(System.Windows.Forms.Form))) + { + System.Windows.Forms.Form parentForm = (System.Windows.Forms.Form)this.Parent; + if (parentForm != null) + { + parentForm.Close(); + } + } + } + + public void SetValue(Label sender, string value) + { + if (sender.InvokeRequired) + { + sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); + } + else + { + sender.Text = value; + } + } + + } +} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/UserControl.designer.cs b/RyzStudio/Windows/ThemedForms/UserControl.designer.cs new file mode 100644 index 0000000..ea91b3c --- /dev/null +++ b/RyzStudio/Windows/ThemedForms/UserControl.designer.cs @@ -0,0 +1,37 @@ +namespace RyzStudio.Windows.ThemedForms +{ + partial class UserControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/RyzStudio/Windows/ThemedForms/res/button16_file_add.png b/RyzStudio/Windows/ThemedForms/res/button16_file_add.png new file mode 100644 index 0000000000000000000000000000000000000000..ecd378d0f0b53c05c9b43f1321f3fca5931e1618 GIT binary patch literal 426 zcmV;b0agBqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E-_;&oJ#-z0UJp~K~y+Tm6K0S!ax*8!2w(5eVF4(#xEJ%cw{s|@N%BWkHT04HPOidY!ZGXwHZ|1!>U#HECrIfNf z&l~KHO0Y8Ry6zq~tej+>IDOFM;SIhn@C%Ct{FsNBfP~_euAPY5irNy#j2|+H36O36 z2bepKGiLlnT!dlRtOdXaJY(?_F(KM@05{auIltnhGQbpXpV0qZ3Si!$`QEnewoaw0 z44`o+c{w9Gm8ujF1VNASl*T)qzm+-eRss-5%-`{c;M36CjuA85dn9(^~+iCsAK#f&9731>OO;JOY&U16sX6 UJW#J(y8r+H07*qoM6N<$f^=!BKL7v# literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/button16_file_add2.png b/RyzStudio/Windows/ThemedForms/res/button16_file_add2.png new file mode 100644 index 0000000000000000000000000000000000000000..63f8d49364266d48529b124397241fb677ce7056 GIT binary patch literal 371 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ;P+JIo?1uPdr^5LoEEaUf#=hFo5CcN56=fN0>X*1twPT@+%4PE65${I(Q<%w9E04 za+1L61k<2b^{X=01N{-vy~xw z#g6{;&d3GqTDv$;NGRWUaZuNgyX0rs1y{**9)bR-4UWRjFS5l0xn9lq@ur|RC}COG zX?<4Bk_jd0>;J?Av|QWj{)bcd#DYe%E%!b>%hXuNswz{^a?SMJLj9nB|GE306gXX* zyH_aUL#DR+o{RFLH_{sUE{iy}pENms+wV&KDwoLyR^NVBHzwa@XgvMeVr}{)H=utR NJYD@<);T3K0RS__kv9MU literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/button16_folder_add.png b/RyzStudio/Windows/ThemedForms/res/button16_folder_add.png new file mode 100644 index 0000000000000000000000000000000000000000..09bf8d4f97cbcb5d9894dda5e06ddf0ac009a6a7 GIT binary patch literal 463 zcmV;=0WkiFP)opI1LJMW-4%^altxiI}0Ae?o96Zl%z< zP>}us7rPc*Bq<%cckJZW#zN0Ggv?qRp>u}hd%HyVP`?}S9nXEwbKi3hR}rxXdfmTp4=73Y zm>XC2avC+kfsiHv(2GBqDYty+|pYJmzZz)RKI&y_544l9skN84nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1T^dAc}; zSoAKvyw{7_QKapm`mR);r3nvNSz0(W-|XSc=GH$fec{xt32s6gw)khJKIcz*%DN&# z!c*Q{%$Pg-#$C=|2NP!)f8JZ1aIVqTM)CL}k@T*^`mQ_qp-qK!L;mp1Fk63Rh zziiLU3zyvw#pno$ie|Z`D{ Bh}!@F literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/button16_refresh.png b/RyzStudio/Windows/ThemedForms/res/button16_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..2fce7d15805f4251ce2189c6a05931e9bc1d2056 GIT binary patch literal 639 zcmV-_0)YLAP)#wTb_HL zhkMTDh@RAHwNelSv%oYkD#>%seF5$UL2!L!WaKx%!oosvaB#4yjc^>thk*OQ4oMHp z?4zU%IBaG!z>=ArtyC(XqbRx{>DIa+ilV)e-kVwC`~GyfTwdHLPt$bRIrk8#08^6o znAuG)zaZ%v@S{*Doau!D%H{Inz`(#H@D6xpW}^TeK$0Z;fk`u)8yg#I^}=~pR#t}0 z?2@EUz#QQ90c2VB-S_>uFbtn=1;=rG0(c2vW_j7P70{bntyU-&i^nB-Ym$PbKxvwu zGqXRER@V+(yWM^>K0dzsKjJ>;+#^66o<$G@CxKU+0cNHoNiKK0-P_e_b;$!Vpd;zE znU&3KcNm77!T@m`p9bcA-yep5zu&3(IL@BhQ{3E3-ebR0S6 zu4*QBZBg$>#||Ogviu##3W^gF%hS%Cxp_14UozA09Y?M03Y%?3f(uzgexLNNIHJwB zv3u^0{~h~wO6(Tp{$kK9K4-CwL!_kdmVm=%w_Y|F-$|@tuymADH$3TRb&#oU!!*Y> zuC&Fc%&a;WtC;9bcU*T|>E+e4N?($Bv?V;}ezweUv5dcX@u=%785&VaT<2QZLfb@Q`dyz1J4aVcn)bn^m8VGXyM?dx?Lz@qk|ufk@G1Cn?yWplk|c9< z`-Kf^(+YdoWgcoB(@7Hcj}Ud+)t)u~O`%DF?wS9yKWvoxSEu%YdxN`sezJYbMA Nc)I$ztaD0e0ssj+q(T4y literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form16_close.png b/RyzStudio/Windows/ThemedForms/res/form16_close.png new file mode 100644 index 0000000000000000000000000000000000000000..6cfa679bd607c6b908b548bcf40bc01d1a39548b GIT binary patch literal 347 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSL74G){)!Z!phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7?o?)`q9B-hSo1QL? zAr}5igQNMH37r$1dW zIV&sUDDL@9toFVQbZW|Ifgf?i&Hz>~gTDkOAk z`MKOFQpc`Lsbb;%kXUv?{()#S=gApT*;(Au1*T7A7R>AH$^3Co^wS6J6GzNDB)7Pv z_OFyPda!NzRM~%*&PMGHz1eKMrdA^3>;L$~ukI>ge~(3+;dPVqetB_*{8J_wl?z|h pum0ZUvu6@V#-=Y;&ttF4&I{z{Ir%_twL8$044$rjF6*2UngAD?hj;)0 literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form16_close2.png b/RyzStudio/Windows/ThemedForms/res/form16_close2.png new file mode 100644 index 0000000000000000000000000000000000000000..e29862795b75be961aeb829c660687489eab467a GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ;P+JIo?1u7d>4ZLoEE421oNX83@RHRXXOfS8e%%wVj9frxfshaH*LU@jXz;XN_j! zB+a*FWf2+T8o#xB>JR-AH%ytdRXOi2t6^o+=klsuI;+Z*_!c}=ZQQ!yt#eW4gGn(w z&z)Cu?&m%AtVN)#kacEpPUn)wkM2?XJ4L&a^q*KBugG`1)Np?pC*!iUt*ch{!PC{xWt~$(69BD)iE;n{ literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form16_maximise.png b/RyzStudio/Windows/ThemedForms/res/form16_maximise.png new file mode 100644 index 0000000000000000000000000000000000000000..93017d3887c4f870863df4fbb72e98c6454d5edb GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ;P+JIo?1ub3I)gLoED{PWI+Itia>)(s!3<^)sDYr&Vkj9+eAB(>c-es&%Q>DrYgt zOqNZ@{2MlWzGt7@BfsO|-Hf#BL8lHU9)30}s48);?zEg%aV9D5cMF_2^1lfkP(B-E z-fjElFXNYc0#LT=By}Z;C1rt3( zJ;P+JIo?1uEuJopAr}5`CvW6BY{294KK;_a!YuJwx}`7kEq*TQk-Reb&A|zZpQ4IB z0#LT=By}Z;C1rt3( zJ;P+JIo?1uvpiiKLoEESPPXQ2G2n42mV9tV#QP*`5zB(xYNy^SXa*nXxpvfRH%G9- z5fA^K9$PLYvvWK3S~fIrg{i)oTYPS90#LT=By}Z;C1rt3( zJ;P+JIo?1u-JULvAr}5`gAKVF40!gOUtxbO?1Ha$o%7v4y^EXUZgDm7y?pTOpy~uQ zcP`5XGTb3~jfK{g8k&2JUn#oF+)Ic(oD<5kSK6{M@q25?jD24>^K6>bn`(Q=?0E2j z9dcz6@tXPK`-Cq%+Rgh<|3#tj0>g@FD|gKObP0l+XkKbG>C= literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form16_minimise.png b/RyzStudio/Windows/ThemedForms/res/form16_minimise.png new file mode 100644 index 0000000000000000000000000000000000000000..3bde4b5f9b258bee440ef37d66793ceaa0bbb1cd GIT binary patch literal 276 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSL74G){)!Z!phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7?o?)`q9B-hSNuDl_ zAr}63CtLHi81T3hOHMNm-k>UeLXb(;cglUopk)n`51W`cgV(f_Em7BbEV*<;@ArNE zhI$JceL2&g2c0^;V8PC1Q`~CUd5xkQlO2)|+k|jD^wwwovBdFL)Yo!Bxuzg}O`EU#py&90#LT=By}Z;C1rt3( zJ;P+JIo?1uQ#@T9LoEF7PTt7ZY{294K0WH+3^k8bZO1h~SrT5~H!!-ed9oLef+aJz zx~+TBoM1Nj0DjT9#5Qj2n>{Dqv@EMvvX6Ukc=mGhiD}|SO{rJiR>oX^6)pC2()rxo zm-4smmOLWiyF$-U7TZrPguwl44f?K*d0)m+BrgIjg3=1o;Ul#t;Z!}}tKZ?cQg g%qhnzTYlTr@ki*KHT#$<40IoZr>mdKI;Vst074IEbN~PV literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form16_restore.png b/RyzStudio/Windows/ThemedForms/res/form16_restore.png new file mode 100644 index 0000000000000000000000000000000000000000..b6651db303506754b53656d22adcf3f56efea8c4 GIT binary patch literal 318 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QJXPB%t#~Y|-kEe@c zh=u>z$&P$Y1_G`-d#c3qPdHsart8kYe_;w=dBMYFr`4|fFI8|^DsuP7WO1v@Gv_ZW z;YvQUF84M!heFz+TgzVW%57wwy|?&XL;lR>YgGZ46$}E`OxgPFM4Z$IkEPExAC>#I zPx6SwWS&{30uyZ?eOBMGJoPi%j(*`sa(Cih>|CCj$y{)?K&1G8VnFCsWj`r}fB*RE zesSB}6KY<@)_6YX^UYayPuVJbFO&+dt>qJT7vi3^M)rA>i&?qjb&a~2T{mQa{$TKQ L^>bP0l+XkKwy=4S literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form16_restore2.png b/RyzStudio/Windows/ThemedForms/res/form16_restore2.png new file mode 100644 index 0000000000000000000000000000000000000000..b61682c370d6d0ad0aaf8717e81cdc60632e2751 GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ;P+JIo?1u>pWc?LoEESPIlxwq#)q>+~`$ol>@ihE@zMJG7G;N>D?*0>GH>TLX>ZE zTgg*@xt5b3oE!X0-tb-dB`s;+xTK|;-Ky1g>RIK;`eQkvPwokRX-S;qwD!zbrE0?u z6LU0QPxYT{#}nkG<&w>&^jK=m?$VgW1|Jx04nF2y$2!;X_50MXV%PtjNVqMVQ`0K( z*gs8|M}Vj1bd>JCPYeP)nj2O#z0^&7@5%L83 z7}{xyG|6k|6QoGGvr*Cn4;JQ5;Zm!d4^{%)cPoKFW@c}bBpH`wIRZ$MWNc$={_vTO_#yk)#WtYCH4{TQA{ZI4(y}r%b2Q?Phr`@BKI6;0cNY_?l)}c2rfB j0eir!j?gu5Ea~%KuA-xrUypO700000NkvXXu0mjfbe`0` literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form20_close2.png b/RyzStudio/Windows/ThemedForms/res/form20_close2.png new file mode 100644 index 0000000000000000000000000000000000000000..06c113d37b256d002db456ec3d53c8bb7a46baf8 GIT binary patch literal 386 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r*vAk26?e?&q9iy!t)x7$D3zfgF*C13FE6!3!9>qc z&oEhQjyF)vXHOT$5DWjSQysYu83?$hhx#vg5qjl!WGvUDE3MqE%bqdB9hkc#DB!}@ zy=`f;3bULYe0RTWZuD2HRq^#?e72kKL13b zEbMr@qJZP8!@{lCTW#NpdTljVFK5~K?qWw}xY}chZ!!D0TCD=!$8>Bk0P$`dKA5<4 zx58%OulZ@I;-|tRUf7-0O5|tf*U)uMOTBql+Zm{WnX7db*W|MeyF!7SgLgOmxUtFq zlpG&lue{ge`DgcU@yb}Qzo*H`^U}uB2VYyw-`Qc YkBe4KzRuQc2=qRKr>mdKI;Vst0MZbgxBvhE literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form20_maximise.png b/RyzStudio/Windows/ThemedForms/res/form20_maximise.png new file mode 100644 index 0000000000000000000000000000000000000000..3895c4296b4425c526f6fc01fbd69bfa9dbb7184 GIT binary patch literal 280 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r*vAk26?e?&q9iy!t)x7$D3zfgF*C13FE6!3!9>qc z&oEhQjyF(Er>Bc!h=u>#sfK(F3OueeKlnZR%d-A(-~wUexW!^YJk5M2$BrDCUc;nW zo2aF=)P(VXSn?fB4WE~#PcC+)hEG@7*fs6fCV@k1S_1YbChE0kJ)bq>@@MX&cewU` zch20S?s8NS%G}c0*}aI1_r*vAk26?e?&q9iy!t)x7$D3zfgF*C13FE6!3!9>qc z&oEhQjyF(Em#2$kh=u>#tG;{=1|lpEA`8{;oIihQnT3Nl{{y#}#Wwt$FP-L1@bEF( z{mnZ(c)=UzkX;U`$9DSN5GQrGy=&t{&}Pc*a5Db@^uN{DyNo zy=|Yc*I(eDQ+;B)W8gfN%6%D4OIDU1Vmm9Y`*zv=wU;#O8Cxd3vo2X$W8S>=AWK|T W_RJaj${T>LV(@hJb6Mw<&;$Sy-(&Rv literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form20_menu.png b/RyzStudio/Windows/ThemedForms/res/form20_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..39281437a7247c228ec5a58958769f7d90204868 GIT binary patch literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VOS+@4BLl<6e(pbstUx|zfk$L9 z0|Vb75M~tB@M-`GN|d-plmzFem6RtIr7{#GX6BXX<)xM=nCKbm876DZ@dm0{=IP=X zV&VUE>OtOS10L7nMb?hrwM*vq9N_5mx4dk6YI|z9jK`7)(N$OUYmf9lR(CkTxpa!O zpl$Iv{U2{lzUw{UaZF5~Z8MKq?^BBAQbUW@f1Zuf>>w zGuW^*h$W7dJ4AzxxsU#Zev<77U)QelF{r5}E*-JZ)D1 literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form20_menu2.png b/RyzStudio/Windows/ThemedForms/res/form20_menu2.png new file mode 100644 index 0000000000000000000000000000000000000000..cc52e787c1f97ce1d49a7710247402805918a7cc GIT binary patch literal 298 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r*vAk26?e?&q9iy!t)x7$D3zfgF*C13FE6!3!9>qc z&oEhQjyF)vY)==*5DWk0gc)0U=O!N8q}L{SdOqXFdZUlVZ8Np4B*WGwB{xX5`3hR@ zV9rpulDc_XwBZEqW$U-F%{Hw489bp;;IbxbLGg>E2R%>QA3oagF>yr}M?Qv;Y7fM lmp4QNn-#09C4km4Gfc5MlE+m4Y9r8@44$rjF6*2UngFETWkUb} literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/form20_minimise.png b/RyzStudio/Windows/ThemedForms/res/form20_minimise.png new file mode 100644 index 0000000000000000000000000000000000000000..366da415aa7c1a7c6d1f18aeb4eec5a5ad3fbd5c GIT binary patch literal 289 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r*vAk26?e?&q9iy!t)x7$D3zfgF*C13FE6!3!9>qc z&oEhQjyF)vBu^K|5DWjeQ*HSg6nI)^e(`(t*Jb@-K^vx$q+{6`nO#;IoV`{bC%M14 zFTQNip6|L0XU^>u-ODMPuKvWNE3w>HD7%$?@0qCEnhOi|r6+VSUfij6?chp>jdG30 zW+1_70tPtjmtxDqb70BbYty!mn8t6^E5;87n$36lhMd eI+w+eQT91=VeHo5PqqME$KdJe=d#Wzp$Py@K4NS%G}c0*}aI1_r*vAk26?e?&q9iy!t)x7$D3zfgF*C13FE6!3!9>qc z&oEhQjyF)vJWm(L5DWjeQyux53W1!(Z}pSu69FTe-se2O^(HoifNRZS3T^ zG*$nnr}4~vC11Jc*?Yc zV&VUG>OtN^20X5Zm%eei**~q+h|yTZ?rF?1jhg5(5ywWAM=d`tNS%G}c0*}aI1_r*vAk26?e?&q9iy!t)x7$D3zfgF*C13FE6!3!9>qc z&oEhQjyF)v7Ec$)5DWjeQxEbUGT?E&>wS~+M*pFS-naNBIIumqm-s@$)R3=jgwKI-;c)ys+zUePTz&lgD#iX1FW=`M6b6 z@uc}eEqN!oc$20rFW=0QHQASOY2O=f!*2)t89YzU%hqcApL^i5P)xK~y-6g_ALe+(j70e{c36f*7kDVrxYBf4hqi!B{B7GN?sj z@WAH4$O$3@vVKU}^TD=CDTk-i=|cdmwRK6?BwcH*eGD+2 zP9H6$JZW2Voc4h?fs>N%*uDguk#w}RwkK%|_!L+H4ggn%!{Mm~LC<>K_6eYqbQ1U? zBF+KioZn6`#0c9YwfY|czk0CK+?~)@1~TNBjP-8{$Elr^i9tBJ>d3WFt`P< z1kiQePomJGM^)M8r8s zN9XA*^{(FD+uQp^lK1J>eP*}T_U2YAAH}M@w zTauoUv^IYSsn+^oYwhXLXmkXi);gT84Qxb2=_CKz_7B71aCNcM?(Xivob#Q@Wb!Wm zQ>B!(obz9$lt&gZ&StY^;2=;ZlgS$?r4`#(BjN)|E~T8ceG2&8_IJR6*4i>~b74-- zc@uaUxGU+h?bVdhG26e|F2F~UUbX!&uo)4rNc!hf*jCPYlv27C5jS(r71#xS2VRVb zLpwV=56)(@L*w!I#vHe_$mw2$+xz6cDe0o^2W-DCsR4iVy{NwdQgAt!(CbSJCfcJo*|=qi;4l8H-~IFR_h<0Qcb; z-r)(R6ML%;a3kn5y=JY+JPvWK=~%_v+W#n)^V&80c1G;V1AN9AW@Ed9zX|>ry#iUx z2wir*Vhi`3v$CATR^ASl;%h0(UB_MvSCq}~`=6R7#g%l@ZPzx9gE;15Yp3lUh4VkS z9pCfB?%`nt(!vTp)GD>p_EIgGLg$)>^y65$fs15Dp?t8aOgYbfg^j1F@}f59oWjUF zek*$$Xd-WBwo~OM&J<=wVt=hHyMv7iyt(O7{KAiP^F_J3N4Sow`R-m~R1*pOj>o-% Z{sE_RS^{qBODF&U002ovPDHLkV1gS5*=_&; literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/res/settings16_white.png b/RyzStudio/Windows/ThemedForms/res/settings16_white.png new file mode 100644 index 0000000000000000000000000000000000000000..7b49593285474a61853ac51a1424b569fdc8e77d GIT binary patch literal 516 zcmV+f0{i`mP) 0) pickerBox1.ComboBox.SelectedIndex = 0; + + pickerBox2.ComboBox.Items.Clear(); + pickerBox2.ComboBox.Items.AddRange(new string[] { "No", "Yes" }); + if (pickerBox2.ComboBox.Items.Count > 0) pickerBox2.ComboBox.SelectedIndex = 0; + } + + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + + if (parentPanel != null) + { + textBox1.Text = parentPanel.Info.Title; + textBox2.Text = parentPanel.Info.ProcessFilename; + textBox3.Text = parentPanel.Info.ProcessArgument; + textBox4.Text = parentPanel.Info.ProcessWorkingDirectory; + pickerBox1.ComboBox.SelectedIndex = (int)parentPanel.Info.ProcessWindowStyle; + pickerBox2.ComboBox.SelectedIndex = (parentPanel.Info.ProcessAsAdmin ? 1 : 0); + + } + } + + } +} diff --git a/Windows/Forms/EditTileForm.resx b/Windows/Forms/EditTileForm.resx new file mode 100644 index 0000000..3747e00 --- /dev/null +++ b/Windows/Forms/EditTileForm.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS4xYyqcSwAAANlJREFUOE+lU1sO + gjAQrHgRY6KemQ+VT9NrgAfgfRA+SawzdTAk2lhkkgm7s7vTAq0py/LUNM0dHEEXSfYWfd8fDQIOD23b + nvFMY6jeAcxpMFIwC1HX9YWzNOCWUunR4AxnvxpUVbV3zm2UGsbUlHoEDfBhdsgf4BWDCcmYGmtqCxtw + NeQcoJ6JjGn43hXy8CvIxDeIGbREZY+pHjLgtqeVHf7SzVq7VdmDM6x9GGj1/19h9UckVv3GWMwNRh5L + 6dGYH+UCHCTQ9SfV+7pMvJIIaLL0Oudd1x2eUQ8MyeAeq0cAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/Windows/Forms/Tile/TilePanel.Designer.cs b/Windows/Forms/Tile/TilePanel.Designer.cs index 8dc31d6..ff0d3a6 100644 --- a/Windows/Forms/Tile/TilePanel.Designer.cs +++ b/Windows/Forms/Tile/TilePanel.Designer.cs @@ -28,8 +28,13 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.label1 = new System.Windows.Forms.Label(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.contextMenuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -37,6 +42,7 @@ // this.label1.AutoEllipsis = true; this.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.ContextMenuStrip = this.contextMenuStrip1; this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234))))); this.label1.Location = new System.Drawing.Point(0, 47); this.label1.Margin = new System.Windows.Forms.Padding(0); @@ -47,10 +53,33 @@ this.label1.Click += new System.EventHandler(this.TilePanel_Click); this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TilePanel_MouseDoubleClick); // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.editToolStripMenuItem, + this.removeToolStripMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(181, 70); + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.editToolStripMenuItem.Text = "&Edit"; + this.editToolStripMenuItem.Click += new System.EventHandler(this.editToolStripMenuItem_Click); + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.removeToolStripMenuItem.Text = "&Remove"; + this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); + // // pictureBox1 // this.pictureBox1.BackColor = System.Drawing.Color.Transparent; this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.ContextMenuStrip = this.contextMenuStrip1; this.pictureBox1.ErrorImage = null; this.pictureBox1.InitialImage = null; this.pictureBox1.Location = new System.Drawing.Point(0, 8); @@ -77,6 +106,7 @@ this.Size = new System.Drawing.Size(70, 70); this.Click += new System.EventHandler(this.TilePanel_Click); this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TilePanel_MouseDoubleClick); + this.contextMenuStrip1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); @@ -86,5 +116,8 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; } } diff --git a/Windows/Forms/Tile/TilePanel.cs b/Windows/Forms/Tile/TilePanel.cs index 61c617e..3ed5924 100644 --- a/Windows/Forms/Tile/TilePanel.cs +++ b/Windows/Forms/Tile/TilePanel.cs @@ -14,11 +14,14 @@ namespace AppLauncher.Windows.Forms protected Point startPosition = new Point(); protected TileModel model = new TileModel(); + protected EditTileForm editForm = null; public TilePanel() : base() { InitializeComponent(); + this.ContextMenuStrip = contextMenuStrip1; + this.MouseDown += panel_MouseDown; this.MouseUp += panel_MouseUp; this.MouseMove += panel_MouseMove; @@ -161,5 +164,16 @@ namespace AppLauncher.Windows.Forms // do nothing yet } + private void editToolStripMenuItem_Click(object sender, EventArgs e) + { + if (editForm == null) editForm = new EditTileForm(this); + editForm.ShowDialog(); + } + + private void removeToolStripMenuItem_Click(object sender, EventArgs e) + { + + } + } } \ No newline at end of file diff --git a/Windows/Forms/Tile/TilePanel.resx b/Windows/Forms/Tile/TilePanel.resx index 1af7de1..ad53752 100644 --- a/Windows/Forms/Tile/TilePanel.resx +++ b/Windows/Forms/Tile/TilePanel.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file