Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 158329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:39:44+00:00 2026-05-11T10:39:44+00:00

Is there any way in WinForms to emulate border-collapse from CSS? Imagine this: You

  • 0

Is there any way in WinForms to emulate border-collapse from CSS?

Imagine this: You have a Panel control with a border of FixedSingle, giving it a 1px black border, docked to the top of a form. You add a second Panel control with the same border and also docked to the top, in effect stacking that Panel underneath the first Panel. The problem is, where the bottom of the top Panel touches the top of the bottom Panel, the border is now 2px wide (bottom of top Panel (1px) + top of bottom Panel (1px) = 2px).

I have been messing with the Panel control properties, but I couldn’t see anything to have these touching edges overlap so there is only 1px of border between the Panels. Anyone have any ideas?

(I am using Visual Basic .NET 2008)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:39:45+00:00Added an answer on May 11, 2026 at 10:39 am

    Just create your own panel derived control. Fake the border by drawing it the way you want it. For example:

    using System; using System.Drawing; using System.Windows.Forms;  public class MyPanel : Panel {   public MyPanel() {     this.Dock = DockStyle.Top;     this.DoubleBuffered = true;     this.SetStyle(ControlStyles.ResizeRedraw, true);   }   protected override void OnPaintBackground(PaintEventArgs e) {     base.OnPaintBackground(e);     int y = this.ClientSize.Height - 1;     int x = this.ClientSize.Width-1;     e.Graphics.DrawLine(Pens.Black, 0, 0, 0, y);     e.Graphics.DrawLine(Pens.Black, 0, y, x, y);     e.Graphics.DrawLine(Pens.Black, x, 0, x, y);   } } 

    Add a new class to your project and paste the code show above. Compile. Drop the new control from the top of your toolbox onto your form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to add reference from one winforms to another winforms?? There
Is there any way to include font to a clickOnce installation of a winforms
Is there any way to change default font of controls in winforms. I must
Is there any way how to run the setup.exe bootstrapper generated by VS2008 with
Is there any way to cancel a RadioButton or CheckBox's change in state before
Is there any way to bind a tooltip to a datasource. Here is a
I am not worried about whether this is in Winforms or WPF. Is there
In Winforms, why is there no databound event on combobox as there is in
I've inherited a Winforms application that does a lot of long running calls into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.