HelloWorld.vb
C# VB
'''' This code is part of Document Solutions for Imaging demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.IOImports System.DrawingImports GrapeCity.Documents.DrawingImports GrapeCity.Documents.TextImports GrapeCity.Documents.ImagingImports GCTEXT = GrapeCity.Documents.Text
'' A simple program drawing the "Hello, World!" text'' on a background filled with a radial gradient.Public Class HelloWorld Function GenerateImage( ByVal pixelSize As Size, ByVal dpi As Single, ByVal opaque As Boolean, Optional ByVal sampleParams As String() = Nothing) As GcBitmap
Dim blue = Color.FromArgb(&HFF2E4884) Dim bmp = New GcBitmap(pixelSize.Width, pixelSize.Height, True, dpi, dpi) Using g = bmp.CreateGraphics(blue) Dim rc = New RectangleF(0, 0, pixelSize.Width, pixelSize.Height) Dim b = New RadialGradientBrush(Color.White, blue, New PointF(0.5F, 0.5F), True) g.FillRectangle(rc, b) Dim tf = New TextFormat With { .Font = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "FreeSerifBold.ttf")), .FontSize = 64, .ForeColor = Color.OrangeRed } g.DrawString("Hello, World!", tf, rc, TextAlignment.Center, ParagraphAlignment.Center, False) End Using ' Done Return bmp End FunctionEnd Class