:: Visual Foxpro, Foxpro for DOS
Новости FOXADVICER VFP9 про графику
boba

Сообщений: 6269
Откуда: Медвежьи озера-
Дата регистрации: 26.03.2001
Снова получил письмо с кратким содержанием журнала FoxAdvicer
Увидел на мой взгляд стоящую статью Тамар Гранор про новые возможности графики в 9 версии
Нужно сказать, что это одно из моих больных мест
В институте долго занимался разработкой программ анализа временных рядов с интерактивной графикой
Было это на ФОРТРАНе с изспользованием библиотеки HALLO
В виндах ее нет. А графика в фоксе с одной стороны вроде бы и есть, уже в 3 версии были примеры,
но какая то не объектноориентированная и вообще недоделанная
Наконец про это вроде бы вспомнили слегка. И интерактивность графов становится более реальной
Вот статья Тамар Граннор

A: Prior to VFP 9, doing this was tricky at best. You could create the outline of a shape using a number of Line controls, but you didn't have much control over the result. VFP 9 adds a new property -- PolyPoints -- that makes creating shapes other than rectangles and circles much easier, although you still have to know some geometry.

The new PolyPoints property accepts the name of an array. The array contains the points that determine what shape to display. Although you can use an array of any dimension, it's easiest to use a two-column array, one in which the first column provides the x-position for each point and the second column supplies the y-position.

You can use any array that's in scope when you run the form, but your best bet is to add the array as a property of the control or form. To make things easy, subclass the Shape class and add the array property. Then base all your unusual shapes on this subclass. This issue's Professional Resource CD contains a class library called Shapes.vcx. It includes shpPolygon, which has a custom aPoints property (initially defined as an array of one element). The PolyPoints property is set to This.aPoints.

A shape with PolyPoints specified can be displayed at design time. However, in the beta version, that only works if the array is in scope. Worse, after you set PolyPoints to an array that isn't available or without any points specified (like an array property that's populated in the Init method), the outline of the shape disappears except when the shape is selected. To find it, use the object drop-down in the Property Sheet.

You specify the points as percentages of the shape's designated height and width. (The height and width of shpPolygon have both been set to 100.) That is, the values of the points should be between 0 and 100. Figure 1 shows a form (UseShapes.scx on this issue's Professional Resource CD) containing two shapes, one set up as a 6-pointed star, the other as a hexagon. It takes 12 points to specify the star, so the Init method for the star contains this code:

DIMENSION This.aPoints[12,2]

This.aPoints[1,1] = 50
This.aPoints[1,2] = 0
This.aPoints[2,1] = 66
This.aPoints[2,2] = 25
This.aPoints[3,1] = 100
This.aPoints[3,2] = 25
This.aPoints[4,1] = 84
This.aPoints[4,2] = 50
This.aPoints[5,1] = 100
This.aPoints[5,2] = 75
This.aPoints[6,1] = 66
This.aPoints[6,2] = 75
This.aPoints[7,1] = 50
This.aPoints[7,2] = 100
This.aPoints[8,1] = 33
This.aPoints[8,2] = 75
This.aPoints[9,1] = 0
This.aPoints[9,2] = 75
This.aPoints[10,1] = 16
This.aPoints[10,2] = 50
This.aPoints[11,1] = 0
This.aPoints[11,2] = 25
This.aPoints[12,1] = 33
This.aPoints[12,2] = 25

The star on the form is based on the shpStar class in the Shapes class library, and the hexagon is based on shpHexagon. Because the points are specified as percentages, changing the size of the Shape object changes the shape. The UseShapes form includes a Resize button that has this code in its Click method:

ThisForm.shpStar.Height = ThisForm.shpStar.Height/2
ThisForm.shpHexagon.Width = ThisForm.shpHexagon.Width+10
ThisForm.lblWow.Refresh()

Figure 2 shows the result the first time you click on the Resize button. (The label contains code that keeps it centered on the star.)

Shapes (and labels) have another new property, Rotation, that lets you change their orientation. Rotation accepts a value between 0 and 360. Rotation goes counterclockwise. The spinner on the UseShapes form controls the rotation of all three objects: the star, the label, and the hexagon. Figure 3 shows 45-degree rotation.

The Line object also has PolyPoints and Rotation properties in VFP 9, letting you create lines other than straight lines. In addition, the LineSlant property has been enhanced. Specify "S" to signify that the specified points should be connected with a curve (a Bézier curve) rather than a series of straight lines.

The ability to create shapes other than rectangles and circles, as well as to rotate the objects you create, opens the door to a lot of new possibilities in form design.




------------------
не имей 100 рублей, а имей сто друзей
Ratings: 0 negative/0 positive
Re: Новости FOXADVICER VFP9 про графику
piva
Автор

Сообщений: 18655
Откуда: Курган
Дата регистрации: 24.03.2004
Владимир так это все тутже и описывалось (Раздел VFP9) уже давненько именно про полигоны. Или я так криво прочитал чего тут по аглицки написано и не понял сути ?




------------------
Часто бывает так, что есть над чем задуматься, а нечем.
Ratings: 0 negative/0 positive
Re: Новости FOXADVICER VFP9 про графику
boba

Сообщений: 6269
Откуда: Медвежьи озера-
Дата регистрации: 26.03.2001
Я наверное проглядел это
До публикации сначала запустил поиск с этим самым полигоном ( как он написан в коде)
а он ничего и не дал,я и решил, что не публиковали
Сейчас снова повторил поиск , он только это пост и нашел . Странно однако




------------------
не имей 100 рублей, а имей сто друзей
Ratings: 0 negative/0 positive
Re: Новости FOXADVICER VFP9 про графику
piva
Автор

Сообщений: 18655
Откуда: Курган
Дата регистрации: 24.03.2004
Владимир - извиняюсь - (прямо продолжение темы "Страдаете ли вы склерозом" из Флейма )
Я сам помнил что писал, только оказалось в основном форуме - виноват что толкнул Вас на ошибочный путь. Я писалось это здесь
forum.foxclub.ru




------------------
Часто бывает так, что есть над чем задуматься, а нечем.
Ratings: 0 negative/0 positive


Извините, только зарегистрированные пользователи могут оставлять сообщения в этом форуме.

On-line: 22 shumik73  (Гостей: 21)

© 2000-2024 Fox Club 
Яндекс.Метрика