Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello people of the metal box on my computer.

 

I am creating a application that will easily allow me to create skins for my future applications. Well in this application, there is a feature that allows you to preview your progress, creating a window and drawing the skin to the window from the paint event.

 

Well now to the nitty gritty, I need to set the created window's ControlStyles:

 

       Window.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
       Window.SetStyle(ControlStyles.UserPaint, True)
       Window.SetStyle(ControlStyles.DoubleBuffer, True)

 

When I try to do it from my skin drawing procedure it wont compile due to the "SetStyle" function being protected. So what I was wondering is there another way of setting the ControlStyles?:confused:

When in doubt.... use the sledge Hammer!!
  • *Experts*
Posted
You can do it only in the form itself. So maybe you could edit the constuctor of the form that shows the skin or put in Load event, but you have to do it in the form itself, cant do it from another class.
Posted

Sounds good..

 

I will try the load event, I was just reading a artical on msdn that mentions the same thing along with the function updatestyles. Thank you for your help. I will post the results of my escapdes for the world to see.

When in doubt.... use the sledge Hammer!!
Posted

SUCCESS!

 

Success! Thanks here is what I got..

 


   Public Sub CreateWindow()
       Dim TestFrm As New Form()
       AddHandler TestFrm.Load, AddressOf TestFrm_Load
       TestFrm.ShowDialog()
   End Sub

   Public Sub TestFrm_Load(ByVal sender As Object, ByVal e As System.EventArgs)

       'Set the value of the double-buffering style bits to true.
       Me.SetStyle(ControlStyles.DoubleBuffer Or _
       ControlStyles.UserPaint Or _
       ControlStyles.AllPaintingInWmPaint, True)
       Me.UpdateStyles()

   End Sub

When in doubt.... use the sledge Hammer!!
  • *Experts*
Posted

What you are doing is setting those flags for the form you have the code in, not the one that shows skins. :)

You have to edit the class of the form that shows the skin.

:)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...