?
Solved

Draw a top line on a panel.

Posted on 2011-10-13
3
Medium Priority
?
293 Views
Last Modified: 2013-12-16
Hi,

I have put the code for drawing a borderline around a panel in the code-section.
But now I need to know how to draw just a line on the top side of the panel.
And I would like to know how to draw just a line on the left side of the panel.

Who knows the answer?

Peter
private void StickyNotes_Paint(object sender, PaintEventArgs e)
         {
            using (Pen pen = new Pen(Brushes.Silver, 2))
            {
                e.Graphics.DrawRectangle(pen, this.ClientRectangle);
            }
         }

Open in new window

0
Comment
Question by:peterkiers
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
dbrckovi earned 2000 total points
ID: 36962435
Hi.

This should do the job:

         e.Graphics.DrawLine(Pens.Blue, panel1.ClientRectangle.Left, panel1.ClientRectangle.Top, panel1.ClientRectangle.Width, panel1.ClientRectangle.Top);
         e.Graphics.DrawLine(Pens.Red, 0, 0, 0, panel1.ClientRectangle.Height - 1);

Open in new window

0
 
LVL 1

Author Comment

by:peterkiers
ID: 36962514
I will test this tonight.

Peter
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36962820
It works. Thanx.

Peter
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question