Click here to Skip to main content
14,494,314 members
Rate this:
Please Sign up or sign in to vote.
See more:
I need to draw a Greece flag, сan someone tell me how to do this, maybe there are some tutorials
Or someone has code for a similar task as an example

What I have tried:

/////////////////////////////////////////////
Posted
Updated 25-Mar-20 22:45pm
Comments
lmoelleb 26-Mar-20 4:45am
   
C# is a programming language that can be used in a lot of environments (command line, WinForm, WPF, Unity3D (and other game engines), websites, Xamarin (mobile), ...
Drawing something differs between all of these environments, so you need to provide information on which environment you want to use. We do not want to spend half an hour telling you how to do something in a web site, just to be told it is a WinForm application you want. :)

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Maybe this tutorial can help you.
It is about System.Drawing.Graphics,
GDI+ Tutorial for Beginners[^]
You can start with
using System.Drawing;
using System.Windows.Forms;

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

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            var myColor = ColorTranslator.FromHtml("#0C59A6");

            e.Graphics.FillRectangle(new SolidBrush(myColor), 0, 0, 100, 100);
            e.Graphics.FillRectangle(new SolidBrush(myColor), 150, 0, 100, 100);
            e.Graphics.FillRectangle(new SolidBrush(myColor), 0, 150, 100, 100);
            e.Graphics.FillRectangle(new SolidBrush(myColor), 150, 150, 100, 100);
        }
    }
}

This will draw the top left rectangles of the greek flag.
The missing parts is your homework.
   
Comments
Maciej Los 26-Mar-20 9:46am
   
5ed!
TheRealSteveJudge 26-Mar-20 9:59am
   
Thank you, Maciej!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100