Saving picture to SQL (PictureBox) GDI Error
-
Luc Pattyn wrote:
I avoid PictureBoxes, they tend to cause more trouble than what they are worth.
like ? I never got any problem with PB. I use BackgroundImage instead.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
Hi, I paint my images myself, typically onto a Panel. That avoids problems such as: - I want my pictures to preserve aspect ratio while being rescaled - I want to select pixels with the mouse, even when the image has been rescaled - I want to be able to draw a rubber band, even when the image has been rescaled etc. All of these are either impossible or much harder than they deserve to be when using a PB. The one thing I would consider using it for is for displaying an animated image (multiTIFF and the like). :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
I tend to paint it myself on a Panel. Also see reply below. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
Hi, I paint my images myself, typically onto a Panel. That avoids problems such as: - I want my pictures to preserve aspect ratio while being rescaled - I want to select pixels with the mouse, even when the image has been rescaled - I want to be able to draw a rubber band, even when the image has been rescaled etc. All of these are either impossible or much harder than they deserve to be when using a PB. The one thing I would consider using it for is for displaying an animated image (multiTIFF and the like). :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
well, If you're a pro programmer then you should use the appropriate control. PB is for pictures and panel for containing other controls. Am I wrong...? All the operations you're doing with Panel can be done with PB but since Panel is more powerful in itself, its not good to compare with PB. Its like byte(PB) and int(Panel).
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
-
well, If you're a pro programmer then you should use the appropriate control. PB is for pictures and panel for containing other controls. Am I wrong...? All the operations you're doing with Panel can be done with PB but since Panel is more powerful in itself, its not good to compare with PB. Its like byte(PB) and int(Panel).
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
I agree with both of you. I am not a Pro Programmer (yet :-) lol), but I see the advantages of both. One, I know how to use a picturebox (well I thougth I did before this issue, but it seems to be a little bug), and I do not know how to paint pictures at ALL. I would like to learn it, and I think I might try the panel way to just test it out. Not really sure where to begin so I will google painting image on panel
-
I agree with both of you. I am not a Pro Programmer (yet :-) lol), but I see the advantages of both. One, I know how to use a picturebox (well I thougth I did before this issue, but it seems to be a little bug), and I do not know how to paint pictures at ALL. I would like to learn it, and I think I might try the panel way to just test it out. Not really sure where to begin so I will google painting image on panel
Hi, there are lots of articles that demonstrate how to paint things. My Sokoban article is a simple example, the playing board actually is a Panel. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
well, If you're a pro programmer then you should use the appropriate control. PB is for pictures and panel for containing other controls. Am I wrong...? All the operations you're doing with Panel can be done with PB but since Panel is more powerful in itself, its not good to compare with PB. Its like byte(PB) and int(Panel).
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
Xmen wrote:
you should use the appropriate control.
Yes, when available.
Xmen wrote:
PB is for pictures and panel for containing other controls.
A PB can hold other controls as well. So it is doing (or trying to do) more than what a Panel does. When not containing other Controls, a Panel is just like a piece of canvas, ideal for painting and drawing whatever you want. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
Hi, there are lots of articles that demonstrate how to paint things. My Sokoban article is a simple example, the playing board actually is a Panel. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
Luc Pattyn wrote:
My Sokoban article is a simple example
nice work man, you got ma 5 ;)
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
-
Hi, there are lots of articles that demonstrate how to paint things. My Sokoban article is a simple example, the playing board actually is a Panel. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
Xmen wrote:
you should use the appropriate control.
Yes, when available.
Xmen wrote:
PB is for pictures and panel for containing other controls.
A PB can hold other controls as well. So it is doing (or trying to do) more than what a Panel does. When not containing other Controls, a Panel is just like a piece of canvas, ideal for painting and drawing whatever you want. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
Luc Pattyn wrote:
A PB can hold other controls as well.
aye aye but not like panel...you have to add programmatically.
Luc Pattyn wrote:
When not containing other Controls, a Panel is just like a piece of canvas, ideal for painting and drawing whatever you want.
aha but no support for gif ;) but no worries, this is end of discussion
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
-
Now I take it you can not only write an image to a panel, but you can retrieve an image from it?
simple drawing method Draw image and set it to global variable. Then in OnPaint() draw that image. In this way, you can have image anytime. But if you just want to set a single image from file or stream, I'll suggest you to use BackgoundImage property. No coding required. Plus you can use styles, Tiles, Center, Zoom...etc
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
-
Now I take it you can not only write an image to a panel, but you can retrieve an image from it?
Hi Jacob, first of all, if you have code to paint/draw something (that is a "Paint handler" which is called automatically with a "Graphics" parameter), you have all the information and the same code could be used to draw onto another Graphics object, e.g. one you obtain from Bitmap.CreateGraphics(). Furthermore there is a Control.DrawToBitmap() method available for all Controls, it creates a bitmap showing the Control the way it looks on screen. Since a Panel does not draw anything by itself, Panel.DrawToBitmap() paints your own content to the bitmap, which is quite handy. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
Hi Jacob, first of all, if you have code to paint/draw something (that is a "Paint handler" which is called automatically with a "Graphics" parameter), you have all the information and the same code could be used to draw onto another Graphics object, e.g. one you obtain from Bitmap.CreateGraphics(). Furthermore there is a Control.DrawToBitmap() method available for all Controls, it creates a bitmap showing the Control the way it looks on screen. Since a Panel does not draw anything by itself, Panel.DrawToBitmap() paints your own content to the bitmap, which is quite handy. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets