Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Transperent window

Transperent window

Scheduled Pinned Locked Moved C#
questiontutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NaNg15241
    wrote on last edited by
    #1

    Hello, I want to do a Windows Form that doesn't have a close (X) and minimize (_) buttons as it normally have, it wan't it costum, or an image that I'll supply, OR that there will not be a control box AND no border, and inside the form I will supply an image with everything, but if I'll choose this, how will I be able to drag the window? In anyways, the image inside is rounded and I don't know how to make the edges to be transperent, and not white\any-other-color. (If someone know what is Steam, I'm talking about something like that.) Thanks in advance... NaNg

    R L 3 Replies Last reply
    0
    • N NaNg15241

      Hello, I want to do a Windows Form that doesn't have a close (X) and minimize (_) buttons as it normally have, it wan't it costum, or an image that I'll supply, OR that there will not be a control box AND no border, and inside the form I will supply an image with everything, but if I'll choose this, how will I be able to drag the window? In anyways, the image inside is rounded and I don't know how to make the edges to be transperent, and not white\any-other-color. (If someone know what is Steam, I'm talking about something like that.) Thanks in advance... NaNg

      R Offline
      R Offline
      Robin Panther
      wrote on last edited by
      #2

      try to search for shaped forms... like this or like this ____________________________________________ Robin Panther http://www.robinland.com

      N 1 Reply Last reply
      0
      • R Robin Panther

        try to search for shaped forms... like this or like this ____________________________________________ Robin Panther http://www.robinland.com

        N Offline
        N Offline
        NaNg15241
        wrote on last edited by
        #3

        thank you very muchhhh

        1 Reply Last reply
        0
        • N NaNg15241

          Hello, I want to do a Windows Form that doesn't have a close (X) and minimize (_) buttons as it normally have, it wan't it costum, or an image that I'll supply, OR that there will not be a control box AND no border, and inside the form I will supply an image with everything, but if I'll choose this, how will I be able to drag the window? In anyways, the image inside is rounded and I don't know how to make the edges to be transperent, and not white\any-other-color. (If someone know what is Steam, I'm talking about something like that.) Thanks in advance... NaNg

          L Offline
          L Offline
          Luis Alonso Ramos
          wrote on last edited by
          #4

          NaNg15241 wrote:

          how will I be able to drag the window?

          A very easy way to do it is to override WndProc on your form, handle WM_NCHITTEST, call the default, and if it returns HTCLIENT, change it for HTCAPTION. You'll be able to drag the form around by clicking on the client area. I'm at home right now, but if you need help on that (or sample code), reply to this post and I'll show you some sample code that I have at the office. Those constants (WM_NCHITTEST, HTCLIENT, HTCAPTION) can be looked up in Windows.h. -- LuisR


          Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

          The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005 -- modified at 23:42 Sunday 12th March, 2006

          1 Reply Last reply
          0
          • N NaNg15241

            Hello, I want to do a Windows Form that doesn't have a close (X) and minimize (_) buttons as it normally have, it wan't it costum, or an image that I'll supply, OR that there will not be a control box AND no border, and inside the form I will supply an image with everything, but if I'll choose this, how will I be able to drag the window? In anyways, the image inside is rounded and I don't know how to make the edges to be transperent, and not white\any-other-color. (If someone know what is Steam, I'm talking about something like that.) Thanks in advance... NaNg

            L Offline
            L Offline
            Luis Alonso Ramos
            wrote on last edited by
            #5

            This code will create a form that can be moved by dragging from the client area:

                public partial class Form1 : Form
                {
                    public Form1()
                    {
                        InitializeComponent();
                    }
             
                    const int WM_NCHITTEST = 0x84;
             
                    const int HTCLIENT = 1;
                    const int HTCAPTION = 2;
                    const int HTSIZE = 4;
                    const int HTBOTTOMLEFT = 16;
             
                    protected override void WndProc(ref Message m)
                    {
                        base.WndProc(ref m);
             
                        if (m.Msg == WM_NCHITTEST)
                        {
                            if (m.Result == (IntPtr) HTCLIENT)
                                m.Result = (IntPtr) HTCAPTION;
                        }
                    }
                }
            

            I hope it helps! -- LuisR


            Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

            The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups