combobox 如何載入系統的style |
尚未結案
|
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
ComboBox1 的 Item 的值分別為 circle / triangle / downtriangle / cross / diagcross
不過圓形的部份畫得真醜, 自己調整座標值看看.
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var cs: TCanvas; iTextWidth: integer; R: TRect; begin R := Rect; cs := TComboBox(Control).Canvas; cs.FillRect(R); cs.Font.Color := clBlack; cs.TextOut(R.Left, R.Top, TComboBox(Control).Items[Index]); // 畫出字 iTextWidth := cs.TextWidth(TComboBox(Control).Items[Index]); // 取得畫出的字的寬度值, 待會要畫線時, 要畫在這個寬度之後 cs.Pen.Color := clBlack; cs.Pen.Style := psSolid; case Index of 0: cs.Ellipse(R.Left iTextWidth 6, R.Top 3, R.Left iTextWidth 12, R.Bottom - 3); // circle 1:begin // triangle cs.MoveTo(R.Left iTextWidth 6, R.Top 2); // 第一條線 / cs.LineTo(R.Left iTextWidth, R.Bottom - 2); cs.MoveTo(R.Left iTextWidth 6, R.Top 2); // 第一條線 cs.LineTo(R.Left iTextWidth 12, R.Bottom - 2); cs.MoveTo(R.Left iTextWidth, R.Bottom - 2); // 第三條線 _ cs.LineTo(R.Left iTextWidth 12, R.Bottom - 2); end; 2:begin // downtriangle cs.MoveTo(R.Left iTextWidth 6, R.Bottom - 2); // 第一條線 / cs.LineTo(R.Left iTextWidth, R.Top 2); cs.MoveTo(R.Left iTextWidth 6, R.Bottom - 2); // 第一條線 cs.LineTo(R.Left iTextWidth 12, R.Top 2); cs.MoveTo(R.Left iTextWidth, R.Top 2); // 第三條線 _ cs.LineTo(R.Left iTextWidth 12, R.Top 2); end; 3:begin // cross cs.MoveTo(R.Left iTextWidth, R.Top (R.Bottom - R.Top) div 2); // 第一條線 | cs.LineTo(R.Left iTextWidth 12, R.Top (R.Bottom - R.Top) div 2); cs.MoveTo(R.Left iTextWidth 6, R.Top); // 第一條線 | cs.LineTo(R.Left iTextWidth 6, R.Bottom); end; 4:begin // diagcross cs.MoveTo(R.Left iTextWidth, R.Top 2); // 第一條線 cs.LineTo(R.Left iTextWidth 12, R.Bottom - 2); cs.MoveTo(R.Left iTextWidth, R.Bottom - 2); // 第一條線 / cs.LineTo(R.Left iTextWidth 12, R.Top 2); end; end; cs.FrameRect(R); end;發表人 - hagar 於 2004/05/21 09:42:48 |
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
StrongLemon
高階會員 發表:10 回覆:166 積分:105 註冊:2004-04-18 發送簡訊給我 |
引言: 畫出來的圓形或三角形 如何由○ △變成 ● ▲使用Polygon多邊形 Delphi-Help->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. 範例如下 procedure TForm1.Button1Click(Sender: TObject); begin Image1.Canvas.Brush.Color := clBlack;// Image1.Canvas.Brush.Style:=bsSolid;// Image1.Canvas.Polygon([Point(10, 10), Point(30, 10), Point(130, 30), Point(240, 120)]); end; |
StrongLemon
高階會員 發表:10 回覆:166 積分:105 註冊:2004-04-18 發送簡訊給我 |
引言: Chart的點 除了直接設值給它(Pseries.point.style=pscircle)之外 有沒有像 線條一樣有 TpenStyle(index)可以給值?TLineSeries-Event OnGetPointerStyle Description This event is triggered when TeeChart Series Points are drawn. It may be used to modify the PointerStyle of individual points. 範例如下 Series1.ColorEachPoint:=True; function TForm1.Series1GetPointerStyle(Sender: TChartSeries; ValueIndex: Integer): TSeriesPointerStyle; begin if ValueIndex=1 then begin Series1.ValueColor[ValueIndex]:=clBlack; Result:=psCircle; end else if ValueIndex=2 then begin Series1.ValueColor[ValueIndex]:=clBlue; Result:=psTriangle; end; end; |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |