Tag Archives: c#

Compiler error message: cs1056: unexpected character handling

Error generation:
always returns an error when compiling a pre-existing program code using VS2015. strange In some added to the end of the class file some [] [] [] [], prompt Unexpected character, ‘application error.

A compilation error as shown in the title was caused by a special full-corner character in C# code. > special full-corner characters are not displayed and saved in UTF-8 format, and the compiler cannot correctly recognize such characters, resulting in compilation errors.

set the file open mode of VS 2015, make it contains a file with the Angle of all special characters use utf-8 format to open.
1) In Solution Explorer, select the file that needs special opening. 2) Right-click the mouse button to pop up the menu, select “Open Mode”, and use “Charp Editor with Encoding” to open.

Reproduced in: https://blog.51cto.com/studybao/2048899

Three methods of referencing DLL in Visual Studio 2015

Copy the DLL file to the directory where the executable is located
2. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Change the working directory to the directory where the DLL files reside
3. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Set the environment to the Path= DLL directory, for example: Path=$(SolutionDir)bin

Reproduced in: https://www.cnblogs.com/buyishi/p/10236780.html

Prompt “failed to load file or assembly” when VTK uses renderwindowcontrol

Possible reasons:

The Activiz.net library downloaded on the CPU version does not match the local CPU version


download Activiz.net source code compilation of anyCPU version of the library.

Activiz.net source: https://github.com/bitzhuwei/Kitware.VTK.git


2, select Kitware project right click modify project properties – “build -” target platform anyCPU compilation


OpenGL learning notes and other learning thinking

Recently, I have not written a blog for many days, which is a very bad habit. If you don’t summarize what you learn every day, you basically forget it all. So keep blogging.
Review of C# programming basics
Three key words:

    new: (1) : Create object. To carve out a space in the heap (the object is a reference type, so it carve out space in the heap), to create an object in the carve out space, and to call the class’s no-argument constructor

(2) : completely hide the parent class method of the same name means to inherit the child class and the parent class method of the same name, need to completely hide the parent class method of the use
2. This: (1) : Refers to the object of the current class, especially when used in constructors. That’s what this means
(2) : inherit its own constructor (usually inherit the most complete constructor)
3. Base: (1) : When a constructor from a parent class is used for inheritance
Interface design: (1) : the menu bar has data resources, satellite resources, service resources, plug-in resources, thematic space, global target, resource search
(2) : open, image mode, map mode, chart mode, 3D terrain, place name management, basic data setting, automatic hiding, full screen, help, login, exit
(3) : tool set includes: area measurement tool, text information lead and organization association, manual correction, image data management in application, distance measurement tool, spatial viewable area analysis, global basic image download
(4) : Title bar WPF, global target, display boundary line, landing, meteorological and hydrological data display, new sky empty box.
What is not clear: which space is used for the full screen display (that is, the toolbar is hidden and the top logo bar is removed) and the toolset?Decreases the transparency of the control if the implementation mouse is not over it.
OpenGL: Let’s look at functions first. Learning OpenGL for so long, the feeling is to know the OpenGL rendering process and all kinds of small details, and then is to learn all kinds of functions
1: Readback data from the cache object: GlGetBufferSubData
2. Direct access to data in cache: Glenum Target, Glenum Access
GlumMapBuffer () = glumMapBuffer ()
More accurate access mode: GlmapBufferRange (Glenum Target, GlintPtr Offset, GlSizeiPtr Length, GlBitField Access);
5: abandon part or data in the cache object: glinvalidateBufferData glinvalidateBufferSubData () ()
Style (GLuint index,GLint size,GLenum type, GLboolean normalized, GLsizei stide, const GLvoid*pointer); The initialized property pointer index is passed to this function.
Integer vertex property: glVertexAttribiPointer () does not perform an automatic conversion to a floating point number
Double vertex attribute: glVertexAttriblPointer () whose type must be DOUBLE
9: Compressed format of vertex attributes: ????????
The vertex properties of each property can be set using the GlvertexAttrib *() series of parameters
11: OpenGL drawing command: includes two parts
1: GlDrawElements (GLenum mode,GLsizei count, GLenum type,Const GLvoid* indices) uses count elements to define a set of geometric primitives. The element’s index value is stored in a cache bound up to GL_ELEMENT_ARRAY_BUFFER. Indices defines the offset address in the element array cache. This function reads information about vertices from the currently enabled array of vertex properties and uses them to build the primitive type specified by mode. The index data from the element array cache is used to index each vertex attribute array 2: non-indexed form: basic drawing command: glDraWarRays () directly selects and uses the vertex attributes in their own order in the cached object.

Reproduced in: https://www.cnblogs.com/Audient/p/7643832.html

When IntelliJ idea is programmed, 1. Black thick line or black cursor appears; 2. The solution of carriage return unable to wrap. (practical recommendation method 2)

Intellij idea programming 1. Black thick lines or black cursor 2. A solution that cannot wrap a line by carriage return. (Practical Recommendation Method 2)

reason: it is usually caused by accidentally pressing insert. Some computers abbreviate insert, putting Del and Ins together, and Ins is the insert key.
Method 1. Click Intellij Idea on the upper left corner of the main interface, File> Settings> The diagram below * * * *
Put him on the Use block caret, and you can get back to your old self. ***

Method 2 (recommended) : Press and hold the Fn+ INSERT key to restore directly.
note: do not press Fn+insert if Use block caret is checked, otherwise the enter key will fail to wrap.
PS: restore the enter enter key newline function solution:
cancel Use block caret in the check box (default is no check, no change can be ignored), and then hold down Fn+insert key, so that the cursor and return will return to the original.


The compression ratio is very high, with a 32-bit core of 64 bits

if (Environment.Is64BitProcess)

Reference: https://www.cnblogs.com/gdouzz/p/7090710.html

C ා imitate on error resume next in VB

C# mimics VB’s On Error Resume next
and adds a try catch. The exception is not handled in catch
the for (int I = 0; i < 10; I++)
int p = 0;
int d = I/p;// is zero, will go wrong

} catch

attach MessageBox. Show (i.T oString ());// here say, will cycle through ten times

the catch (Exception ex)
MessageBox. Show (ex. Message); // because the error divided by zero is caught by the inner try catch, the outer try catch will not catch the error divided by zero

C ා use math.net Read. Mat file, file content is complex

0. The project needs to read the complex file (.mat) generated by matlab simulation through C#, and then process it. The contents of the file are shown in the figure below:

1. Add DLL file: find Mathnet by NuGet manager, search mathnet.Numerics as shown in the figure below, install Mathnet.numerics;

2. Add references:

3. The following method can be used to read complex data.

HALCON error #2036: could not find license file in operator set_ Part solution

HALCON error #2036: could not find license file in operator set_part
operator set_part
copy the license folder into the root directory of exe, then you can run the program normally

change the license_xxx.dat to license.dat and put it in the root directory of the running program to solve the license_xxx.dat. Please note that the license_xxx.dat must be valid and have no expired certificates