From 96ca8d0424d8724a8f1adddb47440c751c35bbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Wed, 21 Apr 2021 20:55:34 +0200 Subject: [PATCH] =?UTF-8?q?R=C3=A4ttat=20registryhantering=20+=20.CopyTo?= =?UTF-8?q?=20ist=C3=A4llet=20f=C3=B6r=20MoveTo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PictureReposit/Form1.Designer.cs | 4 ++++ PictureReposit/Form1.cs | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/PictureReposit/Form1.Designer.cs b/PictureReposit/Form1.Designer.cs index 93f6671..5652820 100644 --- a/PictureReposit/Form1.Designer.cs +++ b/PictureReposit/Form1.Designer.cs @@ -50,6 +50,9 @@ namespace PictureReposit // // pictureBox1 // + this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.pictureBox1.Location = new System.Drawing.Point(183, 72); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(654, 548); @@ -150,6 +153,7 @@ namespace PictureReposit this.txtRootDir.Size = new System.Drawing.Size(164, 23); this.txtRootDir.TabIndex = 10; this.txtRootDir.Text = "D:\\Bildlabb\\LabRotCat"; + this.txtRootDir.TextChanged += new System.EventHandler(this.txtRootDir_TextChanged); // // Form1 // diff --git a/PictureReposit/Form1.cs b/PictureReposit/Form1.cs index 01b11a7..e7c6e50 100644 --- a/PictureReposit/Form1.cs +++ b/PictureReposit/Form1.cs @@ -20,7 +20,7 @@ namespace PictureReposit { InitializeComponent(); - RegistryKey PictureHandling = Registry.LocalMachine.OpenSubKey(@"Software\Tfoman\PictureHandling"); + RegistryKey PictureHandling = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Tfoman\PictureReposit"); if (PictureHandling == null) { txtRootDir.Text = @"D:\Bildlabb\LabRotCat"; @@ -188,7 +188,22 @@ namespace PictureReposit private void txtRootDir_TextChanged(object sender, EventArgs e) { - - } + //Software\Tfoman\PictureReposit + RegistryKey Tfoman = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Tfoman", true); + RegistryKey PictureHandling = Tfoman.OpenSubKey(@"PictureReposit", true); + if (PictureHandling == null) + { + if (Tfoman == null) + { + Tfoman = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Tfoman"); + } + else + PictureHandling = Tfoman.CreateSubKey(@"PictureReposit"); + } + else + { + PictureHandling.SetValue(@"RootMap", txtRootDir.Text); + } + } } }