标题:在表格中怎么加斜线??????????
只看楼主
Lusgoo
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-8-8
 问题点数:0 回复次数:1 
在表格中怎么加斜线??????????
[local]1[/local]
想将图中的第一行,第一列第二列加个斜线,上面写通道下面写项目,该怎么改???????
程序代码:
unit uJynyResultView;

interface
uses
  uJynyParam,
  SysUtils,
  Windows,
  uZdxDataType,
  GDIPAPI,
  GDIPOBJ;
const
  CLR_BACKGROUND = $FFFFFFFF; //背景色
  CLR_FRAM = $FF03776E; // $FFD8E9EC;//
  CLR_RESULT_HG  = $FF008000;
  CLR_RESULT_BHG = $FFFF0000;
type
  ///一次对地 二次对地 一次对二次等
  TjynyTestValues_Recf = array[Tjyny_test_mode] of TGPRectF;
  ///十二个通道的
  TchannelTestValues_recf = array[0..STAS_NUM - 1] of TjynyTestValues_Recf;

  TJynyResultView = class(TObject)

  private
    GPGraphics: TGPGraphics;
    fJynyParam: TjynyTestParam;
    clientRecF: TGPRectF;
    fFramPen: TGPPen;
    fGridPen: TGPPen;
    fdivH, fdivW: Single;
    frefSize: TGPSizeF;
    framBrush: TGPSolidBrush;
    fhgBrush,fbhgBrush: TGPSolidBrush;
    fontTopTitle: TGPFont;
    fontLeftMode: TGPFont;
    fontLeftType: TGPFont;
    fontResult: TGPFont;
    fCenterFormat: TGPStringFormat;

    fJys_Recf,fNys_Recf: TchannelTestValues_recf;
    ftopTitle: array[0..STAS_NUM - 1] of TGPRectF;
    fModeYcdd_jy,fModeEcdd_jy,fModeYcdrc_jy: TGPRectF;
    fModeYcdd_ny,fModeEcdd_ny,fModeYcdrc_ny: TGPRectF;
    ftype_jy,ftype_ny: TGPRectF;
    fcaption : TGPRectF;
    procedure drawFram();
    procedure drawGrid();
    procedure initRecf();
    procedure drawTopChannelTitle();
    procedure drawLeftMode();
    procedure drawLeftType();
    procedure drawResult();
  public
    constructor Create;
    destructor Destroy; override;
    procedure reDraw(pam: TjynyTestParam; g: TGPGraphics; r: TGPRectF);
  end;
implementation

constructor TJynyResultView.Create;
var  fontFamily: TGPFontFamily;
begin
  inherited;
  fFramPen := TGPPen.Create(CLR_FRAM, 2);
  fGridPen := TGPPen.Create(CLR_FRAM, 1);
  framBrush:= TGPSolidBrush.Create(CLR_FRAM);
  fhgBrush:= TGPSolidBrush.Create(CLR_RESULT_HG);
  fbhgBrush:= TGPSolidBrush.Create(CLR_RESULT_BHG);

  fontFamily:= TGPFontFamily.Create;
  fontTopTitle:=TGPFont.Create('Arial Black',18,FontStyleBold, UnitPixel);
  fontLeftMode:=TGPFont.Create('Arial Black',14,FontStyleBold, UnitPixel);
  fontLeftType:=TGPFont.Create('Arial Black',18,FontStyleBold, UnitPixel);
  fontFamily.Free;
  fontResult:= TGPFont.Create('Arial Black',12,FontStyleBold, UnitPixel);


  fCenterFormat:= TGPStringFormat.Create;
  fCenterFormat.SetAlignment(StringAlignmentCenter);     {设置左右对齐方式}
  fCenterFormat.SetLineAlignment(StringAlignmentCenter); {设置垂直对齐方式}
end;

destructor TJynyResultView.Destroy;
begin
  inherited;
  fFramPen.Free;
  fGridPen.Free;
  framBrush.Free;
  fhgBrush.Free;
  fbhgBrush.Free;
  fCenterFormat.free;
  fontTopTitle.Free;
  fontLeftMode.Free;
  fontLeftType.Free;
  fontResult.free;
end;

procedure TJynyResultView.drawFram;

begin
  GPGraphics.DrawRectangle(fFramPen, clientRecF);
end;

procedure TJynyResultView.drawGrid;
var
  i: Integer;
  x, x1, y: Single;
begin
  //竖线
  with GPGraphics do
  begin
    x := clientRecF.X;
    y := clientRecF.Y + clientRecF.Height;
    for i := 0 to STAS_NUM do
    begin
      x := x + fdivW;
      if i>1 then
      DrawLine(fGridPen, x, clientRecF.Y, x, y) else
      DrawLine(fFramPen, x, clientRecF.Y, x, y);
    end;
    //横线
    x := clientRecF.X + clientRecF.Width;
    x1 := clientRecF.X + fdivW;
    y := clientRecF.Y + fdivH;
    DrawLine(fFramPen, clientRecF.X, y, x, y);
    y := Y + fdivH;
    DrawLine(fGridPen, x1, y, x, y);
    y := Y + fdivH;
    DrawLine(fGridPen, x1, y, x, y);
    y := Y + fdivH;
    DrawLine(fFramPen, clientRecF.X, y, x, y);
    y := Y + fdivH;
    DrawLine(fGridPen, x1, y, x, y);
    y := Y + fdivH;
    DrawLine(fGridPen, x1, y, x, y);
      y := Y + fdivH;
    DrawLine(fGridPen, clientRecF.X, y, x, y);
  end;
end;

procedure TJynyResultView.drawLeftMode;
begin
  GPGraphics.DrawString('一次对地',-1, fontLeftMode,fModeYcdd_jy,fCenterFormat,framBrush);
  GPGraphics.DrawString('二次对地',-1, fontLeftMode,fModeecdd_jy,fCenterFormat,framBrush);
  GPGraphics.DrawString('一次对二次',-1, fontLeftMode,fModeYcdrc_jy,fCenterFormat,framBrush);
  GPGraphics.DrawString('一次对地',-1, fontLeftMode,fModeYcdd_ny,fCenterFormat,framBrush);
  GPGraphics.DrawString('二次对地',-1, fontLeftMode,fModeecdd_ny,fCenterFormat,framBrush);
  GPGraphics.DrawString('一次对二次',-1, fontLeftMode,fModeYcdrc_ny,fCenterFormat,framBrush);

end;

procedure TJynyResultView.drawLeftType;
var str:string;
begin
  str:= ''+char(10)+''+char(10)+''+char(10)+'';

 GPGraphics.DrawString(str,-1, fontLeftType,ftype_jy,fCenterFormat,framBrush);

 str:= ''+char(10)+''+char(10)+''+char(10)+'';

 GPGraphics.DrawString(str,-1, fontLeftType,ftype_ny,fCenterFormat,framBrush);
end;

procedure TJynyResultView.drawResult;
var i: Integer;
    j: Tjyny_test_mode;
procedure drawRtest(v:TJynyValue;r:TGPRectF);
begin
  if v.jcjg <> HGQJC_BHG then
   GPGraphics.DrawString(v.jcValue,-1, fontResult,r,fCenterFormat,fhgBrush)
  else
   GPGraphics.DrawString(v.jcValue,-1, fontResult,r,fCenterFormat,fbhgBrush);
end;
begin
  for i:=0 to STAS_NUM-1 do
  begin
    for j:=Low(Tjyny_test_mode) to High(Tjyny_test_mode) do
    begin
      //显示绝缘耐压
      drawRtest(fJynyParam.testResult.ChTestResults[i][j].jyTestValue,fJys_Recf[i][j]);
      drawRtest(fJynyParam.testResult.ChTestResults[i][j].nyTestValue,fnys_Recf[i][j]);
     end;
  end;
  //

 with fJynyParam.testResult do

 GPGraphics.DrawString(Format('电压%sV 总电流%smA 耐压时间%sS',[nyzResult,zdlResult,nysjResult]),-1, fontTopTitle,fcaption,fCenterFormat,fhgBrush);
end;

procedure TJynyResultView.drawTopChannelTitle;
var i:Integer;
begin
  for i:=0 to STAS_NUM-1 do
  GPGraphics.DrawString(Format('%.2d',[i+1]),-1, fontTopTitle,ftopTitle[i],fCenterFormat,framBrush);
end;

procedure TJynyResultView.initRecf;
var x,y,y1,h: Single;
    i: Integer;
    j: Tjyny_test_mode;
    gsize:TGPSizeF;
begin
  x:=clientRecF.Width - fdivW;
  y1:=clientRecF.Y + fdivH;
  h:= fdivH * 3;
  for i:=0 to STAS_NUM-1 do
  begin
    //上部通道
    y:=y1;
    ftopTitle[i]:=MakeRect(MakePoint(x,clientRecF.Y), frefSize);
    for j:=Low(Tjyny_test_mode) to High(Tjyny_test_mode) do
    begin
      //显示绝缘耐压
      fJys_Recf[i][j]:= MakeRect(MakePoint(x,y), frefSize);
      fNys_Recf[i][j]:= MakeRect(MakePoint(x,y+h), frefSize);
      y:=y + fdivH;
    end;
    x:= x-fdivw;
  end;

 x:=clientRecF.x + fdivW;

 y:=y1;

 fModeYcdd_jy:=MakeRect(MakePoint(x,y), frefSize);

 y:= y + fdivH;

 fModeEcdd_jy:=MakeRect(MakePoint(x,y), frefSize);

 y:= y + fdivH;

 fModeYcdrc_jy:=MakeRect(MakePoint(x,y), frefSize);
  y:= y + fdivH;

 fmodeYcdd_ny:=MakeRect(MakePoint(x,y), frefSize);
  y:= y + fdivH;

 fModeEcdd_ny:=MakeRect(MakePoint(x,y), frefSize);
  y:= y + fdivH;

 fModeYcdrc_ny:=MakeRect(MakePoint(x,y), frefSize);

 //绝缘和耐压

 x:=clientRecF.x;

 y:=y1;

 gsize:=MakeSize(fdivW,fdivH*3);

 ftype_jy:= MakeRect(MakePoint(x,y),gsize);

 y:=y + gsize.Height;

 ftype_ny:= MakeRect(MakePoint(x,y),gsize);

 y:=y + gsize.Height;

 fcaption:= MakeRect(MakePoint(x,y),MakeSize(clientRecF.Width,fdivH));
end;

procedure TJynyResultView.reDraw(pam: TjynyTestParam; g: TGPGraphics; r:
  TGPRectF);
begin
  GPGraphics := g;
  fJynyParam := pam;
  clientRecF := r;

  fdivH := r.Height / 8;
  fdivW := r.Width / 14;

 
  frefSize.Width:=fdivW;
  frefSize.Height :=fdivH;
  initRecf;
  drawFram;
  clientRecF.Height:= clientRecF.Height- fdivH;
  drawGrid;
  drawTopChannelTitle;
  drawLeftMode;
  drawLeftType;
  drawResult;
end;

end.
搜索更多相关主题的帖子: 表格 项目 Windows 背景色 通道 
2012-08-08 10:39
Lusgoo
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-8-8
得分:0 
2012-08-08 10:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-374911-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.307195 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved