如何更改文本框上的自动完成功能?我希望当我输入一个字符串时,该框会建议包含该字符串的项目,而不是以它开头。
我的代码是:
class MyClass
{
private AutoCompleteStringCollection autoCompleteList = new AutoCompleteStringCollection();
public MyClass()
{
InitializeComponent();
autoCompleteList.AddRange(ListNames.Select(x=>x.Name).ToArray());
textBoxName.AutoCompleteCustomSource = autoCompleteList;
textBoxName.AutoCompleteSource = AutoCompleteSource.CustomSource;
textBoxName.AutoCompleteMode = AutoCompleteMode.Suggest;
textBoxName.KeyDown += TextBoxtextName_KeyDown;
}
private void TextBoxClient_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
this.Name = (sender as TextBox).Text;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想要的是:
我有以下代码:
typedef signed char Char;
static const struct MyStruct
{
const Char* str;
// Other fields
}
myList[] =
{
{"none", /* Other fields */},
{"main", /* Other fields */},
}
Run Code Online (Sandbox Code Playgroud)
但我有编译错误:
无法使用类型为“const char [X]”的左值初始化“const Char *”(又名“const signed char *”)类型的成员子对象
X 是字符串长度
当我替换为时就可以Char了char,但是我该如何使用signed char呢?
我正在将C#的一部分代码翻译成C++.
以下是我的观点:
Class Point
{
public int X;
public int Y;
}
const int MAX = 256;
public void ComputePoints(Byte[] image,
int width,
int height,
out List<Point>[] listPixels)
{
listPixels = new List<Point>[MAX];
//etc..
}
Run Code Online (Sandbox Code Playgroud)
(我简化了这段代码只显示有趣的部分).
我的问题关注的是out List<Point>[] listPixels.我试着通过以下方式翻译:
public void ComputePoints(unsigned char[] image,
int width,
int height,
std::vector<Point> *listPixels[])
{
*listPixels = new std::vector<Point>[MAX];
//etc..
}
Run Code Online (Sandbox Code Playgroud)
但我有错误
分段故障.
如何out List<Point>[] listPixels在C++中编写最简单的等价物?
我已经为我的 C# 项目创建了第一个 Wix 安装程序(我是 wix 的初学者)。
安装程序创建一个 msi 文件,该文件运行良好。安装后,所有 DLL 和 .exe 均在“C:\Program Files (x86)\MyApplication”中创建
但是,当我右键单击 msi 并选择卸载时,会显示卸载菜单,没有错误,但文件夹“C:\Program Files (x86)\MyApplication”未删除。
如何定义卸载功能来删除该文件夹?
我的 Product.wxs 有一部分
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*"
Name="My Application"
Language="1033"
Version="1.0.0.0"
Manufacturer="Me"
UpgradeCode="36944ae1-9e9f-4ef0-a860-9d894e0c28ef">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<Media Id="1" Cabinet="myApplication.cab" EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="My Application" Level="1">
<ComponentGroupRef Id="ProductComponents"/>
<ComponentRef Id ="ApplicationShortcut"/>
<ComponentRef Id ="ApplicationShortcutDesk"/>
<ComponentRef Id ="RemoveAll"/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="My …Run Code Online (Sandbox Code Playgroud) 我有一个StringBuilder,我想写一个包含重音到csv文件的文本.
码:
StringBuilder strbr = new StringBuilder();
strbr.AppendLine("ù;é;à");
File.WriteAllText(filePath + ".csv", strbr.ToString());
Run Code Online (Sandbox Code Playgroud)
但是当我打开我的csv文件时,只有: é
文件"test.csv"正确包含ù;é;à,但当我用Excel打开它时,我有:
也许我错过了Excel的标题?
我正在使用 .Net Core 2.1 开发 Web 服务。
我有一个包含所有像素值(灰度)、宽度、高度的字节数组。我想从这些参数创建一个位图。
有我的代码(来自一个有效的 .Net Framework 4 项目):
public FileResult PostSealCryptItem(Byte[] matrix, int width, int height)
{
Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
bmp.SetPixel(x, y, Color.FromArgb(ToArgb(matrix, x, y)));
Byte[] data = BitmapToByteArray(bmp);
FileContentResult result = new FileContentResult(data , "image/png");
return result;
}
Run Code Online (Sandbox Code Playgroud)
但是在 .NET Core 中,我遇到了错误:
找不到类型或命名空间名称“位图”(您是否缺少 using 指令或程序集引用?)
我尝试添加对 System.Drawing 的引用,但没有奏效。
有没有办法获取Ada中的当前日期?
我正在寻找与C#等效的 DateTime.Now()返回持续时间的方法。
我有一个活动T,我想确定是否T在30秒前开始。
我创建了一个类型:
packages MyTypes.Type_A is
subtype Counter_Type is Integer range 0 .. 15;
type Array_Counter_Type is record
Counter_01 : Counter_Type ;
Counter_02 : Counter_Type ;
Counter_03 : Counter_Type ;
Counter_04 : Counter_Type ;
end record;
end MyTypes.Type_A;
Run Code Online (Sandbox Code Playgroud)
我想这样显示我的数组
MyArray : Array_Counter_Type;
print ( MyTypes.Type_A.Array_Counter_Type'Image (MyArray));
Run Code Online (Sandbox Code Playgroud)
但是我有错误:
前缀og“图片”属性必须为标量类型
我能怎么做 ?是否可以“定制” Image以连接用“-”分隔的4个计数器?
我有这段代码:
with Ada.Unchecked
private package MyPackage is
function UC_Bool_To_U8 is new Ada.Unchecked_Conversion (Source => Boolean, Target => T_U8);
end MyPackage;
Run Code Online (Sandbox Code Playgroud)
T_U8 在哪里:
type T_U8 is range 0 .. 2**7;
Run Code Online (Sandbox Code Playgroud)
功能UC_Bool_To_U8 正在运行,但我有编译警告:
警告:未经检查的转换类型具有不同的大小
警告:“Boolean”的大小为 1,“T_U8”的大小为 8
警告:源将扩展为 7 个高阶零位
我怎样才能抑制这些警告?
有我的 project.gpr 文件:
project Test is
Project_Source_Dirs := ("Dir1")
& ("src")
& ("../../lib_all");
for Object_Dir is "lib";
for Main use ("Main_file.adb");
for Languages use ("Ada");
for Source_Dirs use Project_Source_Dirs & project'Object_Dir;
-- [...]
end Test;
Run Code Online (Sandbox Code Playgroud)
有我的“../../lib_all”文件夹:
lib_all
|- file1.adb
|- file1.ads
|- file2.adb
|- file2.ads
|- file3.adb
|- file3.ads
|- file4.adb
|- file4.ads
Run Code Online (Sandbox Code Playgroud)
我只想使用 file3,如何修改我的 .gpr 文件以便每次都不编译所有其他文件?