1

Suppose I have a Microsoft Expression Blend. Is it possible to create a custom control (such as a button) in MSE Blend and then import it to visual basic 2010?

For example, I want to create a custom shape button (different from what is available in the toolbox in VB2010) (like for example a pen-shaped button) in MSE Blend. Can I import it to VB2010 to be used with Windows Forms Projects? If yes, how?

(Added)

If Expression Blend designs cannot be used in windows forms, how then can I create a custom-shaped button in windows forms?

Your response will be very much appreciated.

2
  • Expression Blend produces XAML based contents and you cannot use it with windows forms.
    – Bala R
    Mar 9, 2011 at 4:53
  • I see.. I just thought it could be used in windows forms because it can be connected with VB2010. Since that is the case, then how can I create a custom-shaped button in windows forms? I'll be revising my question. thanks by the way. :) Mar 9, 2011 at 8:55

1 Answer 1

1

You can use WPF controls created in Expression Blend in a Winforms project.

You use the ElementHost control to host the WPF control. Here's a Channel9 video demonstrating how to do this.

There are some limitations to interop between WPF and Winforms but none will likely stop you creating and using a custom button.

Otherwise you could create the control in Winforms but it will probably not be as easy. You have a few options:

  • Create a UserControl to 'draw' your custom shape. The Region property might help creating a custom shape and you could just use an image of the look you want.

  • Use a custom class (possibly inheriting from Button) where you do all the controls drawing (in the Paint event) and handle all the mouse events yourself. Not an easy task.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.