Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw a picture in the form of Nine Palace Grid with C#

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use C#to draw pictures in the form of Jiugong grid, which has certain reference value. Interested friends can refer to it. I hope you will have a lot of gains after reading this article. Let Xiaobian take you to understand it together.

Method 1: Draw a straight line on the picture

  The simplest and crudest way to think of is to draw the nine-square grid line directly on the picture. It looks like it has been cut into nine pieces. In fact, it is still a complete picture. The main code and effect are as follows:

m_startX = pnlCanvas.Width / 6; m_startY = pnlCanvas.Height / 6; m_imageWidth = pnlCanvas.Width - m_startX * 2; m_imageHeight = pnlCanvas.Height - m_startY * 2; e.Graphics.DrawImage(m_image, m_startX, m_startY, m_imageWidth, m_imageHeight); using (Pen p = new Pen(Brushes.White,m_lineWidth)) { int stepX = m_imageWidth / 3; int stepY = m_imageHeight / 3; for(int i=1;i

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report