Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Graphics

Drawing


Hey Hackforums. I have been doing C# for quite some time now, but I never really messed with graphics. My first attempt with C# graphics lead me to this:

[IMG]http://img98.imageshack.us/img98/3080/96670599.gif[/IMG]

Its not much, but I mean common, its pretty cool :D.

The only reason I am posting this is for someone to see what it is like to draw in C#. I'm sure someone can come up with something cool to make. Anyway, I commented my source, so hopefully someone can put some use to it!

Source:
Code
Graphics surface; // sets up new graphics
            surface = this.CreateGraphics(); // creates graphic on the form
            Pen pen1 = new Pen(Color.Black, 1.0f); // new pen, color blac
            HatchBrush brushone = new HatchBrush(HatchStyle.DiagonalCross, Color.Black); // new brush
            Rectangle rec2 = new Rectangle(10, 10, 100, 100); // new rectangle, X/Y / Size
            Font drawfont = new Font("Arial", 20); // new font for my name



            surface.DrawString("Mr. Predictable", drawfont, brushone, 210.0f, 20.0f); // draws my name



            surface.DrawEllipse(pen1, 200, 100, 200, 200); // head
            surface.DrawEllipse(pen1, 230, 130, 50, 50); // eye 1
            surface.DrawEllipse(pen1, 310, 130, 50, 50); //eye 2
            surface.DrawArc(pen1, 275, 200, 40, 40, 180, -180); // mouth


I really hope someone finds this interesting!
http://www.pulsecodes.info
Computer and Information Science major.
Information Technology Apprentice.
Freelance Programmer.
Good work. ^^
Now make a frame of a box. Then try to use scrollbars to increase size of the box. Or something similar. :)
(Nov 13, 2010 11:50 PM)Coder Wrote:  Good work. ^^
Now make a frame of a box. Then try to use scrollbars to increase size of the box. Or something similar. :)

Ooo sounds challenging (for me at least since I'm new to graphics)

I'll give it a shot!
http://www.pulsecodes.info
Computer and Information Science major.
Information Technology Apprentice.
Freelance Programmer.
(Nov 13, 2010 11:50 PM)Coder Wrote:  Good work. ^^
Now make a frame of a box. Then try to use scrollbars to increase size of the box. Or something similar. :)

Hey, I got it! :D

[IMG]http://img607.imageshack.us/img607/6338/68395030.gif[/IMG]

Next.

Also, it doesn't actually lag like that. The GIF just distorted it a bit and added some lag.

My code:
Code
private void trackBar1_Scroll(object sender, EventArgs e)
  {
    this.Refresh();
    Graphics start = this.CreateGraphics();
    Pen pen1 = new Pen(Color.Black, 1.0f);
    Rectangle rect1 = new Rectangle(200, 100, trackBar1.Value, trackBar1.Value);
    start.DrawRectangle(pen1, rect1);
  }
http://www.pulsecodes.info
Computer and Information Science major.
Information Technology Apprentice.
Freelance Programmer.
Nice. :)
Now make a frame of cube and increase its size.
That was the last thing I did before I failed to rotate it like 3D, and starting gradients.
(Nov 14, 2010 03:07 AM)Coder Wrote:  Nice. :)
Now make a frame of cube and increase its size.
That was the last thing I did before I failed to rotate it like 3D, and starting gradients.

I'll do it tomorrow. I'm really tired lol.
http://www.pulsecodes.info
Computer and Information Science major.
Information Technology Apprentice.
Freelance Programmer.
dude how do you make .gifs like that?
your .giffing skills are bomb
[Image: lolj.png]
not a single person has the time for that scenario
(Nov 18, 2010 08:27 PM)Joseph Ducreux Wrote:  dude how do you make .gifs like that?
your .giffing skills are bomb

One word... Camtasia.

Or record an AVI then convert to gif which camtasia does it automatically.
(Nov 18, 2010 08:27 PM)Joseph Ducreux Wrote:  dude how do you make .gifs like that?
your .giffing skills are bomb

I use Camtasia, then I convert it to a GIF.
http://www.pulsecodes.info
Computer and Information Science major.
Information Technology Apprentice.
Freelance Programmer.