Canvas Backdrop in SQLite

From the Examples projects, I have used the Project “DatabasePictureTest”
I have make a in-memory database:

mDatabase = New SQLiteDatabase If mDatabase.Connect() Then mDatabase.SQLExecute("CREATE TABLE Drawing(id integer PRIMARY KEY, name text, pic blob)")

With different methods’ and parameter, I can draw a technical drawing in a PictureCanvas.
At the end, I like to have this picture in my database, but I can’t find a solution.
I have used the following code:

Dim rec As New DatabaseRecord rec.Column("name") = NameField.Text rec.PictureColumn("pic") = PictureCanvas.Backdrop mDatabase.InsertRecord("Drawing", rec)

What is drawn in the Paint event of a Canvas is not available in the Backdrop.

Perhaps you can draw directly to a picture and then draw the picture in the Paint event handler. Then you can use the picture to save to a DB as well.

Where can i find an example to draw direct in a picture and afterwards in to a Canvas and or database.
I don’t hav experience for that.
My picture (drawing) coms from a lot of different parameter and is made by two metodes, one for draw a lines and one for drawing circles. afterwards it should be stored in a SQLite DaraBase.

Create a new Picture and draw directly into its Graphics:

MyPicProperty = New Picture(400, 400, 32) MyPicProperty.Graphics.ForeColor = &cff0000 ' Red MyPicProperty.Graphics.DrawLine(0, 0, 400, 400)

In the Canvas.Paint event handler, draw your picture:

g.DrawPicture(MyPicProperty, 0, 0)

OK, it’s works.
But what means 32 in MyPicProperty = New Picture(400, 400, 32)
And 0,0 in g.DrawPicture(MyPicProperty, 0, 0)

Lookup Picture.Constructor in the Language Reference. 32 is the depth

Lookup Graphics.DrawPicture in the Language Reference. 0 , 0 are the x & y coordinates (Left & Top) of the picture within the graphics object.

[quote=225149:@Hans Riemers]But what means 32 in MyPicProperty = New Picture(400, 400, 32)
And 0,0 in g.DrawPicture(MyPicProperty, 0, 0)[/quote]
My reply has direct links to the part of the docs that answer these questions.

But now i a have the next problem, From the program code (started by a Button-Action) i draw the drawing by using a method what made the calculation form a dataBase for the drawing, this method used a other method to draw the different lines and shapes.
I have made a propertie with the name Drawing with the Type Picture.
In the Program a have writhe the code Dim Drawing As New Picture(Canvas1.width,canvas1.height ,32)
But in the Methodes i can not draw in this picture Drawing.

[quote=225445:@Hans Riemers]In the Program a have writhe the code Dim Drawing As New Picture(Canvas1.width,canvas1.height ,32)
But in the Methodes i can not draw in this picture Drawing.[/quote]
Variables you create with “Dim” are local to the method. It sounds like you need a Property instead, that would be accessible anywhere in the class.

You may want to review this part of the User Guide.