3 回答

TA貢獻(xiàn)1995條經(jīng)驗 獲得超2個贊
ListBox
.
“NodeXX”文本包含在 Thumb
控件,該控件支持單擊和拖動。 連接器也可以選擇,并顯示一個很好的動畫,當(dāng)他們是。 左面板允許當(dāng)前選定對象的值的版本。 UI的功能與包含它的數(shù)據(jù)完全解耦。因此,所有這些節(jié)點和連接器都是簡單的類。 int
和 double
可以從DB或其他數(shù)據(jù)源加載/保存的屬性。 如果您不喜歡單擊序列的完成方式,請繪制節(jié)點和連接器,這可以完全適應(yīng)您的需要。 WPF規(guī)則。
編輯:
我加入了 SnapSpot
進入等式。這些是你在節(jié)點周圍看到的紅色半圓,實際上是 Connector
我們被綁在一起。 我還更改了 Connector
DataTemplate使用 QuadraticBezierSegment
基于 Connector.Start.Location,Connector.MidPoint, and Connector.End.Location
有一個小紅方形 Thumb
當(dāng)您選擇(單擊)在 Connector
,(在屏幕截圖中可見),它將允許您移動 MidPoint
曲線。 您還可以通過滾動鼠標(biāo)輪來操作該值。 TextBoxes
在左側(cè)面板的“中間點”下。 “崩塌一切” CheckBox
允許在大小框之間切換,如屏幕截圖所示。 這個 SnapSpot
我們有一個 OffsetX
OffsetY
在0到1之間,對應(yīng)于它們相對于父級的位置。 Node
..這些不限于4個,實際上可能是每個 Node
.這個 ComboBoxes
和 Buttons
沒有功能,但這只是創(chuàng)建相關(guān)屬性和 在 Node
類并將它們綁定到該類。
編輯2:

TA貢獻(xiàn)1811條經(jīng)驗 獲得超6個贊
class Room { public Room(String name, Point location); public void Draw(Graphics g); } class Connection { public void Add(Point ptConnection); public void Add(Point[] ptConnection); // Draw will draw a straight line if only two points or will draw a bezier curve public void Draw(Graphics g); } class House // basically a graph { public void Add(Room room); public void AddRoomConnection(Room r1, Room r2, Connection connector); // draw, draw each room, then draw connections. public void Draw(Graphics g); } void Main() { House myHouse = new House(); Room hall = new Room("Hall", new Point(120,10); Room bedroom1 = new Room("Bedroom1", Point(0, 80)); Connection cnHallBedroom = new Connection(); cn.Add(new Point()); // add two points to draw a line, 3 or more points to draw a curve. myHouse.AddRoomConnection(hall, bedroom1, cnHallBedroom); }

TA貢獻(xiàn)1811條經(jīng)驗 獲得超4個贊
我擅長猜測規(guī)則:-)是的,我會讓房間成為一個單一的用戶控件,您可以在其中指定一個名稱。當(dāng)然,您可以對不同房間的用戶控件進行子類化。我認(rèn)為這里的秘訣是創(chuàng)建新的房間,并將它們添加到“家庭類”中。用戶如何連接它們是完全開放的。單線,Bezier曲線等,這就是連接類的位置。兩點是一條單線,多于兩個點是一條曲線。就像我說的,這是一個基本的方法。
- 3 回答
- 0 關(guān)注
- 650 瀏覽
添加回答
舉報