In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to write the commands about drawing mode and zoom function in C#. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
In the solid modeling software, there is often the function of setting and saving all kinds of reference coordinate system to facilitate the establishment of the model. There is a similar function in C# drawing. But not as powerful as modeling software. In the solid modeling software, various coordinate systems can be set and saved independently, and can be called at any time. Here, it can only be called in a nested form, and when you return to the previous state, the skipped state is no longer saved.
C # drawing normal mode main commands:
State = graphics.BeginContainer () Create a new drawing state e.Graphics.EndContainer (state1); end the drawing state Rectangle rect = new Rectangle (0,05,100,100); / / sample drawing GraphicsContainer state1 = e.Graphics.BeginContainer (); / / create a new drawing coordinate state1 e.Graphics.TranslateTransform (100dint 100); / / move the coordinate system to 100jue 100, draw the blue rectangle mark e.Graphics.DrawRectangle (Pens.Blue, rect) GraphicsContainer state2 = e.Graphics.BeginContainer (); / / create a drawing coordinate state2 e.Graphics.RotateTransform (45) on this basis; / / rotate 45 degrees, draw red rectangular marks e.Graphics.DrawRectangle (Pens.Red, rect); e.Graphics.TranslateTransform (100,100); e.Graphics.DrawRectangle (Pens.Black, rect); e.Graphics.EndContainer (state2); / / exit coordinate system 2, draw blue ellipse e.Graphics.DrawEllipse (Pens.Blue, rect) E.Graphics.EndContainer (state1); / / quit state1 and draw a red ellipse e.Graphics.DrawRectangle (Pens.Red, rect)
Establish status 1
Move to 100pi 100 and draw a blue rectangle
Build nested state 2
Move to 200001 0 and draw a red rectangle
Exit status 2, draw a blue ellipse
Exit status 1, draw a red rectangle
State 2 is nested. If you directly exit state 1 and draw a red rectangle, state 2 is no longer saved.
Graphics.BeginContainer () and EndGontainer save and return the current artboard state. Of course, moving is just a way to change the artboard state.
Main commands of C# drawing and zooming function:
GraphicsContainercontainerState= e.Graphics.BeginContainer (destRect,srcRect, GraphicsUnit.Pixel); add two more parameters, destRect and scrRect set the zoom size Pixel specified units RectanglesrcRect=newRectangle (0Power0200200); RectangledestRect=newRectangle (200200100100); / / build a scaled drawing board. GraphicsContainercontainerState= e.Graphics.BeginContainer (destRect,srcRect, GraphicsUnit.Pixel); / / draw a zoom green rectangle. E.Graphics.FillRectangle (newSolidBrush (Color.Red), 0JI 0100100); / / exit this tablet. E.Graphics.EndContainer (containerState); / / draw the original red rectangle. E.Graphics.FillRectangle (newSolidBrush (Color.Green), 0Power0100100); on the "drawing mode and zoom function commands in C# how to write" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
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: 291
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.