全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:8212
推到 Plurk!
推到 Facebook!
[<<] [1] [2] [>>]

combobox 如何載入系統的style

尚未結案
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#32 引用回覆 回覆 發表時間:2004-05-21 09:03:20 IP:221.169.xxx.xxx 未訂閱
再問一個問題啦 就是 我要個別畫出下列圖形 圓形 正三角形 倒三角形 十字線 叉線 然後,我的item是先放 circle triangle downtriangle cross diagcross combobox的item會將個別item 塞入 接下來 用drawitem事件 要一個一個對應圖形到這些item combobox內是要如何對應呢?
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#33 引用回覆 回覆 發表時間:2004-05-21 09:37:21 IP:202.39.xxx.xxx 未訂閱
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

發送簡訊給我
#34 引用回覆 回覆 發表時間:2004-05-21 09:51:34 IP:221.169.xxx.xxx 未訂閱
Thanks Very Much
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#35 引用回覆 回覆 發表時間:2004-05-21 10:06:15 IP:221.169.xxx.xxx 未訂閱
圖形在前面 字 在後面 要改哪裡呢?
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#36 引用回覆 回覆 發表時間:2004-05-21 10:12:34 IP:221.169.xxx.xxx 未訂閱
畫出來的圓形或三角形 如何由○ △變成 ● ▲
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#37 引用回覆 回覆 發表時間:2004-05-21 10:40:43 IP:221.169.xxx.xxx 未訂閱
Chart的點 除了直接設值給它(Pseries.point.style=pscircle)之外 有沒有像 線條一樣有 TpenStyle(index)可以給值?
StrongLemon
高階會員


發表:10
回覆:166
積分:105
註冊:2004-04-18

發送簡訊給我
#38 引用回覆 回覆 發表時間:2004-05-24 13:56:30 IP:221.169.xxx.xxx 未訂閱
引言: 畫出來的圓形或三角形 如何由○ △變成 ● ▲
使用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

發送簡訊給我
#39 引用回覆 回覆 發表時間:2004-05-24 14:02:36 IP:221.169.xxx.xxx 未訂閱
引言: 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] [>>]
系統時間:2024-04-27 4:16:14
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!