hi,
i drew a line which fit in the output form when it is in minimized state. but when the it is maximized line remain the same height but the window expand. i want that the line and window expand and shrink in same ratio.
i hope i made u understand the problem.

It is not clear to me what you are doing with this line and how you want it to expand and shrink. Can you provide the code with comments, or some images that represent the desired outcome?

don't know how you draw your line but the way you want it you have to draw your line relative to the ClientRectangle of your form.

Where in your code are you drawing the line? If you want the line to persist through changes in teh client, you could draw it in an overridden Paint() method on the form. If you use thew ClientRectangle as ddanbe suggested it will always be drawn relative to your forms size.

public Form1()
        {
            InitializeComponent();
            this.SizeChanged +=new EventHandler(Form1_SizeChanged);     
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            Point lineStart = new Point(this.ClientRectangle.Left, this.ClientRectangle.Height / 2);
            Point lineEnd = new Point(this.ClientRectangle.Left + this.ClientRectangle.Width, this.ClientRectangle.Height / 2);
            e.Graphics.DrawLine(new Pen(Brushes.Black), lineStart, lineEnd);
        }

        private void Form1_SizeChanged(object sender, EventArgs e)
        {
            this.Invalidate();
        }

This draws a line across the middle of the form. Any time the form is resized this.Invalidate causes a full repaint. The reason i include this is that when a user drags to resize the form will sometimes only repaint the newly revealed portion. This ensures the whole form repaints :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.