Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 1 odgovor
  • 3.131 pregleda

Najnovija ↓

Pomeranje forme (ili kako se to vec zove) 12.10.2006. u 21:29 · pre 244 meseca #1
Pozdrav

Imam formu za koju sam kao FormBorderStyle izabrao none, sta treba da uradim da bih klikom ne neki label (ili sta je vec potrebno za to) mogao da pomeram prozor?

hvala
Re: Pomeranje forme (ili kako se to vec zove) 13.10.2006. u 00:03 · pre 244 meseca #2
Mozda nekom zatreba...
Code:
Two ways. First:

//API functions to move the form
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

And in your mouse down event of the form:

public void Form1_MouseDown(object sender, MouseEventArgs e)
{
//If the left mouse is pressed, release form for movement
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
}

 

Second:

protected override void WndProc(ref Message m)
{
            base.WndProc(ref m);

            int WM_NCHITTEST = 0x84;
            if (m.Msg == WM_NCHITTEST)
            {
                int HTCLIENT = 1;
                int HTCAPTION = 2;
                if (m.Result.ToInt32() == HTCLIENT)
                    m.Result = (IntPtr)HTCAPTION;
            }
}

Preuzeto sa: http://forums.microsoft.com/MS...spx?PostID=754166&SiteID=1
Primer: http://www.codeproject.com/csharp/csharpmovewindow.asp
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme