【问题标题】:Bottom anchor duplicates calendar control底部锚点复制日历控件
【发布时间】:2013-08-06 21:11:01
【问题描述】:

当我在日历控件上放置一个底部锚点时,它会将日历翻倍并显示两个月。
我想要的只是当表单最大化时日历留在面板的底部。

锚点之前:

锚定后:

运行时截图)这正常吗?
如果是,我怎样才能让日历在没有锚的情况下粘在面板底部?因为锚点与我拥有的所有其他控件都可以正常工作。

【问题讨论】:

    标签: c# winforms .net-4.0 calendar anchor


    【解决方案1】:

    为什么不尝试设置yourCalendarControl.Dock

    yourCalendarControl.Dock = DockStyle.Bottom;
    yourPanel.Padding.Left = yourPanel.Padding.Right = 30;//It's up to you
    //SizeChanged event handler of your form
    private void form_SizeChanged(object sender, EventArgs e){
       if(form.WindowState == FormWindowState.Maximized){
          yourPanel.Padding.Bottom = 0;
       }
       else yourPanel.Padding.Bottom = 200;//It's up to you
    }
    

    另外,我猜你将Anchor设置为AnchorStyles.Bottom | AnchorStyles.Top,试试这样设置:

    yourCalendarControl.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
    

    【讨论】:

      猜你喜欢
      • 2021-07-26
      • 1970-01-01
      • 2016-06-07
      • 1970-01-01
      • 1970-01-01
      • 2021-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多