English 中文(简体)
我将如何改变一个 but子的边界图谱?
原标题:How would I change the border color of a button?
  • 时间:2011-11-23 15:32:27
  •  标签:
  • c#
  • winforms

这是我的法典:

buttonName = "btn" + y.ToString() + x.ToString();
Control btn = this.Controls.Find(buttonName, true)[0] as Control;
btn.BackColor = System.Drawing.Color.Blue;

然而,我看不出边界有色人种,也看不出类似情况。

我使用了这一法典,因为我以我的形式有许多纽芬兰人,而且这些纽芬兰人的任何财产都能够改变,因此,我只是提出可以处理这些财产的法典。

是否有一部类似于上述法典的法典,这会使我改变纽芬兰的边境颜色?

最佳回答

我不相信你正在从事哪类工作,然而,即便在设计者,也没有任何边界财产可直接上岸。 你们可以使用一种 flat子。 你们的类型必须是纽芬兰。

你可以这样做:

buttonName = "btn" + y.ToString() + x.ToString();
Button btn = this.Controls.Find(buttonName, true)[0] as Button;
btn.BackColor = System.Drawing.Color.Blue;
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderColor = Color.Red;
btn.FlatAppearance.BorderSize = 1;

不幸的是,这只会在纽芬兰州建造一个公寓。

问题回答

你们可以使用公寓。 边境科

    btn.FlatAppearance.BorderColor = System.Drawing.Color.Blue;

我知道,这个问题在很长一段时间之前(在2011年)才提出,但我认为我的意见对某人有用:没有使用。 聚苯乙烯,你可以使用控制灯。 你想改变边界颜色的绘画

    private void btnName_Paint(object sender, PaintEventArgs e)
    {
        Button btn = (Button)sender;

        ControlPaint.DrawBorder(e.Graphics, btn.ClientRectangle,
                                Color.LightGreen, 1, ButtonBorderStyle.Solid,
                                Color.LightGreen, 1, ButtonBorderStyle.Solid,
                                Color.LightGreen, 1, ButtonBorderStyle.Solid,
                                Color.LightGreen, 1, ButtonBorderStyle.Solid
                                );
    }

据Microsoft()

适用

。 NET Framework

4.7.2、4.7.1、4.7、4.6、4.6、4.6、4.5.1、4.5、4.0、3.5、3.0、2.0、1.1

你们需要把控制放在布顿(或不管其类型如何)。 控制是一种基类,不会含有改变边界色体的特性。 这是否是一个窗口?





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签