problems with size of exported bitmap image

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Lars Iversen
Newbie
Newbie
Posts: 61
Joined: Wed Jun 22, 2005 4:00 am
Location: cph

problems with size of exported bitmap image

Post by Lars Iversen » Thu Jan 08, 2009 1:29 pm

Hi

I'm trying to export my graph to file by using this code in VB net 2005:

Dim MyBmpFile As Steema.TeeChart.Export.BitmapFormat = Tchart1.Export.Image.Bitmap
MyBmpFile.Save(strSavePath)

The strange thing is that tchart1 has a size of 800*320 and the myBmpFile variable ends up having a size of 1467*840 and so does the final image

Is there any other way to control the size of the final output so I get a bmp that is 800*320?

thanks in advance
Lars Iversen

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jan 08, 2009 2:11 pm

Hi Lars,

Yes, you have several options. They are very similar:

1.

Code: Select all

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        InitializeChart()
    End Sub

    Private Sub InitializeChart()
        Me.TChart1.Width = 800
        Me.TChart1.Height = 320

        Dim strSavePath As String = "C:\\temp\\vbnet.bmp"
        Dim MyBmpFile As Steema.TeeChart.Export.BitmapFormat = TChart1.Export.Image.Bitmap
        MyBmpFile.Width = Me.TChart1.Width
        MyBmpFile.Height = Me.TChart1.Height
        MyBmpFile.Save(strSavePath)
    End Sub
2.

Code: Select all

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        InitializeChart()
    End Sub

    Private Sub InitializeChart()
        Me.TChart1.Width = 800
        Me.TChart1.Height = 320

        Dim strSavePath As String = "C:\\temp\\vbnet.bmp"

        TChart1.Export.Image.Bitmap.Width = Me.TChart1.Width
        TChart1.Export.Image.Bitmap.Height = Me.TChart1.Height
        TChart1.Export.Image.Bitmap.Save(strSavePath)
    End Sub
3.

Code: Select all

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        InitializeChart()
    End Sub

    Private Sub InitializeChart()
        Me.TChart1.Width = 800
        Me.TChart1.Height = 320

        Dim strSavePath As String = "C:\\temp\\vbnet.bmp"

        Dim bmp As Bitmap = TChart1.Bitmap()
        bmp.Save(strSavePath)
    End Sub
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply