[Help]GDI+

Posts 1–15 of 25 · Page 1 of 2
[Help]GDI+
Hey guys,
Does GDI+ support Windows 7 and/or Visual Studio 2010?
Because i've downloaded the GDI component, and its an invalid file.
Solutions?
Did you add it as a reference?
Yeah i did.
Error:A reference to GDIplus.dll could not be added. Please make sure the file is accessible , and that it is a valid assembly or COM Component.
Quote Originally Posted by Invidus View Post
Yeah i did.
Error:A reference to GDIplus.dll could not be added. Please make sure the file is accessible , and that it is a valid assembly or COM Component.
I think you are switching to COM tab and selecting the dll. If its a .net dll then you should switch to .Net Components tab and then browse your required assembly.
Uh gah.
I'm not goingn to COM, i'm going to the Browse tab.
Does anyone have a recent version of the GDI+.dll?
You realize it's an API, not a toolbox item, right?

Common error
Test it with framework 3.5, bet it works I have noticed that 4.0 is glitchy and I have see and heard of so many errors using API, Wrappers, Assemblies, Etc.
Eh.
Alright, can someone tell me a proper solution on what to do, and how to do it xD
Quote Originally Posted by Invidus View Post
Eh.
Alright, can someone tell me a proper solution on what to do, and how to do it xD


GDI+ is included by default in VS.NET. And yes it supports vista and 7 too.

Double click your form. Select Form_Paint event and add the following code:

Code:
Dim g As Graphics = e.Graphics
Dim rect As New Rectangle(50, 50, 100, 100)
Dim BrushX As New LinearGradientBrush(rect, Color.Blue, Color.Indigo, LinearGradientMode.BackwardDiagonal)
g.FillRectangle(BrushX, rect)
Congratulations, you just used GDI+ functionality !! -.-
Quote Originally Posted by Hassan View Post




GDI+ is included by default in VS.NET. And yes it supports vista and 7 too.

Double click your form. Select Form_Paint event and add the following code:

Code:
Dim g As Graphics = e.Graphics
Dim rect As New Rectangle(50, 50, 100, 100)
Dim BrushX As New LinearGradientBrush(rect, Color.Blue, Color.Indigo, LinearGradientMode.BackwardDiagonal)
g.FillRectangle(BrushX, rect)
Congratulations, you just used GDI+ functionality !! -.-
Yeah that's what I was thinking when people were talking about GDI, I was like "Isn't it already included?" but didn't want sound like an idiot I used GDI only for my MPGH Twitter skin

Anyone that wants a preview add this to your form. (Be sure to set it to FormBorderStyle = none first

[php]
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
'region MainBackground'
Dim blkPen As New Pen(Color.Black, 1)
Dim gBrush As New Drawing2D.LinearGradientBrush(New Point(Width / 2, 0), New Point(Width / 2, Height), Color.FromArgb(142, 193, 218), Color.FromArgb(202, 227, 240))
Dim rect As New Rectangle(New Point(0, 0), Me.Bounds.Size)
e.Graphics.FillRectangle(gBrush, rect)
Dim totalrect As New Rectangle(New Point(0, 0), New Size(Width - 1, Height - 1))
e.Graphics.DrawRectangle(blkPen, totalrect)

'region "DrawTopBar"'
Dim gradBrush As New Drawing2D.LinearGradientBrush(New Point(Width / 2, 0), New Point(Width / 2, 20), Color.FromArgb(8, 117, 171), Color.FromArgb(97, 175, 214))
Dim outlineRect As New Rectangle(New Point(0, 0), New Size(Width - 1, 20))
e.Graphics.FillRectangle(gradBrush, outlineRect)
e.Graphics.DrawRectangle(blkPen, outlineRect)
Dim sFormat As New StringFormat
sFormat.Alignment = StringAlignment.Center
sFormat.LineAlignment = StringAlignment.Center
Dim mFont As New Font("[z] Arista light", 12)
e.Graphics.DrawString("MPGH Tweeter", mFont, Brushes.White, outlineRect, sFormat)
'End region.'
End Sub
[/php]

Just thought I'd hijack the thread with some GDI examples

Oh and the button style I made as well

[php]
Private Sub Button1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint

Dim gBrush As New Drawing2D.LinearGradientBrush(New Point((Button1.Width / 2) + 2, 2), New Point((Button1.Width / 2) + 2, Button1.Height + 2), Color.FromArgb(118, 183, 224), Color.FromArgb(155, 202, 230))
Dim buttonRect As New Rectangle(New Point(2, 2), New Size(Button1.Width - 4, Button1.Height - 4))
e.Graphics.FillRectangle(gBrush, buttonRect)
Dim nBrush As New SolidBrush(Color.FromArgb(60, 255, 255, 255))
e.Graphics.FillRectangle(nBrush, New Rectangle(New Point(2, 2), New Size(Button1.Width - 4, (Button1.Height / 2) - 1)))
Dim sFormat As New StringFormat
sFormat.Alignment = StringAlignment.Center
sFormat.LineAlignment = StringAlignment.Center
Dim daFont As New Font("Microsoft YaHei", 10)
e.Graphics.DrawString("Login", daFont, Brushes.White, buttonRect, sFormat)

End Sub
[/php]

Made by /me
I was told when at school to make an application all without controls.. pain in the ass.. using it. Same as a printer, manually writing the header, text, etc...

Although it was painful at the start, it was one of my favorite projects
Hm okay.
Alright so i'm coming to the conclusion that GDI only paints.
Is there any way that will allow the user to DRAW in a picturebox?
Quote Originally Posted by Invidus View Post
Hm okay.
Alright so i'm coming to the conclusion that GDI only paints.
Is there any way that will allow the user to DRAW in a picturebox?
It draws... wherever you want to
Hm.
Elaborate please?
Quote Originally Posted by Invidus View Post
Hm.
Elaborate please?
Umm... what about

e.Graphics.DRAWXXXX is so confusing?

Add to a PictureBox paint event.

e.Graphics.DrawLine or some shit and there you go.
Posts 1–15 of 25 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?