Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7677817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:30:31+00:00 2026-05-31T17:30:31+00:00

I have to do application for tilling in C#. The tiles will have some

  • 0

I have to do application for tilling in C#. The tiles will have some shape and my app should be able to modify the shape. I will have a some shape – polygon, made from vertices. I will have for example field of 16 vertices, then I draw the polygon.
What I need to know how can I move with the the vertice using drag and drop. I will also have to recount other vertices in order to fit one tile to next tile, but it’s just some math.

To conclude:
I have polygon defined 16 vertices in field of Vertices, I move (with mouse) with one vertice, recount the coordinates of ohter vertices and draw new polygon. My problem is moving (probably using drag & drop) with one vertice from filed of vertices.

This is what part of my previous code without drag & drop – just for idea what tools I’m using for drawing one tile:

 private Bitmap canvasBitmap; //canvas for drawing
 private Graphics g; // enter to graphics tool  

            Bitmap b = (Bitmap)Bitmap.FromFile("obr.bmp");
            TextureBrush brush = new TextureBrush(b);
            Pen pen = new Pen(Color.Black, 1);

            hexaVertices[0] = new PointF(-40 + 40, 0 + 30);
            hexaVertices[1] = new PointF(-20 + 40, 30 + 30);
            hexaVertices[2] = new PointF(20 + 40, 30 + 30);
            hexaVertices[3] = new PointF(40 + 40, 0 + 30);
            hexaVertices[4] = new PointF(20 + 40, -30 + 30);
            hexaVertices[5] = new PointF(-20 + 40, -30 + 30);

 g.FillPolygon(brush, hexaVertices);
 g.DrawPolygon(pen, hexaVertices);

Thx for advices.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:30:33+00:00Added an answer on May 31, 2026 at 5:30 pm

    I can only give you a rough outline for Windows Forms here. In WPF you could use Adorners and there are tutorials out there for how to do it. Here we go for a manual process in Windows Forms:

    First, the array of vertices should be a member variable of the class and should be initialized only once at the start of the program.

    Then, draw the polygon with the current set of vertices as you’re doing right now. Also, draw some “handles” if you want, so you know that the vertices can be grabbed (this could be rectangles around the actual PointF).

    Now for the magic 🙂 Assign the MouseDown, MouseMove and MouseUp events to the control you’re using for displaying the image. Also, create a new member variable bool m_draggingVertex and another that contains the index to the vertex array of the vertex you’re currently dragging.

    In MouseDown:
    Check whether the current mouse position is within the range of a vertext (I would assume a 5×5 rectangle around a vertex, so that is is easier to hit with the cursor). If you pressed the button on a vertex, set m_draggingVertex to true and store the index of the vertex in the other variable.

    In MouseMove:
    If m_draggingVertex is true, change the vertext at the index stored above to the new coordinates, recalc your positions and repaint so that the current position of the vertex is shown.

    In MouseUp:
    If m_draggingVertex is true, set it to false and do final work.

    This is how I’d do it …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an WPF application for 60 users tops. Some of they are cashier
I have an application that's instantiates an object from a class called SecretNumber when
I have a Java web application which stores some data in the session. The
I have a C# application, and I need to dump some output to a
I have application which needs to use a dll (also written by me) which
I have application that makes different queries with different results so the caching in
I have Application settings stored under HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany branch. Settings must be same for different
I have Application written with GWT 1.7. I have one page where I upload
I have application that is connecting to the DB and if I enter incorrect
I have application that is up more than 3 days. I can see in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.