How to install PNG as a MAP?

I am programming in WPF. My goal is to create TRPG (Text-RPG), so a map is definitely necessary.

I have a PNG image that can be divided into 5 ร— 5.

I want to separate this PNG, add the code to these small squares, for example, the image code in the lower left corner (0, 0). (I will add features to make sure that I can travel this MAP later.)

Now I want to find out how can I separate PNG?

Then add it to my code? Create a new .cs? EDMX-?

+4
source share
2 answers

I would recommend taking a step back and briefly identifying exactly how you plan to represent the geographic area in your application.

If you plan to have an NxM grid to display the geographic area of โ€‹โ€‹the โ€œmapโ€ in your application, you may need to instead just draw a โ€œimageโ€ of the map in the background of your window. You can then overlay transparent controls on top of the actual map (for example, labels for individual grid cells).

Fortunately, WPF provides a very convenient layout engine for you, Grid.

See http://wpftutorial.net/GridLayout.html .

0
source

You can create a dynamic array of bitmap images. and define all the bitmaps and just start the foreach loop to draw them.

Bitmap[] bitmapArray = new Bitmap[width * height]; //the size of your map for(int i = 0; i <= bitmapArray.Length - 1; i++) { //Define the bitmaps here } foreach(Bitmap b in bitmapArray) { //Drawing Code } 
0
source

Source: https://habr.com/ru/post/1486445/


All Articles