Click here to Skip to main content
15,904,415 members
Home / Discussions / C#
   

C#

 
GeneralRe: Data format for non-computerist editing Pin
trønderen23-Dec-20 8:24
trønderen23-Dec-20 8:24 
GeneralRe: Data format for non-computerist editing Pin
BillWoodruff23-Dec-20 8:42
professionalBillWoodruff23-Dec-20 8:42 
GeneralRe: Data format for non-computerist editing Pin
OriginalGriff22-Dec-20 22:07
mveOriginalGriff22-Dec-20 22:07 
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 
GeneralRe: How to save panel content into PDF Pin
RedPandinus20-Dec-20 6:07
RedPandinus20-Dec-20 6:07 
Thank you , I tried your code there but I still cant see just panel area.

Below is the whole code, anything wrong or missed here?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;

namespace panel
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        float PointX = 0;
        float PointY = 0;

        float LastX = 0;
        float LastY = 0;

        private void Form1_Load(object sender, EventArgs e)
        {
 
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            Graphics G = panel1.CreateGraphics();
            G.DrawLine(Pens.Black, PointX, PointY, LastX, LastY);
            LastX = PointX;
            LastY = PointY;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            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(@"AAATest.jpg", ImageFormat.Jpeg);
                    using (Graphics g = panel1.CreateGraphics())
                    {
                        g.Clear(Color.White);
                    }
                }
            }
        }
        private void panel1_MouseDown_1(object sender, MouseEventArgs e)
        {
            LastX = e.X;
            LastY = e.Y;

        }

        private void panel1_MouseMove_1(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                PointX = e.X;
                PointY = e.Y;
                panel1_Paint(this, null);

            }
        }
    
    }

}


StartPosition is centerscreen if it matters and autoscalemode is DPI.

modified 21-Dec-20 15:09pm.

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 

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.