CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Sep 2003
    Posts
    1

    Draw graphics outside client-area?

    Hi

    I have a panel (with auto-scroll = true) that I make dynamic drawings in. When I draw something inside the size of the panel everything is fine. But if something is drawn outside of the panel-size the scrolling doesn´t show. The scroll only shows if I draw (e.g. make visible and set a location) some windows-form-control (e.g. LinkedLabel) outside the area. But then the drawn image that should be outside the area isn´t there when I scroll. And when I scroll back the image that was there before now is gone...

    I understand that it has to be some problem about how I update the image but I haven´t been able to fix it. I want to "draw" a big drawing and then be able to scroll around to see the whole picture.

    I make all my drawings in Paint-events, is this wrong? It´s a regular windows application. How should I solve this problem?

    Thanks in advance.
    /Tobbe

    (Sorry for my bad english...)


    Example on my problem (only importent code):

    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Panel panel1;
    private System.Windows.Forms.LinkLabel linkLabel1;
    public Form1()
    {
    InitializeComponent();
    this.linkLabel1.Location = new System.Drawing.Point(1500, 150);
    }
    static void Main()
    {
    Application.Run(new Form1());
    }

    private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
    e.Graphics.DrawLine(new Pen(Brushes.Black, 2.0f),20,20,1500,250);
    }
    Last edited by d98tp; September 22nd, 2003 at 05:42 AM.

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

Featured