Users Pricing

forum

Home Forums how to save a shape as bmp file – MindStick

how to save a shape as bmp file

Madhu Mitha 2480 27 Mar 2015
hi thr...

       I want to save three shape[rectangle] as a single bmp file.. is there option to save it..
my code is

Public Class Form1
    Dim bmp As New Bitmap(Me.Width, Me.Height)
    Private Sub PaintTheForm()
        Dim bmp As New Bitmap(Me.Width, Me.Height)
        Using g As Graphics = Graphics.FromImage(bmp)
            Dim blackPen As New Pen(Color.Black, 1)
            'to draw first rectangle rectangle
            Dim rect As New Rectangle(0, 0, 30, 16)
            g.DrawRectangle(Pens.Black, rect)
            'to draw second rectangle
            Dim rect1 As New Rectangle(30, 0, 114, 8)
            g.DrawRectangle(Pens.Black, rect1)
            'to draw thrid rectangle
            Dim rect2 As New Rectangle(30, 8, 114, 8)
            g.DrawRectangle(Pens.Black, rect2)
            ' To type text
            Dim big_font As New Font("Comic Sans MS", 12, FontStyle.Bold, GraphicsUnit.Pixel)
            g.TextRenderingHint = Drawing.Text.TextRenderingHint.SingleBitPerPixel
            g.DrawString("helo", big_font, Brushes.Black, 0, 0)
            g.Dispose()
            ' End Sub
            Me.BackgroundImage = bmp
        End Using
    End Sub
    Private Sub btnPaint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPaint.Click
        PaintTheForm()
    End Sub
    Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
        SaveFileDialog1.FileName = ""
        If SaveFileDialog1.ShowDialog <> 1 Then Exit Sub
        Try
            Select Case SaveFileDialog1.FilterIndex
                Case 1
                    bmp.Save(SaveFileDialog1.FileName, Imaging.ImageFormat.Bmp)
                Case 2
            End Select
        Catch
            MsgBox("Can not save the LED image!", 48, "LED Saving")
        End Try
    End Sub
End Class

when I tried to save this I could not save the three rectangle box... so can anyone help in solving my problem


thanks


1 Answers

Anonymous User 30 Mar 2015 Accepted Answer
Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md