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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:45:03+00:00 2026-05-10T17:45:03+00:00

I want to draw DirectX content so that it appears to be floating over

  • 0

I want to draw DirectX content so that it appears to be floating over top of the desktop and any other applications that are running. I also need to be able to make the directx content semi-transparent, so other things show through. Is there a way of doing this?

I am using Managed DX with C#.

  • 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-10T17:45:04+00:00Added an answer on May 10, 2026 at 5:45 pm

    I found a solution which works on Vista, starting from the link provided by OregonGhost. This is the basic process, in C# syntax. This code is in a class inheriting from Form. It doesn’t seem to work if in a UserControl:

    //this will allow you to import the necessary functions from the .dll using System.Runtime.InteropServices;  //this imports the function used to extend the transparent window border. [DllImport('dwmapi.dll')] static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);  //this is used to specify the boundaries of the transparent area internal struct Margins {     public int Left, Right, Top, Bottom; } private Margins marg;  //Do this every time the form is resized. It causes the window to be made transparent. marg.Left = 0; marg.Top = 0; marg.Right = this.Width; marg.Bottom = this.Height; DwmExtendFrameIntoClientArea(this.Handle, ref marg);  //This initializes the DirectX device. It needs to be done once. //The alpha channel in the backbuffer is critical. PresentParameters presentParameters = new PresentParameters(); presentParameters.Windowed = true; presentParameters.SwapEffect = SwapEffect.Discard; presentParameters.BackBufferFormat = Format.A8R8G8B8;  Device device = new Device(0, DeviceType.Hardware, this.Handle, CreateFlags.HardwareVertexProcessing, presentParameters);  //the OnPaint functions maked the background transparent by drawing black on it. //For whatever reason this results in transparency. protected override void OnPaint(PaintEventArgs e) {     Graphics g = e.Graphics;      // black brush for Alpha transparency     SolidBrush blackBrush = new SolidBrush(Color.Black);     g.FillRectangle(blackBrush, 0, 0, Width, Height);     blackBrush.Dispose();      //call your DirectX rendering function here }  //this is the dx rendering function. The Argb clearing function is important, //as it makes the directx background transparent. protected void dxrendering() {     device.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 0, 0), 1.0f, 0);      device.BeginScene();     //draw stuff here.     device.EndScene();     device.Present(); } 

    Lastly, a Form with default setting will have a glassy looking partially transparent background. Set the FormBorderStyle to ‘none’ and it will be 100% transparent with only your content floating above everything.

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

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You'll need VSTO for it to be less of a… May 11, 2026 at 1:59 pm
  • added an answer Expression Engine is amazing, and there is tons of support… May 11, 2026 at 1:59 pm
  • added an answer It's more in the line of C++ folklore, hand micro-optimizations… May 11, 2026 at 1:59 pm

Related Questions

I want to draw a shadow around a thumbnail in my software. It seems
I want to draw a HBITMAP onto HDC, I used StretchDIBits. It works fine.
Let's say I want to draw a simple quad like this: glBegin(GL_QUADS); glVertex2f(-1.0,-1.0); glVertex2f(1.0,-1.0);
Using Python I want to be able to draw text at different angles using
I need to knock out a quick animation in C#/Windows Forms for a Halloween
I want to draw spinner controls, such as those found on a NumericUpDown, on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.