Public static yazdıysa Public hayli hayli yazıp denemiştir hocam.Public olarak fonksiyon dışında tanımlamayı denediniz mi?
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 WindowsFormsApp2
{
public partial class Form1 : Form
{
private int moveborder;
public Form1()
{
InitializeComponent();
moveborder = (Screen.PrimaryScreen.Bounds.Width - this.Size.Width) / 2 + button1.Width / 2;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (0 < Control.MousePosition.X - moveborder && Control.MousePosition.X - moveborder < 920)
{
button1.Location = new Point(Control.MousePosition.X - moveborder, button1.Location.Y);
}
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}
}
}
Bu sitenin çalışmasını sağlamak için gerekli çerezleri ve deneyiminizi iyileştirmek için isteğe bağlı çerezleri kullanıyoruz.