
Pselus
Avatar/Signature-
Posts
29 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Pselus
-
Ok, I'm having an issue. My companies program uses the AXwebBrowser to display product information. The information can come in the form of a webpage, a PDF document, info from SQL or a Word document. All of these work, even the word document...however when the word document tries to display I get the Open/Save/Cancel dialog box. I want to suppress this box. Now, from what I've found out...this is not typically a problem of Windows forms...this is a problem mixing Windows Forms, computer settings and webpage control... Anyone got any leads? I've looked all over the internet for this and can only find the question...not the answers.
-
Supress Open/Save message
Pselus replied to steveosmith's topic in Interoperation / Office Integration
big ole bumparoo... I am having the same problem and can't find an explanation anywhere...I think it might have something to do with the fact that this problem is a mix of .Net code, computer settings and Webpages... so basically I need to find out what needs to be set on the computer to not bring this dialog up, and then I need to figure out how to set that programatically on the computer. Anyone? -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
also, Cags...don't know if yours has this problem...but I noticed with mine that when you set the backcolor to Transparent in design time, it doesn't paint anything in the background and you end up with black or whatever is behind your app...it's not a real problem for me...just thought I'd point it out in case someone else does have a problem with it. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
Cags, I'll check this out. Any VB syntax you need to know (and can't find) post up...I'll help in any way I can. Can't thank you enough for all the help you provided man. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
ah, the joy of all this crap is really getting to me. :) I have one last question (I hope). still having a bit of trouble with drawing the border. The problem isn't that it's not drawing the border...I think the problem is that the region isn't quite right. The border draws for the top and the left sides, and the bottom right corner shows up almost...but the right border and bottom border don't show. this is what it should look like: http://www.livethislife.net/images/ForWork/should.png and this is what it does: http://www.livethislife.net/images/ForWork/does.png see the difference in the borders? -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
I believe I may just be a dolt. This whole "flicker" thing has drained my will to program. I just went and got the origional border drawing code and pasted it in...it works fine. silly me. :) Thank you so very much for all your help Cags. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
I'm not exactly following what you do with the rectangle that you pass into your GetPath method. are you just using it in place of the Method level "rect" that is declared in my GetPath method (do you still have that code? I thought I posted it a couple pages back). -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
got it. Origionally rect was declared = Me.ClientRectangle. Forgot that part this time around. so...possibly 1 last question. Earlier you mentioned getting the border into the Region by adding 1 or 2 pixels all around. Should I do that in the graphPath or somewhere else? -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
nope. Still shows the gradient wrong. I'm betting that somewhere the "rect" object isn't being treated the same. I basically took what you posted and commented out everything I had. So I'll go back and look at what's done to rect in my code. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
you sir, are very nearly my hero. :) what you just posted works 99% perfectly...the only problem is that the gradient background doesn't draw all the way across now. example: http://www.livethislife.net/images/ForWork/wackyfun.png I'm going to look into it more, but was hoping you knew why that was happening. I did however navigate through the app and apart from the gradient and a few other issues I'm sure I can solve...this worked perfect. You english folks always seem to help me out so much. If I'm ever in england, you'll get a round a drinks on me. :) -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
I was using Fillpath because the background is a gradient and Fillpath allows the use of a gradient brush whereas e.Graphics.Clear(Me.BackColor) just uses 1 color. *edit* right now this is my paint method: graphPath = Me.GetPath() If Me.ClientRectangle.Width = 0 Then rect.Width += 1 End If If Me.ClientRectangle.Height = 0 Then rect.Height += 1 End If If Me._GradientMode = LinearGradientMode.None Then filler = New System.Drawing.Drawing2D.LinearGradientBrush(rect, Me._BackColour1, Me._BackColour1, System.Drawing.Drawing2D.LinearGradientMode.Vertical) Else filler = New System.Drawing.Drawing2D.LinearGradientBrush(rect, Me._BackColour1, Me._BackColour2, CType(Me._GradientMode, System.Drawing.Drawing2D.LinearGradientMode)) End If e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias e.Graphics.FillPath(filler, graphPath) Me.Region = New Region(graphPath) OnPaintBackground is overridden and is blank. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
apparently neither. But the problem with using e.Graphics.Clear(this.Backcolor) is that the backcolor is Color.Transparent and windows transparency doesn't work right unless you don't override OnPaintBackground. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
I apologize now if these images are too huge...don't have any graphics programs at work except for MS Paint. Pay attention to what's inside the main white panel. Using the Region stuff you talked about (I took out the double buffering and it is much faster) it now paints outside the curves...but doesn't paint INSIDE. http://www.livethislife.net/images/ForWork/nodrawinside.png Now the odd thing is that as soon as I click the search link, which raises an event...it paints what's inside like this (remember, the ONLY thing I've done at this point is type "smith" and clicked "Search"...this screenshot was taken while processing for Search was going on): http://www.livethislife.net/images/ForWork/aftersearch.png and here is one more example of things not painting. The red borders were added in Paint. If you look at the big one you are seeing a windows panel inside of my custom panel. Inside the windows panel are 2 windows listboxes (along with some labels and things). Those listboxes aren't fully painting even though I have no code to override their paint events. If you look at the smaller red borders you will see another issue. Those are my custom panel with a windows label and a windows checkbox inside. The labels seem to be painting just fine, but the checkboxes aren't painting their background to match the parents background...which is why you see the white square outside the checkbox. Cags I can't thank you enough for the help you've given me already...this Region thing is DEFINATLY heading in the right direction...I've got faster loading and no flicker...now I just need to figure out these painting issues. http://www.livethislife.net/images/ForWork/inworkflow.png -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
also, what I meant by "not drawing all of the controls" is that some of my controls don't draw INSIDE the curves now. Specifically my tabcontrol which uses this panel. It now draws outside the curves just fine (which fixes the origional problem), but doesn't draw inside anymore. I also have a label control that is just this panel with a label inside of it (so I can have curved labels) and it does the same thing. Draws outside the curves now, but what's inside doesn't draw right. I'll try to get a screenshot or 2. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
I'll try out the things you mentioned today. Sorry about not replying yesterday...I was out sick. The reasson I'm using that bitmap to draw was because I was attempting to double buffer the control. The normal windows double buffering wasn't working well enough so I had to do it on my own. As for the amount of this control in my program...well if you look at the images I put above, every single time you see a rounded edge...it's this control. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
couple other relevant code pieces: Protected Function GetPath() As System.Drawing.Drawing2D.GraphicsPath Dim graphPath As New System.Drawing.Drawing2D.GraphicsPath If Me._BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Then graphPath.AddRectangle(Me.ClientRectangle) Else Try Dim curve As Integer = 0 Dim rect As System.Drawing.Rectangle = Me.ClientRectangle Dim offset As Integer = 0 Select Case Me._BorderStyle Case System.Windows.Forms.BorderStyle.FixedSingle If Me._BorderWidth > 1 Then offset = DoubleToInt(Me.BorderWidth / 2) End If curve = Me.adjustedCurve Case System.Windows.Forms.BorderStyle.Fixed3D Case System.Windows.Forms.BorderStyle.None curve = Me.adjustedCurve End Select If curve = 0 Then graphPath.AddRectangle(rect.Inflate(rect, -offset, -offset)) Else Dim rectWidth As Integer = rect.Width - 1 - offset Dim rectHeight As Integer = rect.Height - 1 - offset Dim curveWidth As Integer = 1 If (Me._CurveMode And CornerCurveMode.TopRight) <> 0 Then curveWidth = (curve * 2) Else curveWidth = 1 End If graphPath.AddArc(rectWidth - curveWidth, offset, curveWidth, curveWidth, 270, 90) If (Me._CurveMode And CornerCurveMode.BottomRight) <> 0 Then curveWidth = (curve * 2) Else curveWidth = 1 End If graphPath.AddArc(rectWidth - curveWidth, rectHeight - curveWidth, curveWidth, curveWidth, 0, 90) If (Me._CurveMode And CornerCurveMode.BottomLeft) <> 0 Then curveWidth = (curve * 2) Else curveWidth = 1 End If graphPath.AddArc(offset, rectHeight - curveWidth, curveWidth, curveWidth, 90, 90) If (Me._CurveMode And CornerCurveMode.TopLeft) <> 0 Then curveWidth = (curve * 2) Else curveWidth = 1 End If graphPath.AddArc(offset, offset, curveWidth, curveWidth, 180, 90) graphPath.CloseFigure() End If Catch ex As System.Exception graphPath.AddRectangle(Me.ClientRectangle) End Try End If Return graphPath End Function And Public Sub Render(ByVal g As Graphics) If Not Me._memoryBitmap Is Nothing Then g.DrawImage(Me._memoryBitmap, New Rectangle(0, 0, Me._width, Me._height), 0, 0, Me._width, Me._height, GraphicsUnit.Pixel) End If End Sub -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
Cags, I just got around to trying the Region thing and it is so very very close to what I need. If I weren't in a place of business I'd be giggling like a schoolgirl. A few problems though: 1) My app just slowed waaaaaaaaaaaaaaaaay down after doing that. For reference sake, here is my Paint code for the uctrlPanel control: Dim filler As System.Drawing.Drawing2D.LinearGradientBrush Dim rect As System.Drawing.Rectangle = Me.ClientRectangle Dim topCorn As Rectangle Dim graphPath As System.Drawing.Drawing2D.GraphicsPath If memGraphics.CanDoubleBuffer() Then If Not Me._HasDrawn Then '''Me._HasDrawn = True ' Draw the curved border graphPath = Me.GetPath() If Me.ClientRectangle.Width = 0 Then rect.Width += 1 End If If Me.ClientRectangle.Height = 0 Then rect.Height += 1 End If If Me._GradientMode = LinearGradientMode.None Then filler = New System.Drawing.Drawing2D.LinearGradientBrush(rect, Me._BackColour1, Me._BackColour1, System.Drawing.Drawing2D.LinearGradientMode.Vertical) Else '''filler = New System.Drawing.Drawing2D.LinearGradientBrush(rect, Me._BackColour1, Me._BackColour1, CType(Me._GradientMode, System.Drawing.Drawing2D.LinearGradientMode)) filler = New System.Drawing.Drawing2D.LinearGradientBrush(rect, Me._BackColour1, Me._BackColour2, CType(Me._GradientMode, System.Drawing.Drawing2D.LinearGradientMode)) End If memGraphics.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias memGraphics.Graphics.FillPath(filler, graphPath) Me.Region = New Region(graphPath) Select Case Me._BorderStyle Case System.Windows.Forms.BorderStyle.FixedSingle Dim borderPen As New System.Drawing.Pen(Me._BorderColour, Me._BorderWidth) memGraphics.Graphics.DrawPath(borderPen, graphPath) borderPen.Dispose() Case System.Windows.Forms.BorderStyle.Fixed3D Me.DrawBorder3D(memGraphics.Graphics, Me.ClientRectangle) Case System.Windows.Forms.BorderStyle.None End Select ' Render to the form memGraphics.Render(e.Graphics) filler.Dispose() graphPath.Dispose() End If End If Is there something in there I shouldn't be doing? Something I should do different? I am so new to this whole GDI+ thing that I'm learning on the fly (though you have been very helpful so far). There are a couple other problems right now (not drawing all of the border, not drawing all of the controls, etc.) but I'll go one at a time...for now the speed of the app is a big thing. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
ok, I only partially get what you're saying there Cags. you are saying that I should set the controls region using a graphics path..I understand that part...but what exactly should this graphics path consist of? If I make the graphicspath based on the rounded edges, is it going to still need MyBase.OnPaintBackground to paint the transparent corners? If so, well...that's the whole issue...painting the background normally is the origional problem because it creates alot of flickering. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
and now I have to go home for the weekend...everyone have a great Christmas and I hope I can solve this on Monday. :) -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
literally the difference in those 2 pictures is when I go into this control and comment out (or uncomment) the single line: Mybase.OnPaintBackground. doing that one thing in 1 control causes that much change in the application. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
we've already tried the SuspendLayout, ResumeLayout route. the Login is just a form, it happens to have one of these panels on it. I can show you what it looks like with the control working properly...I have highlighted in green all the places just in one screen of the app that use this panel (ignore the red background...it's me trying to test things): http://www.livethislife.net/images/ForWork/system.png then this is what it looks like with OnPaintBackground overridden (the places that don't work are highlighted green, the places that do are blue): http://www.livethislife.net/images/ForWork/system2.png honestly, for the life of me I can't figure out why some of those things work fine when others don't... I must say...I used to hate doing bugs...now I just hate doing Graphics bugs when the graphics were designed by an incompetant programmer...I can't tell you how many places just have arbitrary Color.Transparent assignments... -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
I'm pretty sure that your method is the overall best solution as well...however, there are so many other things dependant upon it now that I don't think it's the FASTEST way. My boss has already said that we will take the time to go back and rewrite the controls later...so all I need to find now is a quick fix...when I redesign them I will most definatly use your method. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
umm....could I somehow use Regions for that purpose? I have never worked with them before so I'm not sure. -
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
-
Draw Transparent Rectangle WITHOUT OnPaintBackground
Pselus replied to Pselus's topic in Graphics and Multimedia
but will this get over the issue of the form redrawing when events are raised? I've come up with PLENTY of ways to get around the Transparency thing, but so far none of them have solved that particular problem... now that I think about it...I'm not sure I even mentioned that problem here...hmmm.... ah, yes, I did: so yeah, overriding OnPaintBackground stops this flickering...but then the transparency problem comes up. I will look into the links you posted...I hope they help me.