473,396 Members | 2,016 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,396 software developers and data experts.

Graphics Problem

I have a borderless form that has a transparent background. I only wanted
the color that I painted the background with to be transparent and not the
controls on the form or the box I draw in the middle of the form. 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 marks of the window that I dragged in
front of it. The other thing I noticed was if I do an invalidate() it just
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(100, Color.Black))
g.FillRectangle(cl, New RectangleF(0, 0, Me.Width, Me.Height))
cl.Dispose()

Dim c2 As New SolidBrush(Color.WhiteSmoke) 'draw solid background
g.FillRectangle(c2, New RectangleF(15, 15, Me.Width - 30, Me.Height
- 30))
c2.Dispose()

'draw border
Dim pn As New Pen(Color.Black, 1.5) 'this pen will be 3 pixels wide
g.DrawRectangle(pn, 15, 15, Me.Width - 30, Me.Height - 30) 'draw a
rectangle in Pixel mode (the default)
pn.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?

Is it better to pain the backgroun on the form in a bitmap then draw what I
have above on top ot the bitmap.

If so how can I get it to run smoothly while being dragged or having a
window dragged infront of it.

Feb 2 '07 #1
0 1204

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

Similar topics

21
by: BlackHawke | last post by:
My name is Nick Soutter, I own a small game development company (www.aepoxgames.net) making our first game (www.andromedaonline.net) in java. I am writing because we are having a very...
14
by: Pmb | last post by:
At the moment I'm using Borland's C++ (http://www.borland.com/products/downloads/download_cbuilder.html#) I want to be able to take an array of points and plot them on the screen. Is there a way...
4
by: Martin | last post by:
I am using graphics as backgrounds for forms,buttons,labels etc. The question is: is it faster to load all graphics from files on app start or to use it embeded (places in editor during design)....
8
by: Mark Johnson | last post by:
Using: VS 2003 NET C# for Framework and Framework Compact Trying : Moving a Card (Bitmap) as in Solitare (PC + WinCe) Version on OnMouseMove Problem : The affected drawing Area by Invalidate (or...
2
by: Christian Soltenborn | last post by:
Hi guys, I have a question to VB .NET: I add a Graphics object to a panel and use a bunch of DrawLine methods etc (it's really nice and convenient). But: As soon as I send my form (which...
15
by: Hamed | last post by:
Have I posted the message to wrong newsgroup? Or Does the question is so much strage? Would someone please kindly direct me to a true newsgroup or resource? Best Regards Hamed
8
by: pigeonrandle | last post by:
Hi, Please pity me, i am on a dial-up connection for the first time in 5 years :( ! Does anyone know how the resulting Graphics objects differ ...? What i really mean is can someone explain it...
12
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet...
9
by: she_prog | last post by:
Dear All, I need to save the content of a panel to a bitmap. The panel can have many child controls which also need to be saved. The problem would be solved if I could have the panel saved to a...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.