在WPF中的列表中访问和存储数据 [英] Accessing and storing data in a List in WPF

查看:69
本文介绍了在WPF中的列表中访问和存储数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有图像,我想编辑每个图像(例如绘制一些形状,如矩形,椭圆形等),并将每个形状的信息以及该形状在图像上的位置存储在列表中.请给我一些建议,说明如何创建一个集合来存储数据.

我希望集合存储这样的数据.

Image1 ---- DrawingList(应包含每个形状的名称,例如:Drawing1,Drawing2等)
| ___ Drawing1(例如:矩形形状应包含形状和位置数据)
| ___ shape(起点位置和终点位置)
| ___ Position(形状在图像上的中心位置)
| ___ Drawing2(例如:椭圆形应包含shape&Position数据)
| ___ shape(起点位置和终点位置)
| ___ Position(形状在图像上的中心位置)

图2 --- DrawingList
| ___ Drawing1(例如:矩形)
| ___ Shape
| ___位置
| ___ Drawing2(例如:矩形)
| ___ Shape
| ___位置
......
......

图片列表应包含图片ID,每个图片均应不包含图片ID.在工程图列表中绘制的形状.在工程图列表中,每个形状的开始和结束位置以及形状在图像上的位置.现在,下一张图像应包含相同的信息.

任何帮助将不胜感激.

谢谢,

Hi All,

I have images, i want to edit each image(like draw some shapes like rectangles,ellipse etc) and store the information of each shape and position of the shape on the image in a list. Plz give me suggestions how can i create a collection to store the data.

I want the collection to store data like this.

Image1----DrawingList(should contain each shape Name eg: Drawing1, Drawing2 etc.)
|___Drawing1(eg:rectangle shape should contain shape&Position Data)
|___shape(starting point location and ending point location)
|___Position(centrepoint location of the shape on the image)
|___Drawing2(eg: ellipse shape should contain shape&Position Data)
|___shape(starting point location and ending point location)
|___Position(centrepoint location of the shape on the image)

Image2---DrawingList
|___Drawing1(eg:rectangle shape)
|___Shape
|___Position
|___Drawing2(eg:rectangle shape)
|___Shape
|___Position
...............
...............

Image list should contain image ID''s each image should contain no. of shapes drawn in Drawinglist. In the drawing list each shape starting and ending locations and position of the shape on the image. Now next images should contain the same information like this .

Any help will be much appreciated.

Thanks,

推荐答案

创建一个名为shape的类,其名称为该形状的名称以及该形状的左上角和右下角的xy坐标.

为图像创建另一个类,该类具有名称和形状列表

您的最终收藏集是图片,这取决于您的选择控制权.
Create a class called shape with the name of the shape and the xy coords of the top left and bottom right of the shape.

Create another class for image which has a name and a list of shapes

Your ultimate collection is a of images and this is bound to your control of choice.


这篇关于在WPF中的列表中访问和存储数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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