Where to insert code c# to winforms
-
Hello, everyone, I'm very new to programming. Wherever I put the code, he always makes a mistake. Two months I can't move, I read a c++ textbook and a forum windows microsoft, but I didn't find an answer. My task is to ensure that, when a rapid key is pressed, the ctrl+shift+P (or ctrl+up+P) in the window of another program, actions are carried out: ctrl+V, waiting 4 seconds, enter, 7 times Tab, waiting, enter, wait, wait, wait, Ins, ctrl+enter, wait 4 seconds, Tab And so that in the future, I can change my own actions, programming. The gaps in the code are right in visual studio 2019. Help me, friends, where to put the code yourself.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class CIA_Special_Agents : Form
{
public CIA_Special_Agents()
{
InitializeComponent();
}private void label1_Click(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) { } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } private void textBox3_TextChanged(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void label4_Click(object sender, EventArgs e) { } private void label5_Click(object sender, EventArgs e) { } private void textBox5_TextChanged(object sender, EventArgs e) { } private void textBox2_TextChanged(object sender, EventArgs e) { } private void CIA_Special_Agents_Load(object sender, EventArgs e) { } private void pictureBox1_Click(object sender, EventArgs e) { } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (checkBox1.Checked == true) { button1.Enabled = true; } else { button1.Enabled = false; } } private void label9_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { }
}
♪
-
Your question sounds like, "write me a car clicker from scratch." Separate the task for minor tasks and decide separately. Start writing the code. Read or watch the balloon courses. The lack of knowledge of the language and the PLO will not allow you to move forward and focus on the problem. Moving the buttons in the shape designer and licking their knowledge will not add.
See the method.
CIA_Special_Agents_Load
? This method is called the event processor.Form.Load
" The code in this method is performed once when the shape is downloaded, you can start writing the starting code in this method between the brackets. That's the answer to your question.There's a lot of different events, their list can be looked at in the shape designer, setting out the shape and pressing the button button in the right bottom corner. All these developments occur under different conditions, for example
Form.Closing
A new processor may be created for him, or the already written off the list proposed by the studio, before closing the form. Events are not just in shape, but they all have elements on it without exception.All I can do is start action while compressing hot keys, you need to. https://ru.stackoverflow.com/a/1140664/373567 ♪
And to simulate the entry, an old good NuGet package can help. InputSimulatorif you don't want to work directly with Win32 API
SendInput
I'll tell you what, it's not easy, it' be easier with the bag.To edit the list of actions, create a class containing performance data and a collection from these classes. Put the collection on for example.
DataGridView
♪ How do https://ru.stackoverflow.com/a/1199692/373567 ♪As you can see, a lot of work. But if it's stupid to copy someone's code to their own project, it won't work well, you need to know the basis. You can start studying them for example. https://youtube.com/playlist?list=PLuGqgO5WmeGPTZqDHZDIum3h7HnfBfzmZ ♪ I used to start them myself.