Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,906 questions

51,838 answers

573 users

How to draw an empty 3D box frame (WinForms) in C#

1 Answer

0 votes
using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics G = e.Graphics;
            int height = 50; // y-axis
            int width = 100; // x-axis
            int diagonal = 20;

            Point point = new Point(75, 75);
            Pen pen = new Pen(Color.MediumPurple, 1.0f);
            G.DrawRectangle(pen, new Rectangle(point.X, point.Y, width, height));

            G.DrawLine(pen, point.X, point.Y, point.X + diagonal, point.Y - diagonal);
            G.DrawLine(pen, point.X + diagonal, point.Y - diagonal, point.X + width + diagonal, 
                       point.Y - diagonal);
            G.DrawLine(pen, point.X + 100, point.Y, point.X + 100 + diagonal, point.Y - diagonal);
            G.DrawLine(pen, point.X + 100, point.Y + 50, point.X + 100 + diagonal, point.Y + 50 - diagonal);
            G.DrawLine(pen, point.X + 100 + diagonal, point.Y - diagonal, point.X + 100 + diagonal, 
                       point.Y + 50 - diagonal);

            G.Dispose();
            pen.Dispose();
        }
    }
}



answered Feb 9, 2015 by avibootz
edited Feb 9, 2015 by avibootz

Related questions

...