Range("A1:C3").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
ActiveSheet.Shapes.AddLine(0#, 1.5, 81#, 42.75).Select
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Item("Line 1").Left = 0#
Selection.ShapeRange.Item("Line 1").Width = 81.75
Selection.ShapeRange.Item("Line 1").Top = 0.75
Selection.ShapeRange.Item("Line 1").Height = 42#
ActiveSheet.Shapes.AddLine(83.25, 3#, 164.25, 42#).Select
Range("D3").Select
ActiveSheet.Shapes("Line 2").Select
Range("A1:C3").Select
ActiveSheet.Shapes("Line 2").Select
Selection.ShapeRange.Item("Line 2").Left = 78.75
Selection.ShapeRange.Item("Line 2").Width = 85.5
Selection.ShapeRange.Item("Line 2").Top = 0#
Selection.ShapeRange.Item("Line 2").Height = 42#
Range("A1:C3").Select
ActiveSheet.Shapes.AddLine(55.5, 13.5, 109.5, 42#).Select
Selection.ShapeRange.Flip msoFlipVertical
Range("A1:C3").Select
ActiveSheet.Shapes("Line 3").Select
Selection.ShapeRange.Item("Line 3").Left = 55.5
Selection.ShapeRange.Item("Line 3").Width = 52.5
Range("A1:C3").Select
ActiveSheet.Shapes.AddLine(109.5, 27#, 135#, 41.25).Select
Selection.ShapeRange.Flip msoFlipVertical
Range("C6").Select
ActiveSheet.Shapes.AddLine(52.5, 15#, 108.75, 40.5).Select
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical
Range("A1:C3").Select
ActiveSheet.Shapes.AddLine(22.5, 29.25, 52.5, 43.5).Select
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical
Range("A1:C3").Select
End Sub
在excel中先合并3行3列的单元格,用绘图工具画了一列斜线和对应的反斜线。
在delphi中如何表达?紧急求助,谢谢!
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
ActiveSheet.Shapes.AddLine(0#, 1.5, 81#, 42.75).Select
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Item("Line 1").Left = 0#
Selection.ShapeRange.Item("Line 1").Width = 81.75
Selection.ShapeRange.Item("Line 1").Top = 0.75
Selection.ShapeRange.Item("Line 1").Height = 42#
ActiveSheet.Shapes.AddLine(83.25, 3#, 164.25, 42#).Select
Range("D3").Select
ActiveSheet.Shapes("Line 2").Select
Range("A1:C3").Select
ActiveSheet.Shapes("Line 2").Select
Selection.ShapeRange.Item("Line 2").Left = 78.75
Selection.ShapeRange.Item("Line 2").Width = 85.5
Selection.ShapeRange.Item("Line 2").Top = 0#
Selection.ShapeRange.Item("Line 2").Height = 42#
Range("A1:C3").Select
ActiveSheet.Shapes.AddLine(55.5, 13.5, 109.5, 42#).Select
Selection.ShapeRange.Flip msoFlipVertical
Range("A1:C3").Select
ActiveSheet.Shapes("Line 3").Select
Selection.ShapeRange.Item("Line 3").Left = 55.5
Selection.ShapeRange.Item("Line 3").Width = 52.5
Range("A1:C3").Select
ActiveSheet.Shapes.AddLine(109.5, 27#, 135#, 41.25).Select
Selection.ShapeRange.Flip msoFlipVertical
Range("C6").Select
ActiveSheet.Shapes.AddLine(52.5, 15#, 108.75, 40.5).Select
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical
Range("A1:C3").Select
ActiveSheet.Shapes.AddLine(22.5, 29.25, 52.5, 43.5).Select
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical
Range("A1:C3").Select
End Sub
在excel中先合并3行3列的单元格,用绘图工具画了一列斜线和对应的反斜线。
在delphi中如何表达?紧急求助,谢谢!
解决方案 »
- 求个查询语句
- listbox怎么更改某一项item的显示顺序?见图
- 如何获取WebBrowse 网页上的控件坐标
- 一个关于汇编的问题,,,大家进来看看,,进者有分.....
- InstallShield 打包如何出现unistall?
- 关于mscomm的问题
- 请问一个报表中可以同时用两个sub detail吗
- 当打开多个窗体时,如何实现每一窗体在WINDOWS任务栏都显示,象EXCEL那样
- 初学DELPHI2个月写的一个咚咚!
- 怎样通过socket传输图像?
- 在QReport里,我用一张大小50K的JPG或BMP图片做背景,图片放在QRImage里,为什么只有开始两页有背景图而后面的就没有呢?
- 新手提问 怎么用delphi备份和恢复压缩数据库
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ComObj, StdCtrls, Buttons;type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);
var
eclApp:Variant;
begin
try
eclApp:= CreateOleObject('Excel.Application');
except
messagebox(handle,'您的机器里可能未安装Microsoft Excel或异常','无法生成',MB_OK or MB_ICONWARNING);
Exit;
end;
try
eclApp.visible:=true;
eclApp.WorkBooks.Open( 'c:\aaa.xls');
eclApp.ActiveSheet.Range['a1:c3'].Merge;
eclApp.ActiveSheet.Range[ 'a1:c3' ].Borders[5].Weight := 3;
eclApp.ActiveSheet.Range[ 'a1:c3' ].Borders[6].Weight := 3;
finally
eclApp:= Unassigned;
end;没看你的宏,就看了你的说明,好像符合你的要求。end;end.
Columns("B:B").ColumnWidth = 2.5
Columns("C:C").ColumnWidth = 2.5
Columns("D:D").ColumnWidth = 2.5
Columns("E:E").ColumnWidth = 2.5
Columns("F:F").ColumnWidth = 2.5
Range("C1,B2,A3").Select
Range("A3").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Range("D1,E2,F3").Select
Range("F3").Activate
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Range("C3,D2").Select
Range("D2").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Range("E3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Range("D3,C2").Select
Range("C2").Activate
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Range("B3").Select
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Range("G11").Select
End Sub
以上是想通过excel单元格边框来画斜线,我想这样出来的直线会比直接用绘图工具画出的斜线效果好,只是不知道如何用delphi编写