Click here to Skip to main content
15,892,072 members
Home / Discussions / C#
   

C#

 
GeneralRe: Data format for non-computerist editing Pin
trønderen23-Dec-20 8:10
trønderen23-Dec-20 8:10 
GeneralRe: Data format for non-computerist editing Pin
OriginalGriff23-Dec-20 19:44
mveOriginalGriff23-Dec-20 19:44 
GeneralRe: Data format for non-computerist editing Pin
trønderen24-Dec-20 9:44
trønderen24-Dec-20 9:44 
AnswerRe: Data format for non-computerist editing Pin
Gerry Schmitz23-Dec-20 6:46
mveGerry Schmitz23-Dec-20 6:46 
AnswerRe: Data format for non-computerist editing Pin
Mycroft Holmes23-Dec-20 11:14
professionalMycroft Holmes23-Dec-20 11:14 
AnswerRe: Data format for non-computerist editing Pin
jschell29-Dec-20 6:54
jschell29-Dec-20 6:54 
QuestionHow to address SQL CE file path? Pin
Alex Dunlop22-Dec-20 7:46
Alex Dunlop22-Dec-20 7:46 
AnswerRe: How to address SQL CE file path? Pin
OriginalGriff22-Dec-20 8:45
mveOriginalGriff22-Dec-20 8:45 
QuestionWhy does NullReferenceException throw irrelevantly? I already tried - no success. Pin
Jens Eckervogt22-Dec-20 0:18
Jens Eckervogt22-Dec-20 0:18 
AnswerRe: Why does NullReferenceException throw irrelevantly? I already tried - no success. Pin
Richard MacCutchan22-Dec-20 1:06
mveRichard MacCutchan22-Dec-20 1:06 
AnswerRe: Why does NullReferenceException throw irrelevantly? I already tried - no success. Pin
OriginalGriff22-Dec-20 1:12
mveOriginalGriff22-Dec-20 1:12 
AnswerRe: Why does NullReferenceException throw irrelevantly? I already tried - no success. Pin
Gerry Schmitz22-Dec-20 3:33
mveGerry Schmitz22-Dec-20 3:33 
SuggestionSQLLight vs SQL CE Pin
Alex Dunlop20-Dec-20 8:16
Alex Dunlop20-Dec-20 8:16 
GeneralRe: SQLLight vs SQL CE Pin
Gerry Schmitz20-Dec-20 9:19
mveGerry Schmitz20-Dec-20 9:19 
GeneralRe: SQLLight vs SQL CE Pin
Mycroft Holmes20-Dec-20 11:15
professionalMycroft Holmes20-Dec-20 11:15 
QuestionHow to save panel content into PDF Pin
RedPandinus19-Dec-20 17:46
RedPandinus19-Dec-20 17:46 
AnswerRe: How to save panel content into PDF Pin
OriginalGriff19-Dec-20 19:57
mveOriginalGriff19-Dec-20 19:57 
SuggestionRe: How to save panel content into PDF Pin
RedPandinus19-Dec-20 20:30
RedPandinus19-Dec-20 20:30 
GeneralRe: How to save panel content into PDF Pin
OriginalGriff19-Dec-20 22:57
mveOriginalGriff19-Dec-20 22:57 
First off, you are creating objects which use significantly scarce resources, and so require Disposal or you app will crash with "out of memory" errors pretty quickly.
You are responsible for all Graphics objects you create, and all Images - and the Garbage collector will not get called in to dispose of them if you run out of handles for example.

Reworking your code to do that:
C#
using (Image bmp = new Bitmap(panel1.Width, panel1.Height))
    {
    using (Graphics gg = Graphics.FromImage(bmp))
        {
        Rectangle rect = panel1.RectangleToScreen(panel1.ClientRectangle);
        gg.CopyFromScreen(rect.Location, Point.Empty, panel1.Size);
        bmp.Save(@"D:\Temp\AAATest.jpg", ImageFormat.Jpeg);
        using (Graphics g = panel1.CreateGraphics())
            {
            g.Clear(Color.White);
            }
        }
    }
And trying it gives me the panel itself, the whole panel, and no other image content.

So what am I doing that you aren't?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

GeneralRe: How to save panel content into PDF Pin
RedPandinus20-Dec-20 6:07
RedPandinus20-Dec-20 6:07 
GeneralAForge Motion Detection from PictureBox? Pin
Herboren19-Dec-20 17:15
Herboren19-Dec-20 17:15 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Gerry Schmitz19-Dec-20 21:51
mveGerry Schmitz19-Dec-20 21:51 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Herboren20-Dec-20 6:09
Herboren20-Dec-20 6:09 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Gerry Schmitz20-Dec-20 9:30
mveGerry Schmitz20-Dec-20 9:30 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Herboren20-Dec-20 12:47
Herboren20-Dec-20 12:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.