UYGULAMAYI İNDİR
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace ARGB
{
public partial class Drawing : Form
{
public Drawing()
{
InitializeComponent();
}
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
private void Drawing_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
private void CizimYap()
{
Graphics g;
g = cizimAlani.CreateGraphics();
//Kırmızı dikdörtgen
g.FillRectangle(new SolidBrush(Color.FromArgb(100, 255, 0, 0)), 40, 40, 100, 100);
//Yeşil dikdörtgen
g.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 255, 0)), 80, 80, 170, 170);
//Mavi dikdörtgen
g.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 255)), 190, 40, 100, 100);
//Sarı dikdörtgen
g.FillRectangle(new SolidBrush(Color.FromArgb(100, 255, 255, 0)), 40, 190, 100, 100);
//Beyaz dikdörtgen
g.FillRectangle(new SolidBrush(Color.FromArgb(100, 255, 255, 255)), 190, 190, 100, 100);
}
private void btnKapat_Click(object sender, EventArgs e)
{
//Programı kapat
this.Close();
}
private void cizimAlani_Paint(object sender, PaintEventArgs e)
{
CizimYap();
}
private void btnCiz_Click(object sender, EventArgs e)
{
CizimYap();
}
}
}
Hiç yorum yok :
Yorum Gönder