Bordless Form with a weird border in a image

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
6 posts Page 1 of 1
Contributors
User avatar
tought5
New Member
New Member
Posts: 19
Joined: Fri Dec 10, 2010 6:50 pm

Well, i have a problem and i think you guys maybe can help me.

Every time i try to create a form bordless with a image, the image border will always stay weird, something like a "No Anti-Aliasing" thinging.

http://s10.postimage.org/n3uehx553/Capture.png

To make this i only set the background image to this png image( http://s12.postimage.org/ufpe2nt6j/test.png ), set the BackColor and the TransparencyKey to the color Lime and i set the FormBorderStyle to "None".

Maybe i'm doing something wrong, i don't know, so i hope you guys can help me.

Thanks.
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

umm try double buffer true tht might help or try aa new colour I use fushia and have no probs
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Cant do anything about it
https://t.me/pump_upp
User avatar
tought5
New Member
New Member
Posts: 19
Joined: Fri Dec 10, 2010 6:50 pm

muttley1968 wrote:
umm try double buffer true tht might help or try aa new colour I use fushia and have no probs
What do you mean double buffer?Can you teach me how to do it?

and changing to fuschia still doesn't work...
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

I dont think there is an easy way to do it..could be wrong :?

Sometimes it can be the quality of the image itself and its not a good idea to stretch the image over the form.

Download and add this altered image to project resources

Image

Try buffering the form and then drawing the image onto it:
Code: Select all
    Dim Backi As Bitmap = My.Resources.test
    Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
        e.Graphics.DrawImageUnscaled(New Bitmap(Backi), 0, 0)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.SetStyle(ControlStyles.DoubleBuffer, True)
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
        Me.SetStyle(ControlStyles.UserPaint, True)
    End Sub
Makes it a little clearer.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
tought5
New Member
New Member
Posts: 19
Joined: Fri Dec 10, 2010 6:50 pm

CodenStuff wrote:
I dont think there is an easy way to do it..could be wrong :?

Sometimes it can be the quality of the image itself and its not a good idea to stretch the image over the form.

Download and add this altered image to project resources

Image

Try buffering the form and then drawing the image onto it:
Code: Select all
    Dim Backi As Bitmap = My.Resources.test
    Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
        e.Graphics.DrawImageUnscaled(New Bitmap(Backi), 0, 0)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.SetStyle(ControlStyles.DoubleBuffer, True)
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
        Me.SetStyle(ControlStyles.UserPaint, True)
    End Sub
Makes it a little clearer.
But the problem is that i don't want to have a background, so that image wont work...
6 posts Page 1 of 1
Return to “Coding Help & Support”