Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
GeneralRe: starting and stopping the sql server programaticaly Pin
DaveyM6914-Feb-08 23:25
professionalDaveyM6914-Feb-08 23:25 
QuestionRe: starting and stopping the sql server programaticaly Pin
Sonia Gupta14-Feb-08 23:31
Sonia Gupta14-Feb-08 23:31 
AnswerRe: starting and stopping the sql server programaticaly Pin
Martin#14-Feb-08 23:44
Martin#14-Feb-08 23:44 
GeneralRe: starting and stopping the sql server programaticaly Pin
Sonia Gupta14-Feb-08 23:56
Sonia Gupta14-Feb-08 23:56 
GeneralRe: starting and stopping the sql server programaticaly Pin
Martin#14-Feb-08 23:59
Martin#14-Feb-08 23:59 
GeneralRe: starting and stopping the sql server programaticaly Pin
Mike Dimmick15-Feb-08 0:38
Mike Dimmick15-Feb-08 0:38 
QuestionHow to draw line on stretched image in picturebox control Pin
swapck14-Feb-08 19:23
swapck14-Feb-08 19:23 
AnswerRe: How to draw line on stretched image in picturebox control Pin
Martin#14-Feb-08 21:35
Martin#14-Feb-08 21:35 
Hello,

If you are painting on the pictureBox Graphics object, the "SizeMode" should not make any difference.

In this test project I placed a PictureBox on a Form handelt the Events:
MouseDown
MouseMove
MouseLeave
MouseUp
Paint
bool downok = false;
bool draw = false;
bool end = false;
Point startPoint = Point.Empty;
Point endPoint = Point.Empty;
Pen linePen = new Pen(Color.Red);

private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
    draw= false;
    downok = true;
    end = false;
    startPoint = new Point(e.X,e.Y);
}

private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
    if(!end)
    {
        if(downok)
        {
            draw = true;
            downok = false;
        }
        endPoint = new Point(e.X,e.Y);
        pictureBox1.Invalidate();
    }
}

private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
    if(!end)
    {
        endPoint = new Point(e.X,e.Y);
        pictureBox1.Invalidate();
        end = true;
    }
}

private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
{
    if(!end)
    {
        pictureBox1.Invalidate();
        end = true;
    }
}

private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
    if(draw)
    {
        e.Graphics.DrawLine(linePen,startPoint, endPoint);
    }
}

protected override void Dispose( bool disposing )
{
    if( disposing )
    {
        if (components != null)
        {
            components.Dispose();
        }

        if(linePen!=null)
        {
            linePen.Dispose();
            linePen=null;
        }
    }
    base.Dispose( disposing );
}


All the best,

Martin

GeneralRe: How to draw line on stretched image in picturebox control Pin
Christian Graus14-Feb-08 21:48
protectorChristian Graus14-Feb-08 21:48 
General"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond".Exception please Help.. Pin
ag4667714-Feb-08 19:04
ag4667714-Feb-08 19:04 
GeneralRe: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond".Exception please Help.. Pin
Mircea Puiu14-Feb-08 21:55
Mircea Puiu14-Feb-08 21:55 
QuestionHow to fix the column of the Listview Pin
klaydze14-Feb-08 18:50
klaydze14-Feb-08 18:50 
AnswerRe: How to fix the column of the Listview Pin
Giorgi Dalakishvili14-Feb-08 20:32
mentorGiorgi Dalakishvili14-Feb-08 20:32 
GeneralDatetime picker Pin
new2pgrmg14-Feb-08 18:26
new2pgrmg14-Feb-08 18:26 
GeneralRe: Datetime picker Pin
Mircea Puiu14-Feb-08 21:51
Mircea Puiu14-Feb-08 21:51 
GeneralRe: Datetime picker Pin
new2pgrmg14-Feb-08 23:34
new2pgrmg14-Feb-08 23:34 
Generalplaying audio through your microphone Pin
Roger Nomoore14-Feb-08 18:11
Roger Nomoore14-Feb-08 18:11 
GeneralRe: playing audio through your microphone Pin
Christian Graus14-Feb-08 18:19
protectorChristian Graus14-Feb-08 18:19 
GeneralTransparent TextBox Pin
kumar.bs14-Feb-08 18:00
kumar.bs14-Feb-08 18:00 
GeneralRe: Transparent TextBox Pin
Christian Graus14-Feb-08 18:18
protectorChristian Graus14-Feb-08 18:18 
JokeWhen you know it's time to go to bed... Pin
Malcolm Smart14-Feb-08 17:54
Malcolm Smart14-Feb-08 17:54 
GeneralRe: When you know it's time to go to bed... Pin
Pete O'Hanlon14-Feb-08 23:44
mvePete O'Hanlon14-Feb-08 23:44 
GeneralAccess Share folder in c# Pin
mimimimilaw14-Feb-08 15:50
mimimimilaw14-Feb-08 15:50 
GeneralRe: Access Share folder in c# Pin
Ennis Ray Lynch, Jr.14-Feb-08 16:06
Ennis Ray Lynch, Jr.14-Feb-08 16:06 
GeneralDynamically refreshing a running assembly Pin
Skippums14-Feb-08 15:34
Skippums14-Feb-08 15:34 

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.