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

  • Home
  • SEARCH
  • 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 8331231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:21:06+00:00 2026-06-09T02:21:06+00:00

I have designed a Form to use as a Template for printing. It is

  • 0

I have designed a Form to use as a Template for printing. It is designed to fill the form, so I have to take into account the Page Margins before drawing them.

My current issue is trying to get the System.Windows.Forms.Panel controls to shift over by the amount specified by the System.Drawing.Printing.Margins.

private static void MarginShift(Control ctrl, Margins m) {
  Label lbl = ctrl as Label;
  if (lbl != null) {
    lbl.Location = new Point(lbl.Location.X + m.Left, lbl.Location.Y + m.Top);
  } else {
    Panel pnl = ctrl as Panel;
    if (pnl != null) {
      int x = pnl.Location.X;
      int y = pnl.Location.Y;
      pnl.Location = new Point(x + m.Left, y + m.Top);
      if ((pnl.Location.X == x) && (pnl.Location.Y == y) &&
          ((0 < m.Left) || (0 < m.Top))) {
        Console.WriteLine("WTF?");
      }
      foreach (Control c2 in pnl.Controls) {
        MarginShift(c2, m);
      }
    }
  }
}

My little Console output gets hit for every Panel that I pass from my Template Form.

Microsoft’s documentation of the Panel control says this of the Location value:

Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.

So, why does shifting a Panel using the Margins not move the Location?

What do I need to do to correct this?

  • 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. Editorial Team
    Editorial Team
    2026-06-09T02:21:09+00:00Added an answer on June 9, 2026 at 2:21 am

    Never mind. Panels were docked to the form.

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

Sidebar

Related Questions

I have designed one sign-up form,in this form after getting all necessary values I
I have designed a page in Fireworks then imported it to Dreamweaver in CSS
I have designed a tabbed page. I'm able to load forms in the tabs
I have designed a custom section handler before but I'm faced with a problem
The Setup I have designed a very easy to use MVC wizard. The cherry
I have an windows form application written in C# in which I use a
I have a PHP script designed to answer a users question. Currently I use
I am creating a form designer and have a toolbox that contains images of
I have been tasked to create a form designer application in Windows Forms. The
I have looked at the generated designer code of Form s and UserControl s,

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.