小编gom*_*nda的帖子

在Firebird数据库中创建自动增量字段的最简单方法

有没有一种使用Firebird创建自动增量字段的简单方法?我已经安装了FlameRobin管理工具,但是通过该工具创建自动增量字段的过程很复杂.我是否可以通过单击复选框或使用除Flamerobin之外的其他工具来创建此类身份字段?

firebird field auto-increment

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

创建动态按钮并使用c#将它们置于预定义的顺序中

NET 4.5 C#创建一个Windows窗体.我想动态创建和添加按钮并为它们分配点击事件,但希望它们像图像一样以特定方式动态放置.

在此输入图像描述

我的问题是如何以上述方式动态放置按钮,即4x4格式(连续4个按钮,4列但无限行).是否有可能以获胜形式这样做?

目前我正在尝试下面提到的代码,但对于如何放置如上所示的按钮没有明确的想法.

        public Form1()
    {
        InitializeComponent();

        for (int i = 0; i < 5; i++)
        {
            Button button = new Button();
            button.Location = new Point(160, 30 * i + 10);
            button.Click += new EventHandler(ButtonClickCommonEvent);
            button.Tag = i;
            this.Controls.Add(button);
        }
    }

void ButtonClickCommonEvent(object sender, EventArgs e)
  {
     Button button = sender as Button;
     if (button != null)
     {       
        switch ((int)button.Tag)
        {
           case 0:
              // First Button Clicked
              break;
           case 1:
              // Second Button Clicked
              break;
           // ...
        } …
Run Code Online (Sandbox Code Playgroud)

.net c# button winforms

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

如何将无边框表单放置在按钮下

我动态创建了 4 个按钮,并使用 c# win 表单水平放置它们。现在我想在鼠标悬停事件的 4 个按钮中的每一个按钮下显示一个自定义工具提示(实际上是无边框表单)。但是我如何将我的工具提示表单放置在纽扣??我已经尝试了下面的代码,但它没有按预期的方式工作。

tooltip.Location = new System.Drawing.Point(b.Left, b.Top);
Run Code Online (Sandbox Code Playgroud)

其中“tooltip”是工具提示表单对象,“b”是动态按钮。请提供一些代码片段。

private void B_MouseHover(object sender, EventArgs e)
    {
        var b = sender as Button;
        //MessageBox.Show(Cursor.Position.ToString());
        if(b!= null)
        {
            if (tooltip == null)
            {
                tooltip = new frmSecQStatToolTipDlg();
            }

            tooltip.Location = new System.Drawing.Point(b.Left, b.Bottom);
            tooltip.data(b.Tag.ToString());
            tooltip.Show();
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# winforms

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

CheckedListBox检查/取消选中检测

我在Winforms应用程序中有一个CheckedListBox,其中包含Months as Items(如1月,2月,3月等).我正在尝试实现以下功能:当任何项目被选中时,应弹出一条消息,说明它已被检查.当取消选中相同的项目时,该消息应该说它已取消选中.我已经尝试过下面的代码,但它不能按原样运行.目前,当选中或取消选中任何项目时,将显示相同的消息集.

CheckOnClick =真

    private void clbMonthly_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (clbMonthly.GetItemChecked(1) == true)
        {
            MessageBox.Show("Item 1 checked");
        }
        else
        {
            MessageBox.Show("Item 1 unchecked");
        }
        //........
    }
Run Code Online (Sandbox Code Playgroud)

我希望你理解我的问题.请在c#中建议正确的代码.提前致谢

c# checkedlistbox winforms

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

三元符号相当于c#中的If Else语句

为了缩短代码,我希望用下面提到的If Else语句替换三元表示法,但我的代码显示错误.

if (txtMayAmt.Enabled)
{
    txtMayAmt.Text = txtAprilAmt.Text;
}
else
{
    txtMayAmt.Text = "0";
}
Run Code Online (Sandbox Code Playgroud)

我显示错误的三元符号是

((txtMayAmt.Enabled) ? (txtMayAmt.Text = txtAprilAmt.Text) : (txtMayAmt.Text = "0"));
Run Code Online (Sandbox Code Playgroud)

请提供代码建议.

c#

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

标签 统计

c# ×4

winforms ×3

.net ×1

auto-increment ×1

button ×1

checkedlistbox ×1

field ×1

firebird ×1