Skip to content

mooict/WPF-Add-or-Remove-objects-dynamically-from-Canvas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WPF C# Tutorial – Add and Remove Objects with Mouse Click in Visual Studio

Hi welcome to another fun tutorial from moo ict. in this tutorial I will show you how to add and remove rectangles dynamically from a canvas using wpf and c#. We will be using lots of rectangles to make fun games very soon so its important to understand the attributes of them inside of the canvas element. we will be linking a mouse event directly to the canvas then use c# to find if we have clicked on a empty spot inside of the canvas or have we clicked on a existing rectangle. if we clicked on a rectangle then we will remove it and if not we will spawn a rectangle on the canvas with few extra bonus such as giving it a random colour and a border.

this was a fun tutorial to make and again this is a quick tutorial that you can use just to the hang of it before we move into making games.

Hope you enjoy it and happy programming.

Video Tutorial -

Written Tutorial -

https://www.mooict.com/wpf-c-tutorial-add-and-remove-objects-with-mouse-click-in-visual-studio/

About

In this project I will demonstrate how to add or remove items from the Canvas dynamically using C# and WPF

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages