i can't move my form...pls help - Programmers Heaven

Howdy, Stranger!

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

Categories

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.