Update after Final revision
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
25
MainForm.Designer.cs
generated
25
MainForm.Designer.cs
generated
@@ -32,7 +32,7 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.disablePrintScreenCaptureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toggleHotkeyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
@@ -49,30 +49,29 @@
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.disablePrintScreenCaptureToolStripMenuItem,
|
||||
this.toggleHotkeyToolStripMenuItem,
|
||||
this.toolStripSeparator1,
|
||||
this.exitToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(222, 54);
|
||||
this.contextMenuStrip1.Text = "test";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 76);
|
||||
this.contextMenuStrip1.Text = "contextMenuStrip1";
|
||||
//
|
||||
// disablePrintScreenCaptureToolStripMenuItem
|
||||
// toggleHotkeyToolStripMenuItem
|
||||
//
|
||||
this.disablePrintScreenCaptureToolStripMenuItem.Name = "disablePrintScreenCaptureToolStripMenuItem";
|
||||
this.disablePrintScreenCaptureToolStripMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.disablePrintScreenCaptureToolStripMenuItem.Text = "Disable Print Screen capture";
|
||||
this.disablePrintScreenCaptureToolStripMenuItem.Click += new System.EventHandler(this.toggleHotkeyToolStripMenuItem_Click);
|
||||
this.toggleHotkeyToolStripMenuItem.Name = "toggleHotkeyToolStripMenuItem";
|
||||
this.toggleHotkeyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.toggleHotkeyToolStripMenuItem.Click += new System.EventHandler(this.toggleHotkeyToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(218, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.exitToolStripMenuItem.Text = "Закрыть";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// MainForm
|
||||
@@ -93,7 +92,7 @@
|
||||
#endregion
|
||||
private System.Windows.Forms.NotifyIcon notifyIcon1;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem disablePrintScreenCaptureToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem toggleHotkeyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
}
|
||||
|
||||
26
MainForm.cs
26
MainForm.cs
@@ -21,7 +21,7 @@ namespace ScreenCaptureApp
|
||||
InitializeComponent();
|
||||
if (!RegisterHotKey(this.Handle, PRINT_SCREEN_ID, 0x0, 0x2C))
|
||||
{
|
||||
notifyIcon1.ShowBalloonTip(1000, "Error", "Failed to register Print Screen hotkey", ToolTipIcon.Error);
|
||||
notifyIcon1.ShowBalloonTip(1000, "Ошибка", "Не удалось привязать Print Screen", ToolTipIcon.Error);
|
||||
}
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
@@ -53,14 +53,14 @@ namespace ScreenCaptureApp
|
||||
{
|
||||
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||
{
|
||||
sfd.Title = "Save screenshot";
|
||||
sfd.Title = "Сохранить скриншот";
|
||||
sfd.Filter = "PNG Image|*.png|JPEG Image|*.jpg|Bitmap Image|*.bmp";
|
||||
sfd.FileName = $"screenshot_{DateTime.Now:dd-MM-yyyy_HH.mm.ss}";
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
captureForm.CapturedImage.Save(sfd.FileName, GetImageFormat(sfd.FileName));
|
||||
notifyIcon1.ShowBalloonTip(1000, "Success", "Screenshot saved!", ToolTipIcon.Info);
|
||||
notifyIcon1.ShowBalloonTip(1000, "Успех", "Скриншот сохранен!", ToolTipIcon.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,11 +69,11 @@ namespace ScreenCaptureApp
|
||||
try
|
||||
{
|
||||
Clipboard.SetImage(captureForm.CapturedImage);
|
||||
notifyIcon1.ShowBalloonTip(1000, "Success", "Copied to clipboard!", ToolTipIcon.Info);
|
||||
notifyIcon1.ShowBalloonTip(1000, "Успех", "Скриншот скопирован в буфер обмена!", ToolTipIcon.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
notifyIcon1.ShowBalloonTip(1000, "Error", $"Copy failed: {ex.Message}", ToolTipIcon.Error);
|
||||
notifyIcon1.ShowBalloonTip(1000, "Ошибка", $"Копирование не удалось: {ex.Message}", ToolTipIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,8 +84,7 @@ namespace ScreenCaptureApp
|
||||
|
||||
private System.Drawing.Imaging.ImageFormat GetImageFormat(string fileName)
|
||||
{
|
||||
string ext = System.IO.Path.GetExtension(fileName).ToLower();
|
||||
switch (ext)
|
||||
switch (System.IO.Path.GetExtension(fileName).ToLower())
|
||||
{
|
||||
case ".jpg": return System.Drawing.Imaging.ImageFormat.Jpeg;
|
||||
case ".jpeg": return System.Drawing.Imaging.ImageFormat.Jpeg;
|
||||
@@ -96,7 +95,7 @@ namespace ScreenCaptureApp
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
disablePrintScreenCaptureToolStripMenuItem.Text = $"Print Screen Capture: {(captureOnKeyPress ? "ON" : "OFF")}";
|
||||
toggleHotkeyToolStripMenuItem.Text = $"Отлик на Print Screen: {(captureOnKeyPress ? "ON" : "OFF")}";
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
@@ -125,9 +124,9 @@ namespace ScreenCaptureApp
|
||||
private void toggleHotkeyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
captureOnKeyPress = !captureOnKeyPress;
|
||||
disablePrintScreenCaptureToolStripMenuItem.Text = $"Print Screen Capture: {(captureOnKeyPress ? "ON" : "OFF")}";
|
||||
notifyIcon1.ShowBalloonTip(250, "Screen Capture",
|
||||
captureOnKeyPress ? "Print Screen capture enabled" : "Print Screen capture disabled",
|
||||
toggleHotkeyToolStripMenuItem.Text = $"Отлик на Print Screen: {(captureOnKeyPress ? "ON" : "OFF")}";
|
||||
notifyIcon1.ShowBalloonTip(250, "Захват экрана",
|
||||
captureOnKeyPress ? "Отлик на Print Screen включен" : "Отлик на Print Screen отключен",
|
||||
ToolTipIcon.Info);
|
||||
}
|
||||
|
||||
@@ -136,10 +135,5 @@ namespace ScreenCaptureApp
|
||||
base.OnFormClosing(e as FormClosingEventArgs);
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void bigButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
CaptureScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,7 @@ namespace ScreenCaptureApp
|
||||
|
||||
public ScreenCaptureForm()
|
||||
{
|
||||
InitializeForm();
|
||||
CaptureScreen();
|
||||
}
|
||||
|
||||
private void InitializeForm()
|
||||
{
|
||||
this.SetTopLevel(true);
|
||||
this.FormBorderStyle = FormBorderStyle.None;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
this.Opacity = 0.3;
|
||||
@@ -35,6 +30,8 @@ namespace ScreenCaptureApp
|
||||
this.Size = Screen.PrimaryScreen.Bounds.Size;
|
||||
|
||||
_selectionPen = new Pen(Color.Red, 2) { DashStyle = System.Drawing.Drawing2D.DashStyle.Dash };
|
||||
|
||||
CaptureScreen();
|
||||
}
|
||||
|
||||
private void CaptureScreen()
|
||||
|
||||
Reference in New Issue
Block a user