/// <inheritdoc /> protected override void OnMouseMove(MouseEventArgs e) { if (!Capture) { return; } var screen = PointToScreen(e.Location); if (ParentForm == null) { return; } var window = ParentForm.PointToClient(screen); if (_scaling) { Width = Math.Max(180 * _scale, window.X - Left); Height = Math.Max(62 * _scale, window.Y - Top); NormaliseControlScale(); } else { DoDrag(window); } ParentForm?.Refresh(); // triggering via parent stops weird drawing issues }
private void pbButton_MouseMove(object sender, MouseEventArgs e) { bool flag = e.Button == MouseButtons.Left; if (flag) { Point mousePosition = Control.MousePosition; mousePosition.Offset(this.mouse_offset.X, this.mouse_offset.Y); int num = ((Control)sender).Parent.PointToClient(mousePosition).X; bool flag2 = num < 0; if (flag2) { num = 0; } bool flag3 = num > this.pbBack.Width - this.pbButton.Width; if (flag3) { num = this.pbBack.Width - this.pbButton.Width; } this.pbButton.Left = num; float num2 = (float)pbButton.Left / ((float)pbBack.Width - ((float)pbButton.Width * 1f)); int index = this.Index; _index = (int)(((EndNum - StartNum) * num2) + 0.5) + StartNum; DrawImage(); Point p = PointToScreen(pbButton.Location); Point point = ParentForm.PointToClient(p); anim.Set(label, Animation.Prop.Left, point.X - ((label.Width - pbButton.Width) / 2)); label.Text = Index.ToString(); bool flag4 = index != Index; if (flag4) { this.SliderChanged?.Invoke(this, new EventArgs()); } } }
private void UpdateWindowPositions() { if (ParentForm != null) { Point point = this.PointToScreen(Point.Empty); Point absPos = ParentForm.PointToClient(point); foreach (PopupWindow window in windows) { window.ParentLocation = absPos; } } }
private void UpdateWindowPositions() { if (ParentForm != null) { var point = PointToScreen(Point.Empty); var absPos = ParentForm.PointToClient(point); foreach (var window in windows) { window.ParentLocation = absPos; } } }
private void document_ShowingWindow(object sender, PopupWindowEventArgs e) { PopupWindow window = e.Window; if (!windows.Contains(window)) { windows.Add(window); if (ParentForm != null) { ParentForm.Controls.Add(window); Point point = this.PointToScreen(Point.Empty); Point absPos = ParentForm.PointToClient(point); window.ParentLocation = absPos; window.BringToFront(); } } }
private void AutoFit() { if (listBox1.Items.Count == 0) { listBox1.Visible = false; return; } listBox1.Visible = true; int width = 300; using (Graphics g = listBox1.CreateGraphics()) { for (int i1 = 0; i1 < listBox1.Items.Count; i1++) { int itemWidth = Convert.ToInt32(g.MeasureString(Convert.ToString(listBox1.Items[i1]), listBox1.Font).Width); width = Math.Max(width, itemWidth); } } listBox1.Width = width; listBox1.Height = Math.Min(800, listBox1.Font.Height * (listBox1.Items.Count + 1)); Width = listBox1.Width; _onSizeChanged(new Size(width + Margin.Right + Margin.Left, listBox1.Height + textBox1.Height)); var txtBoxOnScreen = PointToScreen(textBox1.Location + new Size(0, textBox1.Height)); if (ParentForm != null && !ParentForm.Controls.Contains(listBox1)) { ParentForm.Controls.Add(listBox1); var listBoxLocationOnScreen = txtBoxOnScreen; listBox1.Location = ParentForm.PointToClient(listBoxLocationOnScreen); } listBox1.BringToFront(); }