// // Tool Strip Menu // // Add Sound button private void toolStripButtonAdd_Click(object sender, EventArgs e) { SoundItem sItem = new SoundItem(new Sound("Select a sound file", null)); flowLayoutPanel1.Controls.Add(sItem); ResizeSoundItem(sItem); GotChanges = true; }
// Resize UI element to fit width void ResizeSoundItem(SoundItem item) { int style = GetWindowLong(flowLayoutPanel1.Handle, GWL_STYLE); bool hasVScroll = ((style & WS_VSCROLL) != 0); item.HandleResize(flowLayoutPanel1.Width - 8 - ((hasVScroll) ? SystemInformation.VerticalScrollBarWidth : 0)); }