• Unity to achieve novice guide hollow effect


    This example for you to share the unity novice guide hollow effect of the specific code, for your reference, the specific content is as follows 1、 Realization idea Create a mesh with 8 vertices, and the inner and outer boundaries are quadrangles (rectangles). Only the mesh between the inner and outer edges is generated, and […]

  • C # design pattern


    Definition and classification of design patterns definition Design pattern: design pattern is a kind of summary of code design experience, and it is also a technology of documenting the solutions of design problems in software system. Using design patterns can reuse code, make it easier for others to understand and improve the reliability of code. […]

  • The same thread lock statement recursion of C # written test questions will not deadlock


    A few days ago, when I was wandering on the Internet, I came across a question and its answer According to the thread safety knowledge, this paper analyzes the following code, whether it will cause deadlock when I > 10 when calling the test method, and briefly explains the reasons. public void test(int i) { […]

  • Object oriented design principles


    design goal Design software with high maintainability and reusability. Maintainability refers to the difficulty of software being understood, modified, applicable and extended, while reusability refers to the difficulty of software being reused Classification of design principles Principle of single responsibility definition Single responsibility principle (SPR): it is better for a class to be responsible for […]

  • Unity shader for novice guide mask


    In the past two days, we have realized the mask and hollowed out shader effect that novices need to guide. Let’s record it. 1. Round hollow shader code:    //The distance between the world coordinates of the element and the center position of the target is calculated float dis = distance(IN.worldPosition.xy, _Center.xy); //The elements whose distance […]

  • Factories in design patterns


    Factories in design patterns Intro There are several factory patterns in design patterns. Let’s talk about the usage and examples of these factory patterns. Factory patterns include simple factory, abstract factory and factory method, which are all creative patterns,The so-called creation pattern means that these design patterns are used to create objects. Simple factory First […]

  • C # this keyword usage code detailed explanation


    Usage 1 is the original type extension method First of all, the type following this is to expand the type of method. Pay attention to the static method written in the static class, otherwise it will be accessed in some cases /// <summary> ///Extension classes are used to extend methods for the original class /// […]

  • Implementation of textbox place holder prompt in Windows Form


    In WinForm program, there are many ways to implement textbox text input box placeholder, the most common way is to send EM based on Windows API SendMessage function_ Setceebanner message, or through the focus event of textbox. Implementation of SendMessage function Create a zhmtextbox input box control that inherits textbox, add a placeholder property, and […]

  • Unity realizes the detection of double click and long press of mouse


    In unity, we will encounter many events about mouse. Although the relevant click and drag methods are given in unity, they are only applicable to UI and collider. So, how to directly use the code to realize the detection of double click and long press of mouse?First of all, we need several variables to save […]

  • csharp: use custom fonts in Emgu.CV


    // from String text = geovin Du; //A rectangular area is defined below int rectWidth = text.Length * (fontSize + 10); int rectHeight = fontSize + 10; //Draw detected area foreach (Rectangle face1 in faces) { //Declaration rectangle // Rectangle textArea = new Rectangle(face1.X + face1.Width, face1.Y, rectWidth, rectHeight); //grapPic.DrawString(text, font, whiteBrush, textArea); //image.Draw(textArea, […]

  • Image verification code of C # WinForm login interface (case sensitive + case insensitive)


    1、 Function interface Figure 1 captcha (case sensitive) Figure 2 captcha (case insensitive) 2、 Create a class Class1 that generates captcha (1) Generate random verification code string, using random function(2) Create a captcha image and draw the string in the PictureBox control Class1.cs: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Drawing […]

  • C# Convert.ToDouble Problems in different regions


    Use in different areas Convert.ToDouble Problems may arise. string str = “20.0”; double val = Convert.ToDouble(str); For example, in some regional languages, the result is 200 Thread.CurrentThread.CurrentCulture =new CultureInfo(“vi”); The correct way is to ignore the region and use overload string str = “20.0”; double val = Convert.ToDouble(str, CultureInfo.InvariantCulture); The result is the correct 20.0