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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:03:00+00:00 2026-06-18T04:03:00+00:00

I wanted an effect of fading a panel control and the controls / object

  • 0

I wanted an effect of fading a panel control and the controls / object inside it. I found some containers with opacity property it only changes the background color’s opacity.

So I came up my own solution. I created another form containing the controls I need and I got what I want but I got some problems with positioning the new form created. I don’t know how to get the working area of its parent form to set the initial position. What I mean for working area is that, it won’t include the control box / title bar. Different OS has different title bar sizes (as far as I know) so I need to adjust it correctly

Form2, the one holding the Opaque Controls

Public Class Form2

    Private Const dif As Integer = 23

    Private Const GWL_EXSTYLE As Integer = (-20)
    Private Const WS_EX_TRANSPARENT As Integer = &H20

    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer

    Public Sub resizeFrom(ByVal parent As Form)
        Me.Height = parent.Height - dif
        Me.Width = parent.Width
        Me.Top = (parent.Top + ((parent.Height - Me.Height) / 2) + (dif / 2))
        Me.Left = parent.Left + ((parent.Width - Me.Width) / 2)
    End Sub

    Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.TopMost = True
    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    Me.BackColor = Color.Red

    SetWindowLong(Me.Handle, GWL_EXSTYLE, GetWindowLong(Me.Handle, GWL_EXSTYLE) Or WS_EX_TRANSPARENT)
    End Sub
End Class

The Parent/Main Form

    Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Show()
        Form2.Show()
        Form2.resizeFrom(Me)
    End Sub

    Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
        Form2.resizeFrom(Me)
    End Sub

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Form1_Move(Me, New EventArgs)
    End Sub

    Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
        Form2.Opacity = HScrollBar1.Value / 100
        Me.Text = "Opacity: " & HScrollBar1.Value & "%"
    End Sub
End Class

It should look like this
http://i48.tinypic.com/25qubk0.jpg

Opaque Form is for display purposes, it was set to “Ghost Like Form” or “Click-through Form”

Is there any solution so I can get the proper WorkingArea of the Form?

Please help.
Thanks

  • 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-18T04:03:01+00:00Added an answer on June 18, 2026 at 4:03 am

    What you need is the absolute location of the ClientRectangle. The Location of this is (0, 0) but you can magically convert it to screen values:

    Form2.Location = PointToScreen(Me.ClientRectangle.Location)
    Form2.Size = Me.ClientRectangle.Size
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to be able to create a effect identical to CSS3 text-shadow Property,
I found the following Javascript effect to be interesting and wanted to use it
The effect I wanted to achieve is something like the Mail icon in iPhone.
I wanted to achieve an effect to switch the position of the 2 HTML
So, I wanted to make all images with sepia effect, however code I use
I wanted to remove this hover effect for buttons, instead i want to change
I wanted to create Embossed text effect on a text in a UILabel. I
I just wanted to clarify how to accomplish a certain effect using UIScrollView. I
With C#, I was easily able to get the effect I wanted: However, I'm
Basicly i wanted to create a magnifying glass effect on my image while i

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.