0% found this document useful (0 votes)
29 views2 pages

Tic Tac Toe 1afase

The document defines a GFX class that handles graphics rendering. The GFX class takes in a Graphics object, stores it as a property, and calls a static method to set up the canvas by drawing lines to divide it into a grid. It fills the background and draws four lines to create a 3x3 grid on a 500x600 canvas.

Uploaded by

Ana Rangel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Tic Tac Toe 1afase

The document defines a GFX class that handles graphics rendering. The GFX class takes in a Graphics object, stores it as a property, and calls a static method to set up the canvas by drawing lines to divide it into a grid. It fills the background and draws four lines to create a 3x3 grid on a 500x600 canvas.

Uploaded by

Ana Rangel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CLASSE GFX

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace CSDGame
{
public class GFX
{
private static Graphics gObject;

public GFX(Graphics g)
{
gObject = g;
setUpCanvas();
}

public static void setUpCanvas()
{
Brush bg = new SolidBrush(Color.WhiteSmoke);
Pen lines = new Pen(Color.Black);

gObject.FillRectangle(bg, new Rectangle(0,0,500,600));

gObject.DrawLine(lines, new Point(167,0), new Point(167,500));
gObject.DrawLine(lines, new Point(334,0), new Point(334,500));

gObject.DrawLine(lines, new Point(0,167), new Point(500,167));
gObject.DrawLine(lines, new Point(0,334), new Point(500,334));
}
}
}








Formulrio FORM1

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CSDGame
{
public partial class Form1 : Form
{
GFX engine;

public Form1()
{
InitializeComponent();
}

private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics toPass = panel1.CreateGraphics();
engine = new GFX(toPass);
}
}
}

You might also like