简体   繁体   中英

C# How to store Brush/Pen information in a database table

I need to store Brush/Pen information about several shapes in a database table, one row for each layer I draw.

I was thinking of two schemes:

BRUSH_INFO                 PEN_INFO
SolidBrush(Color.Red)      Pen(Color.Black)

pros: only two colums
cons: eval'd column

BRUSH_INFO   PARAM_B1   PARAM_B2 ... PEN_INFO  PARAM_P1     PARAM_P2 ...
SolidBrush   Color.Red  (null)       Pen       Color.Black  (null)

pros: parameters are separated
cons: many columns

I think the second one should be generic enough but I'm not sure.

What schema will you use to store this kind of information?
Can you suggest a table structure so that I can store any kind of Brush/Pen with its parameters?

I would use seperate tables for brush and pen information. So you could reuse the same brush/pen for multiple shapes.

将它们存储为XML序列化数据,不需要表。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM