123YYD 2018-07-10 00:40 采纳率: 0%
浏览 1224
已结题

关于c#控件大小的问题

添加一个按钮size(385,263),运行的到的按钮size却跟设置的不一样!不知道是我错了还是什么问题?求大神帮忙看看。 下面附上代码 ,代码中鼠标坐标为控件右下角坐标图片说明

  • 写回答

8条回答

  • 123YYD 2018-07-10 00:44
    关注

    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    private void Form1_MouseMove(object sender, MouseEventArgs e)
    {
    label1.Text = string.Format("鼠标屏幕坐标系({0},{1})", Cursor.Position.X, Cursor.Position.Y);

            label2.Text = string.Format("鼠标窗体坐标系({0},{1})", e.X ,e.Y );
    
            label3.Text = string.Format("按钮Width({0})", this.button1.Right - this.button1.Left);
    
            label4.Text = string.Format("按钮Heigth({0})", this.button1.Bottom - this.button1.Top);
    
        }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题