静态用户如何控制C# [英] How do a static user control C#

查看:84
本文介绍了静态用户如何控制C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用两个Thumb在User控件中创建一个TrackBar。但是,如果我在窗体中拖动这个组件。设计,弄乱所有,拇指去严格,轨道栏向下,我需要一个命令,使这个轨道栏保持静止。



我尝试了什么:



我尝试在'AutoSize'中输入属性值false或true,但没有更改

I make a TrackBar in User control with two Thumbs . But if I drag in horizontal this component in form.Design , mess all , the thumbs go to rigth , the trackbar go to down, i need a command that keep this trackbar static.

What I have tried:

I tried put in properties the value false or true in the 'AutoSize', but nothing change

推荐答案

首先,不要使用静态一词来处理与C#相关的任何内容 - 它具有非常具体的含义,与您的无关问题! :笑:

问题可能与用户控件的大小有关,以及如何为构成它的控件设置Anchor和Dock属性。

假设拇指应位于中央轨道栏的左侧和右侧,则它们都不应将Dock设置为任何东西,并且Anchor属性应设置如下:

First off, don't use the word "static" to do with anything C# related - it has a very specific meaning which is nothing to do with your problem! :laugh:
The problem is probably to do with the size of the user control, and how you have the Anchor and Dock properties set for the controls that make it up.
Assuming the thumbs should be to the left and right of a central trackbar, then none of them should have Dock set to anything, and the Anchor properties should be set as shown below:
thumbLeft     trackBar       thumbRight
Top+Left   Top+Left+Right    Top+Right



这样,按钮将保持固定大小,但右边一个将相对于控件的右边缘移动,并且轨迹栏将自行调整大小以适应。


That way, the buttons will remain fixed size, but the right one will move relative to the right edge of the control, and the track bar will resize itself to fit.


这篇关于静态用户如何控制C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆