C # for the management of Visio two development dropdown list

Source: Internet
Author: User
Tags field table

Each shape has many attributes, and here I mean custom attributes, each of which corresponds to a type, just as we need to specify the type when SQL Server creates a field. There are several types of properties for Visio:

Automatic constants TD style= "BORDER:0;PADDING:0;" >
value description
0 string. This is the default value. visproptypestring
1 fixed list. Displays list items in the Drop-down combo box in the shape Data dialog box. Specify a list item in the Format cell. Users can select only one item from the list. visproptypelistfix
2 visproptypenumber
3 Boolean value. Displays FALSE and TRUE items, which are the items that users can select from the Drop-down list box in the shape Data dialog box. visproptypebool
4 List of variables. Displays list items in the Drop-down combo box in the shape Data dialog box. Specify a list item in the Format cell. Users can select a list item or enter a new item to add to the current list in the Format cell. Visproptypelistvar
5 date or time value. Displays the day, month, and year, or seconds, minutes, and hours, or the combined values of dates and times. Specify a format picture in the Format cell. visproptypedate
6 the duration value. Shows the time that has elapsed. Specify a format picture in the Format cell. visproptypeduration
7 the currency value. Use the system's current regional settings. Specify a format picture in the Format cell. visproptypecurrency

This article focuses on the next two types:visproptypelistfix and visproptypelistvar, fixed lists and variable lists, in fact, these two types correspond. NET programming model is ComboBox, this control has a property DropDownStyle, can be specified as DropDownList and dropdown of these two types, essentially visproptypelistfix Corresponds to the DropDownList type (only the value of the list can be selected),Visproptypelistvar corresponds to the dropdown type (in addition to the optional list value, you can also enter a new value).

The values of both lists in Visio are shown by the value of the format in the corresponding ShapeSheet row, and if the value of the format of a list is private, public, then two options are available, as shown in the following illustration.

?

So how do we manage these drop-down lists in the two-time development programs in Visio?

For a fixed list, when we add or modify a custom attribute, we give it a fixed value that's OK, very simple, like the following code:

targetShape.get_CellsU("Prop."?+?source.Name?+?".Format").FormulaU?=?"专用;公用"

For a mutable list, we don't want to write the content dead, otherwise we'll get the name. As with the "Manufacturer" attribute, we want it to change as our database content changes, so how do we implement it?

First, we create two tables in the database, a table named Dropdownlistfield, a field to place the Drop-down list, and a table named Dropdownlistvalue to place the variable list option values.

?

Then, when we add or modify the stencil properties, we add to the database The fields for each device, Visproptypelistvar for the variable list type, and not the List field table Dropdownlistfield. This is equivalent to registering the field in the database as a mutable list, which you can assign a value to (described below).

Then, it's the step to assign a variable list, and we'll find the relevant variable list field from the database, add or remove the related list items, as shown in the following figure.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.