Здравствуйте, TheOldMen, Вы писали:
TOM>Здравствуйте, Аноним, Вы писали:
А>>Имеется такой код
А>>А>> void __fastcall TFrameComboBoxTreeView::PaintBoxButtonPaint(TObject *Sender)
А>> {
А>> PaintBoxButton->Canvas->MoveTo(5,5); // По идее в этом месте должна передвинутся
А>> // начало координат для рисования, но толи глюк то ли
А>> // я, чего не правильно делаю,
А>> // в PaintBoxButton->Canvas->PenPos = (5,5).
А>> // Хотя чертить начинает с координат(0,0)
А>> // соответсвенно и возвращается туды :((
А>> TPoint points[3];
А>> points[0].x = 5;
А>> points[0].y = 5;
А>> points[1].x = PaintBoxButton->Canvas->ClipRect.Width() - 5;
А>> points[1].y = 5;
А>> points[2].x = PaintBoxButton->Canvas->ClipRect.Width() / 2;
А>> points[2].y = PaintBoxButton->Canvas->ClipRect.Height() - 5;
А>> PaintBoxButton->Canvas->Polygon(points,3);
А>> }
А>>
TOM>Нет, это не глюк! Дело в том, что PaintBoxButton->Canvas->MoveTo(5,5); перемещает точку рисования в [5,5], а не передвигает начало координат. После чего, если ты можеш вызвать PaintBoxButton->Canvas->LineTo(15,15); и таким образом нарисуется линия от [5,5] до [15,15]. В твоем случае надо в аргументах points указывать что точку надо брать со смещением, например: points[0+смещение].x = 5;
Подождите!!!
PaintBoxButton->Canvas->Polygon(points,3);
Судя по Help рисует замкнутый полигон, первый параметр указатель на массив TPoint, второ количество элементов в массиве. Если я буду использовать смещение как вы говорите ... то получится какая то ерунда. Не инитциализируются первые элементы массива.
Draws a series of lines on the canvas connecting the points passed in and closing the shape by drawing a line from the last point to the first point.
void __fastcall Polygon(const Windows::TPoint * Points, const int Points_Size);
Description
Use Polygon to draw a closed, many-sided shape on the canvas, using the value of Pen. After drawing the complete shape, Polygon fills the shape using the value of Brush.
The Points parameter is an array of points that give the vertices of the polygon.
The Points_Size parameter is the index of the last point in the array (one less than the total number of points).
To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.