Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

i can't move my form...pls help

atillaselematillaselem Posts: 1Member
i have a form app and i put a background image on my form. then set the TransparencyKey to white and select 'None' for FormBorderStyle in order to see a transparent view when app starts.
Everything seems Ok, But my problem is that i can't move my transparent form anywhere. What should i do to move my form without a border?

Any help will be appreciated...
Thanks,

Atilla Selem

Comments

  • JCrouchJCrouch Posts: 9Member
    : i have a form app and i put a background image on my form. then set the TransparencyKey to white and select 'None' for FormBorderStyle in order to see a transparent view when app starts.
    : Everything seems Ok, But my problem is that i can't move my transparent form anywhere. What should i do to move my form without a border?
    :
    : Any help will be appreciated...
    : Thanks,
    :
    : Atilla Selem
    :
    :
    :If I read your message right I have what you need :).
    :
    :Put this inside of your Form class:
    :
    public const int HTCAPTION = 0x2;
    public const int WM_NCLBUTTONDOWN = 0xA1;

    [DllImportAttribute ("user32.dll")]
    public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

    [DllImportAttribute ("user32.dll")]
    public static extern bool ReleaseCapture();

    :Then put this in the MouseDown event of your form:
    :
    ReleaseCapture();
    SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
    :
    :
    :Now your set! There is another way of doing this without the API calls
    :look at this artcle to see how:
    :
    ::http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchShapedWindowsFormsControlsInVisualStudioNET.asp
Sign In or Register to comment.