Click here to Skip to main content
15,358,707 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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:

Updated 26-Dec-20 21:52pm
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

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()

        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.
Maciej Los 26-Mar-20 9:46am
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900