?
Solved

How to draw a top line on a panel.

Posted on 2011-09-28
4
Medium Priority
?
282 Views
Last Modified: 2013-12-17
Hi,

I would like to draw a line on the top edge of a panel.
I quess I need the onpain-event of the panel for that.
But I don't know how! And the line must have the color
"#c2c4cb".

Who knows the answer and is willing to help me?

Greetings, Peter Kiers
0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:James Atkin
ID: 36716158
You need to add the Paint Event to the Panel using the Events Tab in its Properties

Then just add something like this in the Paint Handler...

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            Pen p = new Pen(new SolidBrush(Color.FromArgb(0xC2, 0xC4, 0xCB)));
            e.Graphics.DrawLine(p, 1, 1, 100, 1);
        }

Hope this helps...
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36716191
It does not draw the whole line on the top edge of the panel.

Peter
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36716215
I have change:

e.Graphics.Drawline(p, 1, 1, 176, 1);

Now the line is as wide a the panel width.

But when I resize the panel the line stays the same!!!
0
 
LVL 4

Accepted Solution

by:
James Atkin earned 2000 total points
ID: 36716221
Just change the "176" to panel1.width
or whatever your panel is called
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

752 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