Aligning the Text on a Button Control (cf 2.0)

Hi all, is this at all possible

Or do I have to created a Custom Control

Thanks

Tryst


Answer this question

Aligning the Text on a Button Control (cf 2.0)

  • bryanandrews

    > Do you know of any tutorials that explains
    > the code that you have provide in your post

    Is there something in particular that you're not sure of

    > Also, could I use suimilar techniques to,
    > for example, apply borders to a Label Controls

    Yes, it should work. The code at the link below has been tested on a Panel but it should work for a Label as well.

    http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/msg/9716222d161a6e52 hl=en



  • smaillet

    See if the example at the link below helps.

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=366029&SiteID=1



  • Binoy R B

    > Do you know of any tutorials that explains the code that you have provide in your post
    >>Is there something in particular that you're not sure of

    Well, not really, its just that it would be good to get a knowledge of the techniques used so that I can apply them in the future. But yeah, would like to know what the Capture property does, along with the GetCapture() method does, and why the Capture property is set to true before the GetCapture() method is called, and then set to false after. Also, like to know exactly what the SetWindowLong() method does.

    > Also, could I use suimilar techniques to, for example, apply borders to a Label Controls
    >>Yes, it should work. The code at the link below has been tested on a Panel but it should work for a Label as well.

    Thanks for the link, will check it out.

    Tryst



  • groot

    Thats awesome Tim! Hit the nail right on the head.

    Do you know of any tutorials that explains the code that you have provide in your post

    Also, could I use suimilar techniques to, for example, apply borders to a Label Controls.

    Thanks

    Tryst


  • kubaw

    The following code is simply used to get the hWnd (handle) of the control.

    // Get the hWnd of the Button.

    btn.Capture = true;

    hWnd = GetCapture();

    btn.Capture = false;

    This is the token that is used to reference the control (window) when p/invoking Win32 APIs. There are different ways that this can be accomplished. However, I forgot to mention this is the way that you'd get the handle when targeting CF 1.0. Since you're using CF 2.0 you can just use the Handle property.

    http://msdn2.microsoft.com/en-us/system.windows.forms.control.handle.aspx

    The SetWindowLong method call, in this situation, is used to update the controls style bits. The CF Button control is just a wrapper on top of the equivalent system Win32 control. So you can make p/invoke calls to adjust the underlying control if something is not exposed directly through managed code.

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/wceshellui5/html/wce50lrfsetwindowlong.asp



  • MSVS Beta user

    Tim, that is awesome help.

    Thanks for the info, and the Links.

    Take care.

    Tryst


  • Aligning the Text on a Button Control (cf 2.0)