小编use*_*618的帖子

将winform定位在屏幕的左下角

我试图将一个表单放在屏幕的左下角(在开始按钮上)我有以下代码试图这样做,但只考虑屏幕的工作区域 - 所以表单定位在开始按钮上方:

int x = Screen.PrimaryScreen.WorkingArea.Left + this.Width;
int y = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height;
this.Location = new Point(x, y);
Run Code Online (Sandbox Code Playgroud)

下面是一个演示/屏幕,以进一步展示我想要做的事情:

[演示屏幕](http://i.stack.imgur.com/9mTjj.png)

.net c# windows winforms

12
推荐指数
1
解决办法
2万
查看次数

如何按键查找/检查字典值

我试图确认特定的字典键是否包含值

例如

dict01在"tester"键中包含短语"testing"

目前我不得不使用KeyPair迭代字典,我不想这样做因为它浪费性能

.net c# windows

8
推荐指数
1
解决办法
3万
查看次数

使用具有对象名称的for循环

我有一个简单的for循环如下:

for (int i = 0; i > 20; i++)
{

}
Run Code Online (Sandbox Code Playgroud)

现在我有20个标签(label1,label2,label3等等......)

我想做的事情如下:

for (int i = 0; i > 20; i++)
{
    label[i].Text = String.Empty;
}
Run Code Online (Sandbox Code Playgroud)

实现这一目标的最简单方法是什么?

.net c# windows

3
推荐指数
1
解决办法
1343
查看次数

鼠标悬停事件上的Hightlight列表框项目

listview当鼠标悬停在项目上时,我试图更改项目的背景颜色

我有一个鼠标悬停事件,但是如何在鼠标悬停在项目上时添加"突出显示"效果?

private void pinnedAppsListBox_MouseHover(object sender, EventArgs e)
{

}
Run Code Online (Sandbox Code Playgroud)

.net c# windows winforms

3
推荐指数
1
解决办法
2万
查看次数

收集被修改; 枚举操作可能无法执行

我收到错误:收集被修改; 枚举操作可能无法执行.我试图删除除当前之外的所有打开的表单对象:

    FormCollection fc = Application.OpenForms;
    foreach (Form form in fc)
    {
        if (form.ToString().Contains("_MainFrom.Form1"))
        {
            // Do nothing
        }
        else
        {
            form.Hide();
            form.Dispose();
        }
    }
Run Code Online (Sandbox Code Playgroud)

.net c# windows

3
推荐指数
1
解决办法
2266
查看次数

从C#中的文件路径中删除文件名

我试图删除路径的文件名,例如:

/vmfs/volumes/50153b66-6aac5486-e942-080027a10080/TestMachine/TestMachine.vmx
Run Code Online (Sandbox Code Playgroud)

会导致:

/vmfs/volumes/50153b66-6aac5486-e942-080027a10080/TestMachine/
Run Code Online (Sandbox Code Playgroud)

请记住文件名可能会改变,正则表达式是实现这一目标的最佳方式吗?

.net c# windows

0
推荐指数
1
解决办法
134
查看次数

C++中的简单计算器

我正在构建一个简单的计算器作为学习练习而且我偶然发现 - 我得到了第一个数字的用户输入,但它无法存储第二个输入的int - 我是否需要创建对象?我认为这是一个明显的问题......

//Simple calculator to work out the sum of two numbers (using addition)

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    cout << "Enter the first int: \n";
    int input1 = std::cin.get();

    cout << "Enter the second int: \n";
    int input2 = std::cin.get();


    cout << "The sum of these numbers is: " << input1 + input2;
    cout << "\n";


    system("PAUSE");
    return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)

c++ windows

0
推荐指数
1
解决办法
264
查看次数

标签 统计

windows ×7

.net ×6

c# ×6

winforms ×2

c++ ×1