ForumKalbi.Com

ForumKalbi.Com (https://www.forumkalbi.com/index.php)
-   Bilgisayar (https://www.forumkalbi.com/forumdisplay.php?f=220)
-   -   C# Ekrana rastgele daireler çizmek (https://www.forumkalbi.com/showthread.php?t=4648)

Candres 27 Ocak 2024 18:57

C# Ekrana rastgele daireler çizmek
 
C# Ekrana rastgele daireler çizmek
Uygulama üzerinde rastgele renk, açı ve merkeze sahip daireler çizmenizi sağlayan kod örneği. Ayrıca uygulama ile çizimi *.jpg olarak kaydedebilirsiniz.


Kod:

/*
* Created using SharpDevelop free C# IDE from
* [Foruma üye olmadığınız sürece forum içeriğindeki bağlantıları görüntüleyemezsiniz. Foruma üye olmak için TIKLAYIN!]
* User: vegaseat
*
* Draw a bunch of random circles or lines on a windows form
* A very merry Windows Application
*/

using System;
using System.Drawing; // GDI+ stuff
using System.Drawing.Imaging; // ImageFormat
using System.Windows.Forms;

namespace DrawLineCircle
{
// Summary description for Form1
// a window with five buttons
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnLine;
private System.Windows.Forms.Button btnCircle;
private System.Windows.Forms.Button btnFill;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnClear;

private Bitmap DrawArea; // make a persistent drawing area

// Required designer variable
private System.ComponentModel.Container components = null;

private Random rnd;
private Pen myPen;

public Form1()
{
InitializeComponent();
rnd = new Random((int)DateTime.Now.Ticks); // seeded with ticks
myPen = new Pen(Color.Red);
}

// Clean up any resources being used
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code
private void InitializeComponent()
{
this.btnCircle = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.btnLine = new System.Windows.Forms.Button();
this.btnFill = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.SuspendLayout();
//


Forum saati; Türkiye'ye göre ayarlanmış olup, şu an saat: 23:46.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Navbar with Avatar by Motorradforum