Franz Heyn

Franz Heyn

  • 1.7k
  • 24
  • 1.3k

how do I use Graphics.DrawLine with Panel-Controls

May 20 2024 3:27 PM

sorry, but I didn't find a better way to describe the problem I have with my small application.

well, it's like this (I'm using WinForms, Visual Studio 10):

the main window has a menuestrip and a panel, called DevicePanel (using Dock.Fill)

the DevicePanel holds other panels (ItemPanels) of equal size, where size depends on the number of ItemPanels.

the maximum number of ItemPanels is 16 and they are arranged in rows of maximum 4 per row.

if there exist more then 4 ItemPanels, I want to draw a horizontal line between each row.

in the ItemPanel PaintEvent I check the panels index and if it's the last panel,

I draw the line(s), using the DevicePanels Graphics context. However this does not work.

I also tried drawing the line(s) in the main windows ShownEvent, but this too doesn't work.

so my question is how and where do I draw the lines? Be free to ask for addiational information.

for your answers many thanks in advance


Answers (2)