相关疑难解决方法(0)

在TextBox C#中更改边框颜色

我有以下代码:

public class OurTextBox : TextBox
{
    public OurTextBox()
        : base()
    {
        this.SetStyle(ControlStyles.UserPaint, true);
    }

    protected override void OnPaint(PaintEventArgs e)
    {
         base.OnPaint(e);
         Pen penBorder = new Pen(Color.Gray, 1);
         Rectangle rectBorder = new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 1);
         e.Graphics.DrawRectangle(penBorder, rectBorder);
   }
}
Run Code Online (Sandbox Code Playgroud)

这是完美的,但它没有显示文本,直到它得到焦点.

有谁能够帮我?怎么了?

预先感谢.

.net c# textbox winforms

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

更改月份日历的大小

有什么可能的方法来更改日历控件的宽度和高度。我想更改日历的宽度和高度。当我在Google上找到Google时,执行以下步骤:1)在面板中放置月份日历,并允许添加true。并增加面板尺寸。对我不起作用。2)将月历日历放到组框中并停靠。这个月会显示很多个月。3)增加日历控件的字体大小,对我不起作用。

有什么办法可以做到这一点。预先感谢您的评论

.net c# monthcalendar winforms

5
推荐指数
2
解决办法
6622
查看次数

Windows 10操作系统上的Windows窗体图形问题

当我在Windows 10中运行任何Windows窗体应用程序时,窗口内的图形看起来是扭曲的:

坏图像

在设计时,这不会发生:

好的形象

有没有人经历过这个?

(请打开图片看看会更好.)

.net c# graphics scale winforms

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

如何更改 ComboBox 下拉按钮颜色

在此处输入图片说明

如何更改滑动按钮颜色?不是边框颜色,也不是幻灯片项目颜色。

我已经更改了幻灯片项目的颜色

在此处输入图片说明

有什么办法可以改变颜色吗?

.net c# combobox winforms

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

如何在DateTimePicker控件中自定义日历?

我认为问题很简单明确。下面的图像是我当前的进度。

在此处输入图片说明

如您所见,自定义版本是我扩展的DateTimePicker控件。控件根据“聚焦”值更改按钮和边框颜色。日历下拉列表是我接下来要设置的样式。

我只是不知道从哪里开始,因为什么都无法工作。我至少不会改变边框颜色,字体颜色等。

c# winforms-interop winforms

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

更改 NumericUpDown 的边框颜色

我对 C# 很陌生,有一个问题。我已经能够通过将 FlatStyle 更改为“Flat”来更改按钮的边框颜色等。使用NumericUpDown,我无法更改 FlatStyle。我希望仍然能够使用向上和向下箭头,因此仅使用其他东西来覆盖边缘是行不通的。这是我在代码中所做的事情的简化版本:

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace bordertest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BackColor = Color.Black;
            numericUpDown1.BackColor = Color.Red;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# numericupdown winforms

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