Notes
Notes - notes.io |
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FormuSars
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Text = "Merhaba Dünya";
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
// formda bir tuşa basıldı,
// eğer x ya da X'e basıldıysa formu kapatalım.
char tus = e.KeyChar;
MessageBox.Show("Formda " + tus.ToString() + " tuşuna basıldı.");
if ((tus == 'x') || (tus == 'X')) this.Close(); // formu kapatacak
}
private void Form1_Load_1(object sender, EventArgs e)
{
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
this.Text = "txtbx1 de KEYDOWN oldu";
// olay argümanı biraz daha zengin
label2.Text = "KeyCode:" + e.KeyCode;
label3.Text = "KeyData:" + e.KeyData.ToString();
label4.Text = "KeyVaule:" + e.KeyValue.ToString();
/*
* KeyCode: klavyedeki tüm olası tuşlardan hangisine basıldığını verir.
* KeyData: KeyCode ile birlikte değiştirme tuşaları (ALT CTRL SHIFT)hamgisine basıldığını gösterir
* Keyvaalue:Ham sayısal değer :ASCII değerini verir
*/
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
this.Text = "txtbx1 de KEYUP oldu";
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
char tus = e.KeyChar;
label1.Text = "KeyPress ile basılan tuş: " + tus.ToString();
// KeyPress olayında olay argümanında sadece
// e.KeyChar yani basılan tuş.
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
label1.Text = "labell Tıklandı";
}
private void label1_MouseHover(object sender, EventArgs e)
{
label1.Text = "label1 üzerine fare geldi";
}
private void label1_DoubleClick(object sender, EventArgs e)
{
label1.Text = "labell Çift Tıklandı";
}
private void label1_MouseLeave(object sender, EventArgs e)
{
label1.Text = "label1 üzerinden fare ayrıldı";
}
private void button1_Click(object sender, EventArgs e)
{
//formun kordinatlarına rastgele sayı ekleyip çıkartarak sarsalım
Random rasgele = new Random();
//formun konumu
Point konum = new Point();
konum = this.Location;
for (int i = 0; i < 10; i++) ;
{
X = rastgele.Next(-10, 10);
y = rastgele.Next(-10, 10);
konum.X = konum.X + x;
konum.Y = konum.Y + y;
this.Location = konum;
}
}
PART 2
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;
using System.Windows.Forms.VisualStyles;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
// formun koordinatlarını yarıçapı 100 piksel olan dairenin kenarları boyunca değiştirelim
int x, y, r;
r = 100;
int en = Screen.PrimaryScreen.Bounds.Width;
int boy = Screen.PrimaryScreen.Bounds.Height;
// ekranın ortasını konuma ve forma aktaralım
Point konum = new Point(en/2,boy/2);
this.Location = konum;
for(int theta = 0;theta<360; theta++)
{// 0'dan 360 dereceye 1 derecelik artımlarla
x = konum.X + (int)( r*Math.Cos(theta/180*Math.PI));
y = konum.Y + (int)( r*Math.Sin(theta*Math.PI/180));
this.Location = new Point(x, y);
System.Threading.Thread.Sleep(5);
// her yeni konum atamasından sonra 5 milisaniye uyu
}
}
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team