我有一个krypton组合框,我将数据绑定到一个键值对列表.发生的事情是,当我在代码中设置所选项目时,它突出显示文本.如何防止这种情况或取消选择文本?
我尝试过以下方法:
// 1
combo.Select(0,0);
// 2
combo.Focus();
anotherControl.Focus();
// 3
combo.SelectionStart = 0;
combo.SelectionLength = combo.Text.Length;
// 4
combo.SelectionStart = combo.Text.Length;
combo.SelectionLength = 0;
Run Code Online (Sandbox Code Playgroud)
似乎没什么用.任何帮助表示赞赏.
如果我尝试这样做它不起作用:
static void Main(string[] args)
{
int a = 5000;
Console.WriteLine((string)a);
}
Run Code Online (Sandbox Code Playgroud)
但不知何故,这工作正常:
static void Main(string[] args)
{
int a = 5000;
Console.WriteLine(a + "");
}
Run Code Online (Sandbox Code Playgroud)
这是为什么?是因为第一个尝试更改基类型,第二个只是将值附加到字符串?
我正在创建一个WinForm应用程序,它使用网络摄像头拍摄一个人的照片,我正在尝试创建一个倒计时效果.我有4个图像,我想循环,但这是非常棘手的完成.
我正在使用计时器秒,但所有发生的事情是应用程序滞后一点,然后最后一张图像显示.有谁知道我怎么做到这一点?
这是我的代码:
int counter = 0;
// start the counter to swap the images
tmCountDown.Start();
while (counter < 4)
{
// holding off picture taking
}
// reset counter for timer
counter = 0;
tmCountDown.Stop();
/// <summary>
/// timer event to switch between the countdown images
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tmCountDown_Tick(object sender, EventArgs e)
{
counter++;
//MessageBox.Show("c:/vrfid/apppics/" + counter + ".jpg");
pbCountDown.Image = new Bitmap("c:/vrfid/apppics/" + counter + ".jpg");
}
Run Code Online (Sandbox Code Playgroud)