-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34728.123 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunningButton", "RunningButton\RunningButton.csproj", "{6DED2831-56E2-46F4-A1E4-DD55C9753BD4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6DED2831-56E2-46F4-A1E4-DD55C9753BD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6DED2831-56E2-46F4-A1E4-DD55C9753BD4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6DED2831-56E2-46F4-A1E4-DD55C9753BD4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6DED2831-56E2-46F4-A1E4-DD55C9753BD4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {E4705B43-4F95-4106-8FF0-4C71759317BC} | ||
EndGlobalSection | ||
EndGlobal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace RunningButton | ||
{ | ||
internal static class Program | ||
{ | ||
/// <summary> | ||
/// The main entry point for the application. | ||
/// </summary> | ||
[STAThread] | ||
static void Main() | ||
{ | ||
ApplicationConfiguration.Initialize(); | ||
Application.Run(new RunningButtonForm()); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
namespace RunningButton | ||
{ | ||
public class RunningButtonForm: Form | ||
{ | ||
private Button button; | ||
Random random; | ||
public RunningButtonForm() | ||
{ | ||
this.components = new System.ComponentModel.Container(); | ||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | ||
this.ClientSize = new System.Drawing.Size(1000, 600); | ||
this.Text = "Running Button"; | ||
this.button = new Button(); | ||
this.Controls.Add(button); | ||
button.Text = "Press me"; | ||
button.Location = new Point(450, 275); | ||
button.Size = new Size(100, 50); | ||
button.MouseEnter += new System.EventHandler(this.Mouse_Hover); | ||
Check warning on line 18 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
Check warning on line 18 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
Check warning on line 18 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
Check warning on line 18 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
|
||
button.Click += new System.EventHandler(this.Mouse_Click); | ||
Check warning on line 19 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
Check warning on line 19 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
Check warning on line 19 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
Check warning on line 19 in RunningButton/RunningButton/RunningButtonForm.cs GitHub Actions / build-Windows
|
||
random = new Random(); | ||
this.MinimumSize = new Size(500, 500); | ||
} | ||
/// <summary> | ||
/// Required designer variable. | ||
/// </summary> | ||
private System.ComponentModel.IContainer? components = null; | ||
|
||
/// <summary> | ||
/// Clean up any resources being used. | ||
/// </summary> | ||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | ||
protected override void Dispose(bool disposing) | ||
{ | ||
if (disposing && (components != null)) | ||
{ | ||
components.Dispose(); | ||
} | ||
base.Dispose(disposing); | ||
} | ||
|
||
/// <summary> | ||
/// Event that happens when user hovers on the button | ||
/// </summary> | ||
/// <param name="sender">parameter that contains a reference to the control that raised the event</param> | ||
/// <param name="e">parameter that contains the event data</param> | ||
private void Mouse_Hover(object sender, EventArgs e) | ||
{ | ||
this.button.Location = new Point(random.Next(0, this.Width - 130), random.Next(0 , this.Height - 100)); | ||
} | ||
|
||
/// <summary> | ||
/// Event that happens when user successfully clicks the button | ||
/// </summary> | ||
/// <param name="sender">parameter that contains a reference to the control that raised the event</param> | ||
/// <param name="e">parameter that contains the event data</param> | ||
private void Mouse_Click(object sender, EventArgs e) | ||
{ | ||
System.Windows.Forms.Application.Exit(); | ||
} | ||
|
||
/// <summary> | ||
/// Required method for Designer support - do not modify | ||
/// the contents of this method with the code editor. | ||
/// </summary> | ||
|
||
} | ||
} |