tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
1
ZUGRIFFE
3656
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    MC_Straßenköter MC_Straßenköter ist offline Mitglied Bronze
    Registriert seit
    May 2005
    Beiträge
    33
    Hallo!

    Ich habe folgendes Problem:
    Per Paint-EventHandler will ich über die Funktion DrawBezier eine Kurve in eine PictureBox zeichnen. Leider erscheint die Kurve nicht in meiner PictureBox! Was ich mache falsch?

    [CODE]

    //...
    private void InitializeComponent()
    {
    this.pictureBox1 = new System.Windows.Forms.PictureBox();
    this.SuspendLayout();
    //
    // pictureBox1
    //
    this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlLightLight;
    this.pictureBox1.Location = new System.Drawing.Point(64, 48);
    this.pictureBox1.Name = "pictureBox1";
    this.pictureBox1.Size = new System.Drawing.Size(160, 152);
    this.pictureBox1.TabIndex = 0;
    this.pictureBox1.TabStop = false;
    this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.Paint_picBox);
    //
    // Form1
    //
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    this.ClientSize = new System.Drawing.Size(264, 246);
    this.Controls.Add(this.pictureBox1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Form1_Load);
    this.ResumeLayout(false);

    }

    //...

    private void Paint_picBox(object sender, System.Windows.Forms.PaintEventArgs pe)
    {
    Pen blackPen = new Pen(Color.Black,1);

    float freq_StartX = 48.0F;
    float freq_StartY = 200.0F;

    float dB1_X = 150.0F;
    float dB1_Y = 134.0F;

    float dB2_X = 170.0F;
    float dB2_Y = 154.0F;

    float freq_StopX = 360.0F;
    float freq_StopY = 200.0F;

    pe.Graphics.DrawBezier(blackPen,freq_StartX,freq_StartY,dB1_X,dB1_Y,dB2_X,dB2_Y,freq_StopX,freq_Stop Y);
    }

    }

    Danke für Hilfe

    MfG
    MC
     

  2. #2
    C-H C-H ist offline Mitglied Brokat
    Registriert seit
    Jan 2005
    Beiträge
    256
    Hallo!


    Du musst auf die Picturebox malen. Dazu dieser Code:

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
     
    ' Get handle to pictureBox1.
     
    Dim hwnd As New IntPtr()
     
    hwnd = pictureBox1
     
    ' Create new graphics object using handle to window.
     
    Dim newGraphics As Graphics = Graphics.FromHwnd(hwnd)
     
    ' Draw rectangle to screen.
     
    newGraphics.DrawRectangle(New Pen(Color.Red, 3), 0, 0, 200, 100)
     
    ' Dispose of new graphics.
     
    newGraphics.Dispose()

    Weitere Infos zum zeichnen findest du in der msdn-Library im Bereich System.Drawing-Namespace in der .NET-Framework-Referenz.
     

Ähnliche Themen

  1. Lebensdauer F-Kurve?
    Von clueless_t im Forum Cinema 4D
    Antworten: 1
    Letzter Beitrag: 01.04.09, 16:19
  2. Anfängerfrage: Auf eine PictureBox zeichnen? Wie?
    Von u918244 im Forum .NET Grafik und Sound
    Antworten: 6
    Letzter Beitrag: 06.05.08, 18:35
  3. [VB.Net] Kurve?
    Von oyla12 im Forum .NET Grafik und Sound
    Antworten: 3
    Letzter Beitrag: 19.05.07, 14:55
  4. pictureBox auf PictureBox oder Label
    Von shn im Forum .NET Windows Forms
    Antworten: 1
    Letzter Beitrag: 31.08.05, 16:37
  5. PictureBox über PictureBox
    Von JK_net im Forum .NET Archiv
    Antworten: 1
    Letzter Beitrag: 14.03.05, 09:03