
RotateTransform
Publicado por luis (7 intervenciones) el 22/04/2017 03:45:54
Buenas noches por este medio pido ayuda para hacer que unas figuras roten mediante el rotate transform ete es mi codigo si me pudieran ayudar se los agradeceria
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace ejercicio_5
{
class Lunas : Esqueleto
{
// Attributos---------------------------------
private int _radio;
//Propiedades--------------------------------
public int Radio
{ //Protege el acceso al atributo _radio
get { return _radio; }
set
{
if (value > 0) _radio = value;
}
}
//-----------------------------------------------
//Constructor-------------------------------------
public Lunas(Graphics formulario, Random aleatorio)
: base(formulario, aleatorio)
{
Radio = aleatorio.Next(1, 150);
}
//Destructor-------------------------------------
~Lunas()
{
_pluma.Dispose();
}
//Métodos------------------------------------------
public void Dibuja()
{
_pluma.Width = 5;
_formulario.DrawArc(_pluma, _x, _y, _radio, _radio, 270, 180);
_brocha.Color = Color.White;
_formulario.DrawArc(_pluma, _x + ((Radio / 2) / 2), _y, _radio - (Radio / 2), _radio, 270, 180);
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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 ejercicio_5
{
public partial class Form1 : Form
{
Graphics grafico;
Random aleatorio;
Lunas[] Luna;
Hexagono[] hexagonos;
public Form1()
{
InitializeComponent();
grafico = this.CreateGraphics();
aleatorio = new Random();
}
private void button1_Click(object sender, EventArgs e)
{
hexagonos = new Hexagono[20];
for (int i = 0; i < 20; i++)
{
hexagonos[i] = new Hexagono(grafico, aleatorio);
hexagonos[i].Dibuja();
}
}
private void button2_Click(object sender, EventArgs e)
{
Luna = new Lunas[20];
for (int i = 0; i < 20; i++)
{
Luna[i] = new Lunas(grafico, aleatorio);
Luna[i].Dibuja();
}
}
}
}
Valora esta pregunta


0