Color’s Alpha value
Color can also set the Alpha value, which is the transparency. Such as Color.FromArgb(120,255,255,255). FromArgb has four parameters, the first one specifies the Alpha value.
The last three are color values RGB.
The alpha value range is 0~255, 0 means completely transparent, and 255 means opaque.
Look at an example of a semi-transparent brush:
using use using use using using through use through out ’s ’ s through out using off ‐ ‐ ‐‐‐‐‐ and
to be a semi-transparent brush.
Rectangle rect = new Rectangle(0, 0, 100 , 100); Path.AddRectangle(rect);径 // Create road drawing brush
PATHGRADIENTBRUSH BRUSH = New Pathgradientbrush (PATH);
// central point color
brush.centercolor = color.fromargb (120,255,255); ) The color on the upper u Brush.Surroundcolors = new Color[] { Color.FromArgb(120,0,0,0)};
If the color of the brush If the Alpha (transparent) value is not set, the displayed string cannot be seen.
Anti-aliasing
Eliminating the aliasing of lines is accomplished by setting the SmoothingMode attribute member in the Graphics class, which is an enumeration type.
Example statement to set anti-aliasing: e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
After eliminating aliasing, the lines look much smoother.
//Eliminate aliasing
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;using use use with using using through using ’ ’ s ’ through using ’s way through ’ through ‐ to ‐‐ ‐‐‐ , � ;
e.Graphics.DrawEllipse(pen, rect2) ;The SmoothingMode enumeration also has some other members, which can set different levels of anti-aliasing or not.
Text anti-aliasing
To anti-alias the displayed text, just set TextRenderingHint.
Sample code:
private void formPaint(Object sender, PaintEventArgs e)
ing("ABCDEFGHIJKL", new Font("宋体", 15f), brush, 0, 20);
new Font("宋体", 15f), brush, 0, 50);
}
area
It’s best to understand these functions, because C# can also call these APIs. And many of the concepts there are similar. For example, window handle, area handle.
For example, the GetHrgn function in the Region class can get the region handle.
Also let’s talk about the relationship between area and path, so that you can better understand what the area is. The relationship between area and path is like the relationship between filled graphics and graphics.
You can use paths and rectangles to create a area. Through the Region's constructor.
The following example creates two areas with rectangles and fills them. V Private void Formpaaint on2 = New Region (New Rectangle (50,50,100,100));
Graphics.Fillregion (brush1, region1);// Create a painting brush 2, and fill the area 2
solidbrush brush2 = new solidbrush (color.fromargb (125, 0, 255));E. Graphics. FillRegion (brush2 , region2);
}
In addition, two regions can also be merged. Merging regions has also been discussed in the 95th function CombineRgn. You can refer to that function.
CombineRgn The last parameter nCombineMode of the API function specifies how to merge two regions, so the merge in the Region class should also have a similar function.
Indicate how to merge, but the Region class is not specified with parameters. Region directly calls different functions.
For example, the Region.Intersect function is RGN_AND, and Region.Union is the RGN_OR method of merging. . region1.Exclude is RGN_DIFF,
Region. ;>>>>>>>>>>>>>>>>>From API CombineRgn function>>>>>> ;>>>>>>>>>>>>>>>>>>>>>>>>> ;>>>>>>>>>>>>>>>>>>>
RGN_AND The overlapping portion of the two regions
RGN_OR Combine two regions
RGN_DIFF The non-overlapping part of hSrcRgn1
RGN_XOR The non-overlapping part of hSrcRgn1 and hSrcRgn2
There is also a function Complement in the Region class. The area obtained by merging with this function is the non-overlapping part of area 2.
Look at the example:
private void formPaint(Object sender, PaintEventArgs e)
0,0,100,100));
Region region2 = New Region (New Rectangle (50,50,100,100));
// Use the XOR function merging area to obtain the unpacking parts of the two areas.
region1.
}
Settings window Display area:
Just specify the Region attribute member in the Form class, for example, display a circular window:
InitializeComponent(); // Create a circular path
GraphicsPath path = new GraphicsPath ( );this.Region = region;
Region.IsVisible determines whether a point (or rectangle) is within the region.
Look at the example. In the example, a circular area is created. As soon as the mouse enters the circular area, the area will display red. P PARIC PARTIAL CLASS FORM1: Form
{
// Public Solidbrush Norbrush = New Solidbrush (COLOR.GREEN); c solidBrush Hovbrush = New solidbrush (color.red);
// indicate whether the mouse is in the region
public Bool Hovflag = False; ecomponent ();
// Create a circular path
GraphicsPath path = new using using using using using using using ‐ through through through off ‐ through ’ ‐ ‐ ‐‐ ‐‐ ‐ ‐ ‐ ‐ ‐ ‐ ‐ ‐ ‐ ‐ to new Region(path);
件 // Add event processing
This.paint+= Formpaaint;
// Mouse Mobile Event
This.Mousemove+= Frommousemove;
}}
targs e)
{
if (hovflag)
{
e.Graphics.FillRegion(hovBrush, region); . gion(norBrush, region);
gion; , MouseEventArgs e)
Graphics Graphics . hovFlag != true)
hovFlag . FillRegion (HOVBRUSH, Region);
}
// The mouse leaves the area
else if (region.isvisible (e.x, e.y)! = True && Hovflag) {
hovflag = false;
.FillRegion (norbrush, region) ;

The char array stores character sequences in C language and is declared as char array_name[size]. The access element is passed through the subscript operator, and the element ends with the null terminator '\0', which represents the end point of the string. The C language provides a variety of string manipulation functions, such as strlen(), strcpy(), strcat() and strcmp().

In C, the char type is used in strings: 1. Store a single character; 2. Use an array to represent a string and end with a null terminator; 3. Operate through a string operation function; 4. Read or output a string from the keyboard.

In C language, special characters are processed through escape sequences, such as: \n represents line breaks. \t means tab character. Use escape sequences or character constants to represent special characters, such as char c = '\n'. Note that the backslash needs to be escaped twice. Different platforms and compilers may have different escape sequences, please consult the documentation.

The usage methods of symbols in C language cover arithmetic, assignment, conditions, logic, bit operators, etc. Arithmetic operators are used for basic mathematical operations, assignment operators are used for assignment and addition, subtraction, multiplication and division assignment, condition operators are used for different operations according to conditions, logical operators are used for logical operations, bit operators are used for bit-level operations, and special constants are used to represent null pointers, end-of-file markers, and non-numeric values.

The difference between multithreading and asynchronous is that multithreading executes multiple threads at the same time, while asynchronously performs operations without blocking the current thread. Multithreading is used for compute-intensive tasks, while asynchronously is used for user interaction. The advantage of multi-threading is to improve computing performance, while the advantage of asynchronous is to not block UI threads. Choosing multithreading or asynchronous depends on the nature of the task: Computation-intensive tasks use multithreading, tasks that interact with external resources and need to keep UI responsiveness use asynchronous.

In C language, char type conversion can be directly converted to another type by: casting: using casting characters. Automatic type conversion: When one type of data can accommodate another type of value, the compiler automatically converts it.

There is no built-in sum function in C language, so it needs to be written by yourself. Sum can be achieved by traversing the array and accumulating elements: Loop version: Sum is calculated using for loop and array length. Pointer version: Use pointers to point to array elements, and efficient summing is achieved through self-increment pointers. Dynamically allocate array version: Dynamically allocate arrays and manage memory yourself, ensuring that allocated memory is freed to prevent memory leaks.

A strategy to avoid errors caused by default in C switch statements: use enums instead of constants, limiting the value of the case statement to a valid member of the enum. Use fallthrough in the last case statement to let the program continue to execute the following code. For switch statements without fallthrough, always add a default statement for error handling or provide default behavior.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool