Archive Browser
Download RotateArray.zip version 1.0.0.0, last updated 24/12/2015 (10.66 KB)
Download- md5: b34557c7c9d55d451bd5441234cafc15
- sha1: 7b085368ef50d8f7dfa37e84aaeb683b8ae25d4b
- sha256: 5ceae932d31aaf657e5c3dfc0d8908d52980bdfb7361bbc1473cfe5188ec4c0e
// Rotating an array using C#
// http://www.cyotek.com/blog/rotating-an-array-using-csharp
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace CyotekDotComRotateArrayDemo
{
internal partial class MainForm : Form
{
#region Constructors
public MainForm()
{
this.InitializeComponent();
}
#endregion
#region Methods
/// <summary>
/// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data. </param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
iPolyominoViewer.Shape = Tetrominoes.I;
jPolyominoViewer.Shape = Tetrominoes.J;
lPolyominoViewer.Shape = Tetrominoes.L;
oPolyominoViewer.Shape = Tetrominoes.O;
sPolyominoViewer.Shape = Tetrominoes.S;
tPolyominoViewer.Shape = Tetrominoes.T;
zPolyominoViewer.Shape = Tetrominoes.Z;
}
private void closeButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void cyotekLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
Process.Start("http://www.cyotek.com");
}
catch (Exception ex)
{
MessageBox.Show($"Failed to open URL. {ex.GetBaseException(). Message}", this.Text, MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
private void rotationTimer_Tick(object sender, EventArgs e)
{
if (clockwiseRadioButton.Checked)
{
iPolyominoViewer.Shape = iPolyominoViewer.Shape.RotateClockwise();
jPolyominoViewer.Shape = jPolyominoViewer.Shape.RotateClockwise();
lPolyominoViewer.Shape = lPolyominoViewer.Shape.RotateClockwise();
oPolyominoViewer.Shape = oPolyominoViewer.Shape.RotateClockwise();
sPolyominoViewer.Shape = sPolyominoViewer.Shape.RotateClockwise();
tPolyominoViewer.Shape = tPolyominoViewer.Shape.RotateClockwise();
zPolyominoViewer.Shape = zPolyominoViewer.Shape.RotateClockwise();
}
else
{
iPolyominoViewer.Shape = iPolyominoViewer.Shape.RotateAntiClockwise();
jPolyominoViewer.Shape = jPolyominoViewer.Shape.RotateAntiClockwise();
lPolyominoViewer.Shape = lPolyominoViewer.Shape.RotateAntiClockwise();
oPolyominoViewer.Shape = oPolyominoViewer.Shape.RotateAntiClockwise();
sPolyominoViewer.Shape = sPolyominoViewer.Shape.RotateAntiClockwise();
tPolyominoViewer.Shape = tPolyominoViewer.Shape.RotateAntiClockwise();
zPolyominoViewer.Shape = zPolyominoViewer.Shape.RotateAntiClockwise();
}
}
private void speedTrackBar_Scroll(object sender, EventArgs e)
{
rotationTimer.Interval = speedTrackBar.Value;
}
#endregion
}
}
Donate
This software may be used free of charge, but as with all free software there are costs involved to develop and maintain.
If this site or its services have saved you time, please consider a donation to help with running costs and timely updates.
Donate