How to draw in C# using the Graphics Class - CSharp Programming

Sdílet
Vložit
  • čas přidán 16. 07. 2024
  • Today we are going to have fun drawing shapes in C#! I'm going to show you how to draw lines, rectangles, circles and images to the screen!!
    We are going to build a simple Winforms app that will draw a scene of a cat(?) chasing a chicken(?) with lines and text!
    We are going to use the System.Drawing library and more specifically the Graphics class. This isn't going to use Unity or any 3rd party library like MonoGame. This is all just built into the .Net Framework!
    This should be a lot of fun and I hope you enjoy it!
  • Jak na to + styl

Komentáře • 23

  • @HexaflexagonFan
    @HexaflexagonFan Před rokem +6

    Thank you so much for this tutorial!! I was trying to find a way to render graphics in plain C# then i came accross this!

  • @zarifahmed5192
    @zarifahmed5192 Před rokem +3

    HOW IS THIS NOT AT 1.2 BILLI9M VEIWS? THIS IS LITIRALLY A GODSEND

  • @tienhuynh2435
    @tienhuynh2435 Před rokem

    thanks for uploading this bro, it's useful

  • @krishnachoubey8648
    @krishnachoubey8648 Před 4 měsíci +1

    Thanks for the tutorial kind man!
    PSA : I suggest watching the video in >1.25x speed

  • @Enginering
    @Enginering Před rokem

    thank you , i was looking for a way to convert a panel from windows form to pdf ,
    i wasted alot time from other tutorial but they are very low quality pdf . now this method work

  • @AudeJavel12
    @AudeJavel12 Před rokem +1

    Hello, I would like to ask how to move the image? Is it possible to drag it with the mouse and place it somewhere else? I couldnt get it work since these images don't have any event like MouseClick, MouseDown etc

  • @-wokhead
    @-wokhead Před rokem

    What about the performance? Instead of rendering in unity for example, could it still keep up with other engines?

  • @NH-cs6sq
    @NH-cs6sq Před 11 měsíci

    Thank you so much

  • @springbertstudios7005
    @springbertstudios7005 Před 4 měsíci +1

    The adult graphics part doesn't work.I did what you did in this tutorial and it didn't work.Can you tell me why it didn't work

  • @jordanedwards3114
    @jordanedwards3114 Před 3 měsíci

    what is InitializeComponent();? it does not exist from what i can tell.

  • @Atezian
    @Atezian Před rokem

    I can't find windows form app in VS 2022.

  • @sgxeim7910
    @sgxeim7910 Před 2 měsíci

    How do I know the file of the image I downloaded? And to code it into the Form

  • @inkoigmr5571
    @inkoigmr5571 Před 2 lety +4

    nice bro

  • @osanbrazil999
    @osanbrazil999 Před rokem +1

    I learned a lot from this video, thanks, but how can I do this OUTSIDE the Form's Paint event? Let's say, when I click a button or menu strip, for example?

    • @DarrenG
      @DarrenG  Před rokem +3

      Simple plan: Create a variable "Should Draw Sprite"
      It defaults to False
      When the button is clicked, you flip it to True.
      You still paint during the paint event but now your painting code checks that variable and if it is True, it will draw the sprite.
      This makes it seem like it was drawn when you clicked the button but only the variable changed.
      Your painting is still during the paint event and your button shows and hides the sprite. (if you toggle the variable)

  • @glu_max
    @glu_max Před rokem

    Could the music be any louder? What omission, I still can hear your voice

  • @MicahFranco
    @MicahFranco Před rokem

    2:56 i dont see the drawing

  • @asifakhter5081
    @asifakhter5081 Před rokem +2

    its kinda stupid to have the music in bg when we really want to hear you

    • @DarrenG
      @DarrenG  Před rokem

      I'll keep that in mind. A lot of people suggested havnig music in my videos to fill dead space but you have a good point too. It's a tough balance. I may have made the music too loud or used bad music for this video also.

    • @Atezian
      @Atezian Před rokem

      Agreed