Results 1 to 2 of 2

Thread: paint graphics on panel with menuitem1.click

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    2

    paint graphics on panel with menuitem1.click

    I want to paint some lines and fonts on a panel, but I want it to paint when I click on a menuitem, have tried the code below, but it paints when I open the form. I dont want it to paint untill I call the sub with my MenuItem3.click.

    Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
    'here is the code for lines and fonts
    end sub

    Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
    Panel1_Paint() ' calling the sub to paint the panel
    End Sub

    have heard you can use a sub "panel1.refresh()" or something like that, but I dont know how it works.
    someone have an example code or can explain for me?? please!

    thanks!

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    On the Menuitem click event try this:
    VB Code:
    1. Dim G As Graphics=Panel1.CreateGraphics
    Then you can draw to "G".
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width