-
Apr 18th, 2017, 02:15 PM
#41
Re: Errors when trying to replicate using community 2015
Originally Posted by jcarpenter8504
As stated in the Title, I am running this in Community 2015. My question is can this be done in 2015, and if it can, what did I do wrong?
Code:
' Render container background gradient: Overload resolution failed because no accessible 'New' accepts this number of arguments.
Protected Overrides Sub OnRenderToolStripBackground(e As ToolStripRenderEventArgs)
MyBase.OnRenderToolStripBackground(e)
Dim b As New Drawing2D.LinearGradientBrush(e.AffectedBounds, clrVerBG_White, clrVerBG_GrayBlue,
Drawing2D.LinearGradientMode.Vertical)
Dim shadow As New Drawing.SolidBrush(clrVerBG_Shadow)
Dim rect As New Rectangle(0, e.ToolStrip.Height - 2, e.ToolStrip.Width - 1) ' Error on this line
e.Graphics.FillRectangle(b, e.AffectedBounds)
e.Graphics.FillRectangle(shadow, rect)
End Sub
Code:
' OnRenderImageMargin: Error on last FillRectangle. says it failed because Value of type Pen cannot be converted to Brush
e.Graphics.FillRectangle(SubmenuBGbrush, rect3)
e.Graphics.FillRectangle(b, e.AffectedBounds)
e.Graphics.FillRectangle(DarkLine, rect)
e.Graphics.FillRectangle(WhiteLine, rect2)
e.Graphics.FillRectangle(borderPen, rect4) ' Error on this line
Yes it certainly can be done in VS 2015 Community edition.
To answer the "new" error on the rectangle, you're missing an input position parameter, you specify either the Top or the Left (with a 0 (zero)) but not the other (which would probably be a 0 again), so it should be like this: Dim rect As New Rectangle(0, 0, e.ToolStrip.Height - 2, e.ToolStrip.Width - 1)
To answer the FillRectangle error, it says you're passing it a Pen object when it requires a Brush object, somewhere you're creating a Pen named borderPen then passing "borderPen" into the e.Graphics.FillRectangle(borderPen, rect4), what you should be doing is creating a borderBrush As New Brush().... instead and use that.
-
Apr 18th, 2017, 02:38 PM
#42
New Member
Re: Errors when trying to replicate using community 2015
Originally Posted by JuggaloBrotha
Yes it certainly can be done in VS 2015 Community edition.
To answer the "new" error on the rectangle, you're missing an input position parameter, you specify either the Top or the Left (with a 0 (zero)) but not the other (which would probably be a 0 again), so it should be like this: Dim rect As New Rectangle(0, 0, e.ToolStrip.Height - 2, e.ToolStrip.Width - 1)
To answer the FillRectangle error, it says you're passing it a Pen object when it requires a Brush object, somewhere you're creating a Pen named borderPen then passing "borderPen" into the e.Graphics.FillRectangle(borderPen, rect4), what you should be doing is creating a borderBrush As New Brush().... instead and use that.
'// Border
Dim borderPen As New Pen(clrMenuBorder)
Dim rect4 As New Rectangle(0, 1, e.ToolStrip.Width - 1, e.ToolStrip.Height - 2)
This was the section of code from the OnRenderImageMargin Sub that was on the clsMenuRenderer class. I tried switching it to Brush, but then it gave me a lot of errors upon trying to change it.
-
Apr 18th, 2017, 02:41 PM
#43
New Member
Re: Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer
I was able to get the first issue working, the second however I attempted to change it to a new instance of Brush, which it did not like at all in the slightest. Ended up making up a few new errors. Below is the code I used for the variable from the clsMenuRenderer class.
' Border
Dim borderPen As New Pen(clrMenuBorder)
Dim rect4 As New Rectangle(0, 1, e.ToolStrip.Width - 1, e.ToolStrip.Height - 2)
What I have found so far is that it can't choose between Pen and Brush when it comes time to Override it. At least that is what I have gathered from this link.
https://msdn.microsoft.com/en-us/library/2hx4ayzs.aspx
Last edited by jcarpenter8504; Apr 18th, 2017 at 02:58 PM.
Reason: Supplying more information about specified error and what I have found on my own research.
-
Apr 18th, 2017, 08:25 PM
#44
Re: Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer
Originally Posted by jcarpenter8504
I was able to get the first issue working, the second however I attempted to change it to a new instance of Brush, which it did not like at all in the slightest. Ended up making up a few new errors. Below is the code I used for the variable from the clsMenuRenderer class.
What I have found so far is that it can't choose between Pen and Brush when it comes time to Override it. At least that is what I have gathered from this link.
https://msdn.microsoft.com/en-us/library/2hx4ayzs.aspx
What is your "clrMenuBorder" variable?
-
Apr 19th, 2017, 07:58 AM
#45
New Member
Re: Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer
Originally Posted by JuggaloBrotha
What is your "clrMenuBorder" variable?
This is the part within clsMenuRenderer where my border is handled.
' Border
Dim borderPen As New Pen(clrMenuBorder)
Dim rect4 As New Rectangle(0, 1, e.ToolStrip.Width - 1, e.ToolStrip.Height - 2)
And my declaration of clrMenuBorder within clsColors
Public clrMenuBorder As Color = Color.FromArgb(255, 160, 160, 160)
-
Apr 19th, 2017, 08:49 AM
#46
Re: Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer
Originally Posted by jcarpenter8504
This is the part within clsMenuRenderer where my border is handled.
And my declaration of clrMenuBorder within clsColors
Without seeing more of your code I'm not sure where things are going wrong, but ultimately I see you're creating a Pen from the clrMenuBorder variable (whatever that is) and you really need a Brush, which you can do by: Dim borderBrush As New SolidBrush(Colors.Black); but if clrMenuBorder is a Color Enum you could use: Dim borderBrush As New SolidBrush(clrMenuBorder)
-
Apr 19th, 2017, 09:00 AM
#47
New Member
Re: Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer
Originally Posted by JuggaloBrotha
Without seeing more of your code I'm not sure where things are going wrong, but ultimately I see you're creating a Pen from the clrMenuBorder variable (whatever that is) and you really need a Brush, which you can do by: Dim borderBrush As New SolidBrush(Colors.Black); but if clrMenuBorder is a Color Enum you could use: Dim borderBrush As New SolidBrush(clrMenuBorder)
I was able to get it to work using the variable with the last option:
Dim borderBrush As New SolidBrush(clrMenuBorder)
On your earlier posts where you have all the custom colors for it, is that zip file the source code?
-
Apr 19th, 2017, 09:14 AM
#48
Re: Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer
Originally Posted by jcarpenter8504
On your earlier posts where you have all the custom colors for it, is that zip file the source code?
It should be, if so it'll be VS 2008 which should upgrade to VS2015/2017 just fine.
-
Apr 19th, 2017, 09:15 AM
#49
New Member
Re: Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer
Awesome, when I get a minute I will download it and mess around with it to see what the differences are between the two. Thanks for helping me with my issues I was having.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|