dannyres Posted November 16, 2003 Posted November 16, 2003 Hi, does anyone know if it is possible using api or something to set double buffering and some other styles on a .net window in another program? Dan Quote
*Experts* Volte Posted November 16, 2003 *Experts* Posted November 16, 2003 No, since (as far as I know) SetStyle only works from the constructor. Quote
*Gurus* divil Posted November 16, 2003 *Gurus* Posted November 16, 2003 It's a protected method so works from anywhere within a derived class. You could probably use reflection to call it, too. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
dannyres Posted November 16, 2003 Author Posted November 16, 2003 divil, how would i go about doing that? Dan Quote
*Experts* Volte Posted November 16, 2003 *Experts* Posted November 16, 2003 I doubt there's an easy way to setting the style on another program, even with reflection. What is it you need to do, anyway? Why do you need to set a style on another app? In order to set the style, you will need to retrieve the Windows.Forms.Form object representation of the window, and as far as I know, there's no way to get a Form object out of an hWnd. Quote
dannyres Posted November 17, 2003 Author Posted November 17, 2003 yeah basicly im trying to set the style of another application. I know how to get the handle of the form but no idea about the object....:( Dan Quote
dannyres Posted November 17, 2003 Author Posted November 17, 2003 ok ive been thinking about this and how i would do it and i realized, i can get the forms object... let me explain a little more in depth what im trying todo. I am making a component for a program called Dashboard.. kind of like the msn sidebar or the sidebar some of you may have seen in screenshots of longhorn. Anyway at the moment Dashboard keeps flashing, and so do the components. I fixed the flashing for my components by setting UserPaint, AllPaintinginWm and the DoubleBuffer styles. Now dashboard only flashes itself which is still anoying so i want to try and set those styles from a component. I can get Dashboard's form object by using Me.Parent from my usercontrol. Dan Quote
*Experts* Volte Posted November 17, 2003 *Experts* Posted November 17, 2003 So do something like this:Dim parentForm As Form = DirectCast(Me.Parent, Form) parentForm.SetStyle(blah) Quote
dannyres Posted November 17, 2003 Author Posted November 17, 2003 That doesnt work :( i get this error: 'System.Windows.Forms.Control.Protected Sub SetStyle(flag As System.Windows.Forms.ControlStyles, value As Boolean)' is not accessible in this context because it is 'Protected'. Looks like its not going to work this way? Dan EDIT: what does DirectCast do? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.