包含vb.nettuple的词条

如何让halcon程序应用在vs中显示

开始做Halcon的上位机,选用VisualStudio10.0平台。C#第一步:VisualStudio10.0设置引用HalconDotNet.dll01.新建项目02.选择VisualC#03.修改文件名04.确认第二步VisualStudio10.0设置引用HalconDotNet.dll01.选择“解决方案资源管理器”02.选择“引用”,右键03.选择“添加引用”第三步VisualStudio10.0设置引用HalconDotNet.dll01.在添加引用选项卡选择浏览02.选择路径:X:\ProgramFiles\MVTec\HALCON-10.0\bin\dotnet2003.选择“HalconDotNet.dll”04.确认第四步VisualStudio10.0设置引用HalconDotNet.dll01.选择“工具箱”02.选择“所有工具”或任意工具控件,右键03.选择“选择项”第五步VisualStudio10.0设置引用HalconDotNet.dll选择Halcon图像控件VisualStudio10.0设置引用HalconDotNet.dll还有VB的设置,如下图:VisualStudio10.0设置引用HalconDotNet.dll01.选择项目名称02.点击显示全部文件,取消隐藏,就可以看到引用03.引用,邮件04.添加,之后的步骤和C#一样VisualStudio10.0设置引用HalconDotNet.dll选择工具控件,步骤和C#基本一样。VB的第二张图,步骤如下01.选择“工具箱”02.选择“所有工具”或任意工具控件,右键03.选择“选择项”04.在“.netframwork组件”的选项卡中,选择浏览05.出来的对话框中,选择X:\ProgramFiles\MVTec\HALCON-10.0\bin\dotnet2006.选择“HalconDotNet.dll”07.确认08.这时候的工具栏的控件是HWinwow控件。kamuixiao:X:\ProgramFiles\MVTec\HALCON-10.0\bin\dotnet20路径下的无法使用,在.netframework组件无法找到X:\ProgramFiles\MVTec\HALCON-10.0\bin\dotnet35路径下的可用,在.netframework组件下可以找到,并且在工具箱上能够找到并使用,但是功能无法实现,如下图我不作其他动作,程序代码内容仅是运行时候读取一张图片,在调试的时候能够运行,但读不到图片……楼主在VB.NET环境下正常运行了吗?求解~VisualStudio10.0设置引用HalconDotNet.dllx8515618:定义错了dimm_hWindowAsHtuple'这是一个句柄,不是窗体控件x8515618:Dimm_hWindowAsHtuple=Nothingkamuixiao:谢谢楼上的建议,但是我试了下发现仍然不行,我觉得问题不是出在这里,不知道使用VB.NET的各位有没有遇到过,反正我是没能正常实现过一次的,输出显示的错误情况如图:VisualStudio10.0设置引用HalconDotNet.dllx8515618:你只是读取了图片,都没有显示图片呢灵峤lencue:你最开始新建项目的时候选择的“.net框架”版本是多少的?.net2.0就用dotnet20文件夹,3.5就用dontnet35文件夹,你再查看一下,会不会是这个问题,看能不能解决。irun999:请问楼主,用在VS2008中用C#读入一直比较大的图片的时候只是显示部分图片,如何解决?灵峤lencue:dev_resize_window_fit_image(ho_Image,0,0,300,400);用这个算子,在C#的program.cs中可以用的,后面的300,400就是显示这个图片的大小的,会被缩放到这个比例。irun999:请问在VS2005C#处理视频,程序老是死掉,怎么?视频无法实时显示。是不是视频太大了,VS2005处理不够来?该怎么?灵峤lencue:采用C#的多线程,具体怎么使用,我还在学习中,要是有进展,再一起讨论。好吧,我写漏了,但事实上我把显示补上,然后按照兄台所说修改定义后仍然没能成功!~附图:VisualStudio10.0设置引用HalconDotNet.dllirun999:今天下午发现视频无法显示是因为hdevelop导出程序的死循环函数里没有HOperatorSet.DispObj显示函数。但是关闭程序就会出现vshost.exe无响应。这个问题可能得多线程解决了。

我们提供的服务有:成都做网站、成都网站制作、成都外贸网站建设、微信公众号开发、网站优化、网站认证、忻城ssl等。为上1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的忻城网站制作公司

c#中,A.tuplestring("10.3f")是啥意思?还有哪些其他参数

tuplestring应该不是.net库的方法,而是某个第三方实现,如果你要知道它还有哪些参数的话,可以在Visual Studio中在tuplestring上按F12,查看它的签名,以及是否有多个重载。

"10.3f"是以前C语言格式字符串的一种,表示输出符点型结果,共10位,其中小数点后输出3位。

Mark!20 个 .NET 6 新增的 API

.NET 6 引入了两种期待已久的类型 - DateOnly 和 TimeOnly, 它们分别代表 DateTime 的日期和时间部分。

DateOnly dateOnly = new ( 2021 , 9 , 25 );

Console . WriteLine ( dateOnly );

TimeOnly timeOnly = new ( 19 , 0 , 0 );

Console . WriteLine ( timeOnly );

DateOnly dateOnlyFromDate = DateOnly . FromDateTime ( DateTime . Now );

Console . WriteLine ( dateOnlyFromDate );

TimeOnly timeOnlyFromDate = TimeOnly . FromDateTime ( DateTime . Now );

Console . WriteLine ( timeOnlyFromDate );

它可以控制多个异步任务的并行度。

var userHandlers = new []

{

"users/okyrylchuk" ,

"users/jaredpar" ,

"users/davidfowl"

};

using HttpClient client = new ()

{

BaseAddress = new Uri ( "" ),

};

client . DefaultRequestHeaders . UserAgent . Add ( new ProductInfoHeaderValue ( "DotNet" , "6" ));

ParallelOptions options = new ()

{

MaxDegreeOfParallelism = 3

};

await Parallel . ForEachAsync ( userHandlers , options , async ( uri , token ) =

{

var user = await client . GetFromJsonAsync GitHubUser ( uri , token );

Console . WriteLine ( $ "Name: {user.Name} Bio: {user.Bio} " );

});

public class GitHubUser

{

public string Name { get ; set ; }

public string Bio { get ; set ; }

}

// Output:

// Name: David Fowler

// Bio: Partner Software Architect at Microsoft on the ASP.NET team, Creator of SignalR

//

// Name: Oleg Kyrylchuk

// Bio: Software developer | Dotnet | C# | Azure

//

// Name: Jared Parsons

// Bio: Developer on the C# compiler

ArgumentNullException 的小改进, 在抛出异常之前不需要在每个方法中检查 null, 现在只需要写一行, 和 response.EnsureSuccessStatusCode(); 类似。

ExampleMethod ( null );

void ExampleMethod ( object param )

{

ArgumentNullException . ThrowIfNull ( param );

// Do something

}

.NET 6 新增的数据结构, PriorityQueue, 队列每个元素都有一个关联的优先级,它决定了出队顺序, 编号小的元素优先出列。

PriorityQueue string , int priorityQueue = new ();

priorityQueue . Enqueue ( "Second" , 2 );

priorityQueue . Enqueue ( "Fourth" , 4 );

priorityQueue . Enqueue ( "Third 1" , 3 );

priorityQueue . Enqueue ( "Third 2" , 3 );

priorityQueue . Enqueue ( "First" , 1 );

while ( priorityQueue . Count 0 )

{

string item = priorityQueue . Dequeue ();

Console . WriteLine ( item );

}

// Output:

// First

// Second

// Third 2

// Third 1

// Fourth

提供基于偏移量的 API,用于以线程安全的方式读取和写入文件。

using SafeFileHandle handle = File . OpenHandle ( "file.txt" , access : FileAccess . ReadWrite );

// Write to file

byte [] strBytes = Encoding . UTF8 . GetBytes ( "Hello world" );

ReadOnlyMemory buffer1 = new ( strBytes );

await RandomAccess . WriteAsync ( handle , buffer1 , 0 );

// Get file length

long length = RandomAccess . GetLength ( handle );

// Read from file

Memory buffer2 = new ( new byte [ length ]);

await RandomAccess . ReadAsync ( handle , buffer2 , 0 );

string content = Encoding . UTF8 . GetString ( buffer2 . ToArray ());

Console . WriteLine ( content ); // Hello world

认识一个完全异步的“PeriodicTimer”, 更适合在异步场景中使用, 它有一个方法 WaitForNextTickAsync 。

// One constructor: public PeriodicTimer(TimeSpan period)

using PeriodicTimer timer = new ( TimeSpan . FromSeconds ( 1 ));

while ( await timer . WaitForNextTickAsync ())

{

Console . WriteLine ( DateTime . UtcNow );

}

// Output:

// 13 - Oct - 21 19:58:05 PM

// 13 - Oct - 21 19:58:06 PM

// 13 - Oct - 21 19:58:07 PM

// 13 - Oct - 21 19:58:08 PM

// 13 - Oct - 21 19:58:09 PM

// 13 - Oct - 21 19:58:10 PM

// 13 - Oct - 21 19:58:11 PM

// 13 - Oct - 21 19:58:12 PM

// ...

.NET 6 实现了 OpenTelemetry Metrics API 规范, 内置了指标API, 通过 Meter 类创建下面的指标

•Counter

•Histogram

•ObservableCounter

•ObservableGauge

使用的方法如下:

var builder = WebApplication . CreateBuilder ( args );

var app = builder . Build ();

// Create Meter

var meter = new Meter ( "MetricsApp" , "v1.0" );

// Create counter

Counter counter = meter . CreateCounter ( "Requests" );

app . Use (( context , next ) =

{

// Record the value of measurement

counter . Add ( 1 );

return next ( context );

});

app . MapGet ( "/" , () = "Hello World" );

StartMeterListener ();

app . Run ();

// Create and start Meter Listener

void StartMeterListener ()

{

var listener = new MeterListener ();

listener . InstrumentPublished = ( instrument , meterListener ) =

{

if ( instrument . Name == "Requests" instrument . Meter . Name == "MetricsApp" )

{

// Start listening to a specific measurement recording

meterListener . EnableMeasurementEvents ( instrument , null );

}

};

listener . SetMeasurementEventCallback (( instrument , measurement , tags , state ) =

{

Console . WriteLine ( $ "Instrument {instrument.Name} has recorded the measurement: {measurement}" );

});

listener . Start ();

}

它提供来自反射成员的可空性信息和上下文:

•ParameterInfo 参数

•FieldInfo 字段

•PropertyInfo 属性

•EventInfo 事件

var example = new Example ();

var nullabilityInfoContext = new NullabilityInfoContext ();

foreach ( var propertyInfo in example . GetType (). GetProperties ())

{

var nullabilityInfo = nullabilityInfoContext . Create ( propertyInfo );

Console . WriteLine ( $ "{propertyInfo.Name} property is {nullabilityInfo.WriteState}" );

}

// Output:

// Name property is Nullable

// Value property is NotNull

class Example

{

public string ? Name { get ; set ; }

public string Value { get ; set ; }

}

它允许您获取嵌套元素的可为空的信息, 您可以指定数组属性必须为非空,但元素可以为空,反之亦然。

Type exampleType = typeof ( Example );

PropertyInfo notNullableArrayPI = exampleType . GetProperty ( nameof ( Example . NotNullableArray ));

PropertyInfo nullableArrayPI = exampleType . GetProperty ( nameof ( Example . NullableArray ));

NullabilityInfoContext nullabilityInfoContext = new ();

NullabilityInfo notNullableArrayNI = nullabilityInfoContext . Create ( notNullableArrayPI );

Console . WriteLine ( notNullableArrayNI . ReadState ); // NotNull

Console . WriteLine ( notNullableArrayNI . ElementType . ReadState ); // Nullable

NullabilityInfo nullableArrayNI = nullabilityInfoContext . Create ( nullableArrayPI );

Console . WriteLine ( nullableArrayNI . ReadState ); // Nullable

Console . WriteLine ( nullableArrayNI . ElementType . ReadState ); // Nullable

class Example

{

public string ?[] NotNullableArray { get ; set ; }

public string ?[]? NullableArray { get ; set ; }

}

直接通过 Environment 获取进程ID和路径。

int processId = Environment . ProcessId

string path = Environment . ProcessPath ;

Console . WriteLine ( processId );

Console . WriteLine ( path );

和 DI 的 GetRequiredService() 是一样的, 如果缺失, 则会抛出异常。

WebApplicationBuilder builder = WebApplication . CreateBuilder ( args );

WebApplication app = builder . Build ();

MySettings mySettings = new ();

// Throws InvalidOperationException if a required section of configuration is missing

app . Configuration . GetRequiredSection ( "MySettings" ). Bind ( mySettings );

app . Run ();

class MySettings

{

public string ? SettingValue { get ; set ; }

}

您可以从密码安全伪随机数生成器 (CSPNG) 轻松生成随机值序列。

它对于以下场景中很有用:

•密钥生成

•随机数

•某些签名方案

// Fills an array of 300 bytes with a cryptographically strong random sequence of values.

// GetBytes(byte[] data);

// GetBytes(byte[] data, int offset, int count)

// GetBytes(int count)

// GetBytes(Span data)

byte [] bytes = RandomNumberGenerator . GetBytes ( 300 );

.NET 6 引入了一个新的 API 来分配本机内存, NativeMemory 有分配和释放内存的方法。

unsafe

{

byte * buffer = ( byte *) NativeMemory . Alloc ( 100 );

NativeMemory . Free ( buffer );

/* This class contains methods that are mainly used to manage native memory.

public static class NativeMemory

{

public unsafe static void * AlignedAlloc ( nuint byteCount , nuint alignment );

public unsafe static void AlignedFree ( void * ptr );

public unsafe static void * AlignedRealloc ( void * ptr , nuint byteCount , nuint alignment );

public unsafe static void * Alloc ( nuint byteCount );

public unsafe static void * Alloc ( nuint elementCount , nuint elementSize );

public unsafe static void * AllocZeroed ( nuint byteCount );

public unsafe static void * AllocZeroed ( nuint elementCount , nuint elementSize );

public unsafe static void Free ( void * ptr );

public unsafe static void * Realloc ( void * ptr , nuint byteCount );

}*/

}

.NET 6 引入了用于处理 2 的幂的新方法。

•'IsPow2' 判断指定值是否为 2 的幂。

•'RoundUpToPowerOf2' 将指定值四舍五入到 2 的幂。

// IsPow2 evaluates whether the specified Int32 value is a power of two.

Console . WriteLine ( BitOperations . IsPow2 ( 128 )); // True

// RoundUpToPowerOf2 rounds the specified T:System.UInt32 value up to a power of two.

Console . WriteLine ( BitOperations . RoundUpToPowerOf2 ( 200 )); // 256

您可以更轻松地等待异步任务执行, 如果超时会抛出 “TimeoutException”

Task operationTask = DoSomethingLongAsync ();

await operationTask . WaitAsync ( TimeSpan . FromSeconds ( 5 ));

async Task DoSomethingLongAsync ()

{

Console . WriteLine ( "DoSomethingLongAsync started." );

await Task . Delay ( TimeSpan . FromSeconds ( 10 ));

Console . WriteLine ( "DoSomethingLongAsync ended." );

}

// Output:

// DoSomethingLongAsync started.

// Unhandled exception.System.TimeoutException: The operation has timed out.

新方法:

•SinCos

•ReciprocalEstimate

•ReciprocalSqrtEstimate

新的重载:

•Min, Max, Abs, Sign, Clamp 支持 nint 和 nuint

•DivRem 返回一个元组, 包括商和余数。

// New methods SinCos, ReciprocalEstimate and ReciprocalSqrtEstimate

// Simultaneously computes Sin and Cos

( double sin , double cos ) = Math . SinCos ( 1.57 );

Console . WriteLine ( $ "Sin = {sin} Cos = {cos}" );

// Computes an approximate of 1 / x

double recEst = Math . ReciprocalEstimate ( 5 );

Console . WriteLine ( $ "Reciprocal estimate = {recEst}" );

// Computes an approximate of 1 / Sqrt(x)

double recSqrtEst = Math . ReciprocalSqrtEstimate ( 5 );

Console . WriteLine ( $ "Reciprocal sqrt estimate = {recSqrtEst}" );

// New overloads

// Min, Max, Abs, Clamp and Sign supports nint and nuint

( nint a , nint b ) = ( 5 , 10 );

nint min = Math . Min ( a , b );

nint max = Math . Max ( a , b );

nint abs = Math . Abs ( a );

nint clamp = Math . Clamp ( abs , min , max );

nint sign = Math . Sign ( a );

Console . WriteLine ( $ "Min = {min} Max = {max} Abs = {abs}" );

Console . WriteLine ( $ "Clamp = {clamp} Sign = {sign}" );

// DivRem variants return a tuple

( int quotient , int remainder ) = Math . DivRem ( 2 , 7 );

Console . WriteLine ( $ "Quotient = {quotient} Remainder = {remainder}" );

// Output:

// Sin = 0.9999996829318346

// Cos = 0.0007963267107331026

// Reciprocal estimate = 0.2

// Reciprocal sqrt estimate = 0.4472135954999579

// Min = 5

// Max = 10

// Abs = 5

// Clamp = 5

// Sign = 1

// Quotient = 0

// Remainder = 2

这个是在字典中循环或者修改结可变结构体时用, 可以减少结构的副本复制, 也可以避免字典重复进行哈希计算,这个有点晦涩难懂,有兴趣的可以看看这个

Dictionary int , MyStruct dictionary = new ()

{

{ 1 , new MyStruct { Count = 100 } }

};

int key = 1 ;

ref MyStruct value = ref CollectionsMarshal . GetValueRefOrNullRef ( dictionary , key );

// Returns Unsafe.NullRef () if it doesn't exist; check using Unsafe.IsNullRef(ref value)

if (! Unsafe . IsNullRef ( ref value ))

{

Console . WriteLine ( value . Count ); // Output: 100

// Mutate in-place

value . Count ++;

Console . WriteLine ( value . Count ); // Output: 101

}

struct MyStruct

{

public int Count { get ; set ; }

}

IHostBuilder 上的新 ConfigureHostOptions API, 可以更简单的配置应用。

public class Program

{

public static void Main ( string [] args )

{

CreateHostBuilder ( args ). Build (). Run ();

}

public static IHostBuilder CreateHostBuilder ( string [] args ) =

Host . CreateDefaultBuilder ( args )

. ConfigureHostOptions ( o =

{

o . ShutdownTimeout = TimeSpan . FromMinutes ( 10 );

});

}

.NET 6 引入了一种新的 CreateAsyncScope 方法, 当您处理 IAsyncDisposable 的服务时现有的 CreateScope 方法会引发异常, 使用 CreateAsyncScope 可以完美解决。

await using var provider = new ServiceCollection ()

. AddScoped Example ()

. BuildServiceProvider ();

await using ( var scope = provider . CreateAsyncScope ())

{

var example = scope . ServiceProvider . GetRequiredService Example ();

}

class Example : IAsyncDisposable

{

public ValueTask DisposeAsync () = default ;

}

•DecryptCbc

•DecryptCfb

•DecryptEcb

•EncryptCbc

•EncryptCfb

•EncryptEcb

static byte [] Decrypt ( byte [] key , byte [] iv , byte [] ciphertext )

{

using ( Aes aes = Aes . Create ())

{

aes . Key = key ;

return aes . DecryptCbc ( ciphertext , iv , PaddingMode . PKCS7 );

}

}


网站题目:包含vb.nettuple的词条
网页URL:http://bzwzjz.com/article/doshedd.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 网站制作公司 企业网站设计 古蔺网站建设 手机网站建设 高端网站设计 网站设计公司 网站制作 手机网站制作 定制网站建设多少钱 网站建设开发 重庆网站建设 网站建设方案 网站设计 网站建设 网站建设方案 定制网站建设 企业网站建设 成都网站设计 高端网站设计 成都品牌网站设计 网站制作报价 成都网站设计