本文介绍了连接不同的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

非常感谢大家到目前为止对我的帮助.如果您不介意,我还有另一个问题.

我要达到的目标是有一个矩形的自定义控件,我想向其添加连接器作为单独的控件,以便它可以与第一个矩形控件的边缘重叠.

整体所需的效果类似于Visio或Powerpoint,它们的对象具有与对象角重叠的连接器,您可以从中创建线以连接对象.

所以这就是我所做的.

1.我创建了一个自控件类继承的自定义控件.我覆盖了油漆的肉类,并在其中放置了一些构造函数和其他一些东西.这部分工作正常

2.我创建了一个连接器控件,它是一个10、10的小正方形,代表一个连接器.到目前为止一切正常.

3.现在这是我遇到麻烦的地方.当我创建第一个控件时,我希望它创建4个连接器控件,并使它们与顶部,左侧,右侧和底部的中心重叠.我只是不知道该如何实现.关于此的任何建议,我都会很高兴听到.

非常感谢您的帮助和时间,

Thechazm

Thank you all so much for helping me so far. I have another question if you wouldn''t mind.

The goal I am trying to achive is have one custom control that is a rectangle shape and I would like to add connectors to it as a seperate control so it can overlap the edge of the first rectangle control.

The overall desired effect is like is Visio or Powerpoint where their objects have connectors that overlap the corners of their objects that you can create lines from to connect objects.

So here is what I have done.

1. I have created a custom control that inherits from the control class. I overrode the paint meathod and put some contructors in there and some other stuff. This part of it works fine

2. I created a connector control that is a small 10, 10 square that represents a connector. This all works fine so far.

3. Now this is where I am having trouble. When I create the first control I want it to create 4 of the connector controls and have them just overlapping the center''s of the top, left, right, and bottom. I just don''t know how to achive this. Any recommendation on this I would gladly hear.

Thank you very much for your help and time,

Thechazm

推荐答案




这篇关于连接不同的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 22:53