473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Having problem with ransparancy?

I have a borderless form that has a transparent background. I only wanted
the color that paints the background with to be transparent and not the
controls on the form or the center square that I paint in the center. The
problem I am having is when I pass another window
in front of it or drag the window, it doesn’t repaint with the transparent
background. It just shows the drag or gets darker and eventual it will
because a solid color again.

This is my code that I am using:

Private Sub DoubleBuffering_Paint(ByVal sender As Object, _
ByVal e As PaintEventArgs) Handles MyBase.Paint

Dim g As Graphics '= e.Graphics
Dim Dw As Bitmap

Dw = New Bitmap(Me.Width, Me.Height, e.Graphics)
g = Graphics.FromImage(Dw)
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

DrawRoundedForm(0, _
0, _
Me.Width, _
Me.Height, _
18, _
Me.Region)

'filling the main background
Dim cl As New SolidBrush(Color.FromArgb(125, Color.Black))
g.FillRectangle(cl, New RectangleF(0, 0, Me.Width, Me.Height))
cl.Dispose()

Dim c2 As New SolidBrush(Color.WhiteSmoke)
g.FillRectangle(c2, New RectangleF(15, 15, Me.Width - 30, Me.Height
- 30))
c2.Dispose()
e.Graphics.DrawImageUnscaled(Dw, 0, 0)
g.Dispose()
End Sub
Protected Overrides Sub OnPaintBackground(ByVal pevent As
System.Windows.Forms.PaintEventArgs)
'prevents flickering on background redraw, does not redraw the
background
'MyBase.OnPaintBackground(pevent)
End Sub

Any body have any ideas?

Can I paint what is behind it on the window then draw the transparat color
on top and make it run smoothly when I drag the window?

I am using .net 2.0 vs 2005
Feb 1 '07 #1
0 806

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: George | last post by:
Hi, I am trying to write a query in Oracle which I have not done before, and are having some difficulty getting my result. Please check my query and my results. select max(note.datetime),...
0
by: Graham Simms | last post by:
I have tried to run a query where the reuslts are restricted by a HAVING clause with 2 conditions, but the second condition seems to be ignored. for example SELECT userid, AVG(position) FROM...
1
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an...
7
by: | last post by:
I fail to understand why that the memory allocated in the void create(int **matrix) does not remain. I passed the address of matrix so shouldn't it still have the allocated memory when it returns...
4
by: don | last post by:
I have two existing interfaces having methods with same names. Now I have to implement both intrfaces in one class. Is there any way I could implement methods with same names in both interfaces...
11
by: Jeff Robichaud | last post by:
Are there any security issues having the ASPNET user account member of Administrators ? Is it a good practice ?
2
by: sanderson82 | last post by:
Hi I am having problems with the HAVING clause. I know it can use aliases but the alias I am using has a space in it, eg 'Device ID' My querry looks like (simplified, devID is a calculation) ...
2
by: Jack | last post by:
Hi, Performance-wise, is there a difference between these 2 clauses? I assume a large database... 1) With the WHERE clause: Select FLD1, FLD2, FLD3 From myFile Where FLD1 = 1 And FLD2 = 1
7
by: tiptap | last post by:
Hey Guys, I have a huge statement loads of if statements in... and its getting bigger. On closer inspection there is only 3 difference in the select statement. so I thought I could cut the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.