1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
    "Version":"6.8.5.0",
    "Title":"7-3b.脚本.部件框自定义绘制",
    "Author":"锐浪报表软件",
    "Description":"演示部件框的自定义绘制功能\r\n\r\n将部件框的“自绘”属性设为“是”,部件框将成为自绘部件框,其绘制输出将用用户自己通过调用 IGRGraphics 接口的方法来实现。绘制实现有两种方式;其一是在部件框的“绘制脚本”中写报表脚本实现;其二是响应报表的“ControlCustomDraw”事件写程序代码实现。\r\n\r\n调用部件框的“DrawDefault”方法可以将其本身绘出。\r\n",
    "Font":{
        "Name":"宋体",
        "Size":105000,
        "Weight":400,
        "Charset":134
    },
    "ConnectionString":"Provider=Microsoft.Jet.OLEDB.4.0;\r\nUser ID=Admin;\r\nData Source=C:\\Grid++Report 6\\Samples\\Data\\Northwind.mdb",
    "Printer":{
        "Oriention":"Landscape"
    },
    "ReportHeader":[
        {
            "Name":"ReportHeader1",
            "Height":8.81062,
            "Control":[
                {
                    "Type":"StaticBox",
                    "Name":"StaticBox1",
                    "Left":0.608542,
                    "Top":0.211667,
                    "Width":5.82083,
                    "Height":1.19063,
                    "WordWrap":true,
                    "Text":"下面图案通过报表脚本代码绘出,在预览视图或查询视图可以看到运行结果:"
                },
                {
                    "Type":"StaticBox",
                    "Name":"sbScriptDraw",
                    "Left":0.608542,
                    "Top":1.5875,
                    "Width":5.79438,
                    "Height":3.59833,
                    "CustomDraw":true,
                    "CustomDrawScript":"var Graphics = Report.Graphics,\r\n    x = Graphics.Left,\r\n    y = Graphics.Top,\r\n    width = Graphics.Width,\r\n    height = Graphics.Height,\r\n\r\n    PartSize = height/3,\r\n    DrawLeft = x + (width - PartSize)/2,\r\n    DrawRight = DrawLeft + PartSize,\r\n    DrawXCenter = (DrawLeft + DrawRight)/2,\r\n\r\n    DrawTop = y,\r\n    DrawBottom = y + height;\r\n\r\n\r\n\r\nfunction GetColorValue(r,g,b)\r\n{\r\n   return Report.Utility.ColorFromRGB(r, g , b);\r\n}\r\n\r\n//设定绘出线型\r\nGraphics.SelectPen(2, GetColorValue(255, 0, 0), 0/*grpsSolid*/);\r\n\r\n//设定填充色\r\nGraphics.SelectFillColor( GetColorValue(0, 255, 255) );\r\n\r\n//画箭头两边斜线\r\nGraphics.MoveTo(DrawLeft, DrawTop+PartSize);\r\nGraphics.LineTo(DrawXCenter, DrawTop);\r\nGraphics.LineTo(DrawRight, DrawTop+PartSize);\r\n\r\n//画箭头竖线\r\nGraphics.MoveTo(DrawXCenter, DrawTop);\r\nGraphics.LineTo(DrawXCenter, DrawTop+PartSize*2);\r\n\r\n//画出圆圈\r\nGraphics.Ellipse(DrawLeft, DrawTop+PartSize*2, PartSize, PartSize, true);\r\n\r\n//恢复填充色设定,SelectFillColor调用之后,必须对应调用RestoreFillColor\r\nGraphics.RestoreFillColor();\r\n\r\n//恢复绘出线型设定,SelectPen调用之后,必须对应调用RestorePen\r\nGraphics.RestorePen();\r\n",
                    "Border":{
                        "Styles":"[DrawLeft|DrawTop|DrawRight|DrawBottom]"
                    },
                    "Text":"StaticBox2"
                },
                {
                    "Type":"StaticBox",
                    "Name":"StaticBox3",
                    "Left":14.8167,
                    "Top":0.238125,
                    "Width":5.79438,
                    "Height":1.19063,
                    "WordWrap":true,
                    "Text":"下面图案通过报表的自绘事件在程序代码中实现,运行例子“Advance\\CustomDraw”查看运行结果:"
                },
                {
                    "Type":"StaticBox",
                    "Name":"sbEventDraw",
                    "Left":14.8167,
                    "Top":1.61396,
                    "Width":5.79438,
                    "Height":3.59833,
                    "CustomDraw":true,
                    "Border":{
                        "Styles":"[DrawLeft|DrawTop|DrawRight|DrawBottom]"
                    },
                    "Text":"StaticBox2"
                },
                {
                    "Type":"StaticBox",
                    "Name":"StaticBox4",
                    "Left":7.77875,
                    "Top":0.185208,
                    "Width":5.82083,
                    "Height":1.19063,
                    "WordWrap":true,
                    "Text":"调用部件框的\"DrawDefault\"方法进行默认绘制,然后再输出一个椭圆:"
                },
                {
                    "Type":"StaticBox",
                    "Name":"sbScriptDefaultDraw",
                    "Left":7.77875,
                    "Top":1.56104,
                    "Width":5.79438,
                    "Height":3.59833,
                    "CustomDraw":true,
                    "CustomDrawScript":"var Graphics = Report.Graphics,\r\n    x = Graphics.Left,\r\n    y = Graphics.Top,\r\n    width = Graphics.Width,\r\n    height = Graphics.Height;\r\n\r\nfunction GetColorValue(r,g,b)\r\n{\r\n   return Report.Utility.ColorFromRGB(r, g , b);\r\n}\r\n\r\n//默认绘制\r\nSender.DrawDefault();\r\n\r\n//设定绘出线型\r\nGraphics.SelectPen(2, GetColorValue(255, 0, 0), 0/*grpsSolid*/);\r\n\r\n//画出圆圈\r\nGraphics.Ellipse(x, y, width , height, false);\r\n\r\n//恢复绘出线型设定,SelectPen调用之后,必须对应调用RestorePen\r\nGraphics.RestorePen();\r\n",
                    "Font":{
                        "Name":"宋体",
                        "Size":157500,
                        "Bold":true,
                        "Charset":134
                    },
                    "TextAlign":"MiddleCenter",
                    "Text":"默认绘制文字"
                }
            ]
        }
    ]
}