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

Non-Rectangular Form Question

Hi,

i have some questions about non-rectangular forms

1) i build a form as a non-rectangular by setting the form background to
some bmp file and the transparenceyKey to the
color which i want to make transparent and every thing ok BUT when i m
replacing the bmp
file i can see the new one in the form designer but when i m running the
program i m getting the old bmp file.
i tried to remove the background but it didn't help.
what i m missing ?

2) how can i make a non-rectangular form for monitors which working with
more than 24 bit color depth ?

3) how can i make the non-rectangular form to be resizable ?

4) how can i prevent the duplicating of the background bmp file on the form
?

--
Best Regards ,

Tiraman :-)
Nov 20 '05 #1
5 1039
* "Tiraman" <ti*****@netvision.net.il> scripsit:
i have some questions about non-rectangular forms

1) i build a form as a non-rectangular by setting the form background to
some bmp file and the transparenceyKey to the
color which i want to make transparent and every thing ok BUT when i m
replacing the bmp
file i can see the new one in the form designer but when i m running the
program i m getting the old bmp file.
i tried to remove the background but it didn't help.
what i m missing ?

2) how can i make a non-rectangular form for monitors which working with
more than 24 bit color depth ?


Instead of using 'TransparencyKey' to archieve transparency, you can
create a 'System.Drawing.Drawing2D.GrpahicsPath' or appropriate shape,
create a 'Region' object from it and assign it to the form's 'Region'
property at runtime.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Hi,

How to do it yourself.
http://msdn.microsoft.com/library/de...lStudioNET.asp

Region master controls
http://www.windowsforms.com/Samples/...179&tabindex=4

MSDN TV episode on Region master controls.
http://msdn.microsoft.com/msdntv/epi...H/manifest.xml

Ken
-----------------------
"Tiraman" <ti*****@netvision.net.il> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
Hi,

i have some questions about non-rectangular forms

1) i build a form as a non-rectangular by setting the form background to
some bmp file and the transparenceyKey to the
color which i want to make transparent and every thing ok BUT when i m
replacing the bmp
file i can see the new one in the form designer but when i m running
the
program i m getting the old bmp file.
i tried to remove the background but it didn't help.
what i m missing ?

2) how can i make a non-rectangular form for monitors which working with
more than 24 bit color depth ?

3) how can i make the non-rectangular form to be resizable ?

4) how can i prevent the duplicating of the background bmp file on the
form
?

--
Best Regards ,

Tiraman :-)

Nov 20 '05 #3
Hi Tiraman,

What I find one of the nicest samples I have made.

See beneath (You can open a project and just paste above the end class
line).

I hope this helps?

Cor

\\\made by Cor Ligthert from ideas I got from Herfried. K. Wagner and Fergus
Cooney
Private WithEvents button1 As New Button
Private mouseX, mouseY As Integer
Private myMouseDown As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As New System.Drawing.Drawing2D.GraphicsPath
g.AddString("HTH" & vbCrLf & "Cor", _
System.Drawing.FontFamily.GenericSansSerif, _
System.Drawing.FontStyle.Bold, 200, _
New Point(0, 0), _
System.Drawing.StringFormat.GenericDefault)
Me.BackColor = Color.Red
Me.Region = New System.Drawing.Region(g)
g.Dispose()
Me.AutoScaleBaseSize = New System.Drawing.Size(0, 0)
Me.ClientSize = New System.Drawing.Size(500, 450)
button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
button1.ForeColor = System.Drawing.Color.Black
button1.Location = New System.Drawing.Point(425, 18)
button1.Size = New System.Drawing.Size(20, 20)
Me.Controls.Add(button1)
button1.Text = "X"
Me.Location = New System.Drawing.Point(50, 50)
End Sub
Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles button1.Click
Me.Close()
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal _
e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
myMouseDown = True
mouseX = Cursor.Position.X - Me.Location.X
mouseY = Cursor.Position.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e _
As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
If myMouseDown Then
Me.Location = New System.Drawing.Point(Cursor.Position.X _
- mouseX, Cursor.Position.Y - mouseY)
End If
LastCursor = Cursor.Position
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
myMouseDown = False
End Sub
///
Nov 20 '05 #4
Hi Cor,

it is a nice example :-)
so 10x and bye

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:u3**************@TK2MSFTNGP12.phx.gbl...
Hi Tiraman,

What I find one of the nicest samples I have made.

See beneath (You can open a project and just paste above the end class
line).

I hope this helps?

Cor

\\\made by Cor Ligthert from ideas I got from Herfried. K. Wagner and Fergus Cooney
Private WithEvents button1 As New Button
Private mouseX, mouseY As Integer
Private myMouseDown As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As New System.Drawing.Drawing2D.GraphicsPath
g.AddString("HTH" & vbCrLf & "Cor", _
System.Drawing.FontFamily.GenericSansSerif, _
System.Drawing.FontStyle.Bold, 200, _
New Point(0, 0), _
System.Drawing.StringFormat.GenericDefault)
Me.BackColor = Color.Red
Me.Region = New System.Drawing.Region(g)
g.Dispose()
Me.AutoScaleBaseSize = New System.Drawing.Size(0, 0)
Me.ClientSize = New System.Drawing.Size(500, 450)
button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
button1.ForeColor = System.Drawing.Color.Black
button1.Location = New System.Drawing.Point(425, 18)
button1.Size = New System.Drawing.Size(20, 20)
Me.Controls.Add(button1)
button1.Text = "X"
Me.Location = New System.Drawing.Point(50, 50)
End Sub
Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles button1.Click
Me.Close()
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal _
e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
myMouseDown = True
mouseX = Cursor.Position.X - Me.Location.X
mouseY = Cursor.Position.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e _
As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
If myMouseDown Then
Me.Location = New System.Drawing.Point(Cursor.Position.X _
- mouseX, Cursor.Position.Y - mouseY)
End If
LastCursor = Cursor.Position
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
myMouseDown = False
End Sub
///

Nov 20 '05 #5
hello ken,

10x for the articles, they are good !

bye
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
Hi,

How to do it yourself.
http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vbtchShapedWindowsFormsControlsInVisualStudioNET.a sp
Region master controls
http://www.windowsforms.com/Samples/...mId=179&tabind
ex=4
MSDN TV episode on Region master controls.
http://msdn.microsoft.com/msdntv/epi...20040401WinFor
msMH/manifest.xml
Ken
-----------------------
"Tiraman" <ti*****@netvision.net.il> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
Hi,

i have some questions about non-rectangular forms

1) i build a form as a non-rectangular by setting the form background to
some bmp file and the transparenceyKey to the
color which i want to make transparent and every thing ok BUT when i m replacing the bmp
file i can see the new one in the form designer but when i m running
the
program i m getting the old bmp file.
i tried to remove the background but it didn't help.
what i m missing ?

2) how can i make a non-rectangular form for monitors which working with
more than 24 bit color depth ?

3) how can i make the non-rectangular form to be resizable ?

4) how can i prevent the duplicating of the background bmp file on the
form
?

--
Best Regards ,

Tiraman :-)


Nov 20 '05 #6

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

Similar topics

12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
3
by: Mario | last post by:
Hello, I couldn't find a solution to the following problem (tried google and dejanews), maybe I'm using the wrong keywords? Is there a way to open a file (a linux fifo pipe actually) in...
32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
22
by: Steve - DND | last post by:
We're currently doing some tests to determine the performance of static vs non-static functions, and we're coming up with some odd(in our opinion) results. We used a very simple setup. One class...
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
11
by: ypjofficial | last post by:
Hello All, So far I have been reading that in case of a polymorphic class ( having at least one virtual function in it), the virtual function call get resolved at run time and during that the...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.