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 9090855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:28:22+00:00 2026-06-16T22:28:22+00:00

In the software products I’m currently working on, we have several 3D View controls.

  • 0

In the software products I’m currently working on, we have several 3D View controls. Appeared the need to have overlay information on top of these 3D Views. I won’t go into too much background details, because it is not the point, but here are the constraints we face :

  • we must use two different 3D View controls
  • we don’t have the source code for them
  • they are embedded in Windows Forms controls, and all our own GUIs around these controls are in Windows Forms
  • we use .NET Framework 3.5SP1 and Windows 7

We want to be able to display various overlay informations and controls on top of these 3D views, because we usually demo our products by showing full screen 3D views on big screens, and not show our GUIs, which have the necessary information and controls.

Back in the days we used only one type of 3D view, I managed, via various hacks involving reflection, to hook my own overlay window system written in DirectX (based on WorldWind .NET overlay widgets, the 3D view was indeed based on WorldWind at the time). The next version of the 3D View product made huge changes to the rendering core code and of course made these hacks incompatible (yeah, I had it coming, I know :-)). Moreover, we are now using, because of different needs in other products, another type of 3D View, closed source as well.

I emphasize the fact that we don’t have the source code for them because we can’t have access to the rendering loop and therefore cannot hook a windowing system made for 3D Engines, such as CEGUI (search for it yourself, I’m not allowed to post much hyperlinks yet, sorry).

Consequently, I had the following idea : since our 3D Views are embedded in winforms controls, why don’t we code our overlay controls in plain winforms, and overlay it on top of the 3D views? The advantages of this solution are huge :

  • this would be compatible with both 3D Views, enabling us to reuse overlays across engines, if needed
  • we would be able to reuse custom controls or forms we already developed for the rest of the GUI. Indeed, it is a pretty big project, and we are beginning to have quite a library of such controls.

The only slight (!) problem is that we want to be able to manage overlay transluency, like I did with my former system in DirectX. We can’t afford fully opaque overlays, because it would clutter the view too much. Imagine something like a barely visible overlay, becoming more opaque when the mouse is hovering over it for example.

Windows offer the possibility to have child windows inside other windows or controls (Win32 API doesn’t really make a difference between windows and controls, this is pretty much a MFC/WinForms abstraction as I understood it), but since it is not top-level windows, we cannot adjust the transluency of these, so this is not something we can use. I saw here, that this is however possible on Windows 8, but switching to windows 8 is not possible anytime soon, because our software is deployed on quite a few machines, running 7.

So I started an intense googling session on how could I work around such a problem. It appears I must “enslave” top level windows to my 3D View controls. I already tried out something like that directly in winforms, having a form owned (not parented, there is a clear distinction, read about it in the previously linked MS page) by a control, and “following” its movements on screen. As expected, it kind of worked, but the issues are difficult to overcome. The most important is a clipping issue. If the parent form of the owner control changes its size, the overlay form is still shown in full. In my sample, I have a simple form with a menu, and a black panel containing a calendar (to show clipping differences between child controls and owned ones). I “enslaved” a borderless form containing a property grid to the black panel. It successfully follows the forms movements, but if I shrink the main form, I get this :

Clipping issue screenshot

Note how the calendar is clipped correctly (child window), and the overlay is not (owned window). I also get weird effects when minimizing/restoring the main form. Indeed, my overlay disappears when minimizing, but when restoring, it just “spawns” while the restoring animation of the main form is occuring. But this is less of an issue, and I guess can be worked around by handling proper events (but which ones?).

From what I understood, I must handle at least some of the clipping myself, using win32 API calls and hooks. I already begun to document myself, but it is quite complicated stuff. The Win32 API being a real mess, and myself being a former Unix developer introduced to Windows programming via the great .NET framework, I don’t have any real experience in Win32, and therefore don’t really know where to begin, and how to make myself a path in this jungle…

So if a winapi guru is passing by, or if someone has some other idea to achieve my goals given the constraints above, I’ll be glad to read about it 🙂

Thanks in advance, and apologies for being such a stackoverflow “leecher” by subscribing only to ask a question, but I don’t have no direct internet access on my workstation (yeah, for real, I have to go to a specific computer for this), so participating in this great community is not that easy for me.

Finally, here is my sample code (designer code available if you ask) :

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    Point _myLoc;

    private void formToolStripMenuItem_Click(object sender, EventArgs e)
    {
        var ctrl = new PropertyGrid();
        var obj = this.panel1;
        ctrl.SelectedObject = obj;
        var form = new Form();
        ctrl.Dock = DockStyle.Fill;
        form.Controls.Add(ctrl);
        form.Opacity = 0.7;
        var rect = obj.RectangleToScreen(obj.DisplayRectangle);
        form.StartPosition = FormStartPosition.Manual;
        form.Location = new Point(rect.Left + 10, rect.Top + 10);

        var parentForm = this;
        _myLoc = parentForm.Location;
        form.FormBorderStyle = FormBorderStyle.None;

        parentForm.LocationChanged += (s, ee) => {
            int deltaX = parentForm.Location.X - _myLoc.X;
            int deltaY = parentForm.Location.Y - _myLoc.Y;
            var loc = form.Location;
            form.Location = new Point(loc.X + deltaX, loc.Y + deltaY);
            _myLoc = parentForm.Location;
        };
        form.Show(this.panel1);
    }
}
  • 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-16T22:28:23+00:00Added an answer on June 16, 2026 at 10:28 pm

    Clipping can be easily implemented using Region property. Each window can have an associated Region object, which defines window rendering constraints:

    static void ManualClipping(Control clipRegionSource, Form formToClip)
    {
        var rect = clipRegionSource.DisplayRectangle;
        rect = clipRegionSource.RectangleToScreen(rect);
        rect = formToClip.RectangleToClient(rect);
        rect = Rectangle.Intersect(rect, formToClip.ClientRectangle);
        if(rect == formToClip.ClientRectangle)
        {
            formToClip.Region = null;
        }
        else
        {
            formToClip.Region = new Region(rect);
        }
    }
    

    usage:

    /* ... */
    parentForm.SizeChanged += (s, ee) => ManualClipping(panel1, form);
    form.Show(this.panel1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have multiple software products, each with a manual in 6 languages. We need
Our company develop several software products, which reuse each others packages (we use Java).
We have 3 software products which use the same .net dlls(code + legacy). All
I am working on a series of different software products. They are quite old,
I need your recommendations for continuous build products for a large (1-2MLOC) software development
We develop several products and already have extensive unit-tests and fully automated functional tests
I have a spreadsheet that contains a list of e.g software products, some products
I am working for a software company, which is currently thinking about cooperating with
I'm trying to determine the best way to have multiple software products built off
I am currently working on a specification for a software component which will synchronize

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.