如何在WinForms中使子控件的位置相对?

编程入门 行业动态 更新时间:2024-10-11 11:24:56
本文介绍了如何在WinForms中使子控件的位置相对?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个从Control派生的自定义控件,该控件被动态添加到表单中。控件在位置中可以具有负值,并且默认情况下是相对于左上角绘制的。

I have a custom control derived from Control which is dynamically added to the form. The control can have negative values in Location and is by default painted relative to the top left corner.

我如何才能使控件具有负坐标并相对于右侧绘制

How can I get the control to have negative coordinates and painted relative to right bottom corner for example?

推荐答案

问题标题和问题问了两个不同的问题。

The question title and the question ask two different things.

标题:是的,您可以进行相对放置,但是您需要使用嵌套的布局面板,例如TableLayoutPanel和FlowLayoutPanel。他们应该能够完成大部分(如果不是全部)您想做的事情。

For the title: yes, you can do relative placement, but you'll need to use nested layout panels, like TableLayoutPanel and FlowLayoutPanel. They should be able to do most, if not all, of what you want to do.

对于实际问题:

  • 为什么?
  • 不,你不能。
  • 更多推荐

    如何在WinForms中使子控件的位置相对?

    本文发布于:2023-11-06 03:44:27,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1562637.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:控件   位置   如何在   中使子   WinForms

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!