简体   繁体   English

将alt代码组合作为参数传递

[英]pass alt code combination as parameter

I have a simple method that accepts a string: 我有一个接受字符串的简单方法:

private void drawTextboxValue(string text)
{
    // lots of code
    g.DrawString(text, font, brush, layout);
}

I should pass alt code "Alt 0149" as the string so it will draw a bullet point (see: http://duena.telenet.be/ALT_toetsen_lijst.htm ). 我应该将替代代码“ Alt 0149”作为字符串传递,这样它将画出一个项目符号点(请参阅: http : //duena.telenet.be/ALT_toetsen_lijst.htm )。

I know you could draw something else to achieve this (an ellipse for example), but for some reason I'm not allowed to do that - I'm only allowed to pass another parameter to this method. 我知道您可以绘制一些其他东西来实现此目的(例如,椭圆),但是由于某些原因,我不允许这样做-我只允许将另一个参数传递给此方法。

How can I achieve this? 我该如何实现?

You can write Unicode characters in C# here is an example 您可以在C#中编写Unicode字符,这是一个示例

string a = "\u0149";

The escape code \? (where dddd is a four-digit number) represents the Unicode character U+dddd. 转义码\\ udddd(其中dddd是四位数字)表示Unicode字符U + dddd。 Eight-digit Unicode escape codes are also recognized: \\Udddddddd 也可以识别八位数的Unicode转义码:\\ Udddddddd

string (C# Reference) 字符串(C#参考)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM