Hello, I am making a custom control which will serve as a "timeline". An integrated timer moves a line along the control to display where the time is currently. I am inheriting a Panel control for the timeline. When I draw my line, it constantly appears below the controls in the panel. I would like the line to be visible above all of the controls in the panel. Is this possible?
Thanks in advance

Try increasing the z-index or just BringToFront on the control if you want it at the top level.

The problem is, I am drawing a thin rectangle for the timeline location. I am overriding the OnPaint method of the panel to draw this rectangle at its current location. It has not z-position or BringToFront command. If I made the controls go all the way to the back, would the graphics be drawn in the front? Thanks again

Your rectangle is always drawn on the background, the "canvas" of your Panel. Then the other controls are drawn. Just make sure you place them in a position they don't interfere with your rectangle.

I would really like the rectangle to move in front of the controls though. Imagine an audio editor where a lines be along in front of your waveform to tell you what the current play location is. I am trying to so the same thing only with a timeline.

You could let a Panel instead of a rectangle, move over your controls, but I also would like to see a screenshot of what you actualy mean.

Hi, had same problem, solved it by using a label as a line. The label can be put on top of the other controls and it's position can be changed with the timer.

In response to both of your suggestions
fe8d7bcc18378d6a1580838cbb62437f
The above picture is a rough example of what is happening. I would like the green line to always appear on top of the controls in the panel as it moves (is redrawn) over time.
I will try to replace a simple reactangle with a label or panel to see if I can get it to work.

Ok, it seems that using a thin panel with a green background allows it to appear on top. Thanks for all the help.

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.