private void DoFormLayout(object sender, LayoutEventArgs e) { if (_lastState == Form.WindowState) { return; } // in case the RibbonForm is started in WindowState.Maximized and the WindowState changes to normal // the size of the RibbonForm is set to the values of _storeSize - which has not been set yet! if (_storeSize.IsEmpty) { _storeSize = Form.Size; } if (WinApi.IsGlassEnabled) { Form.Invalidate(); } // on XP systems Invalidate is not sufficient in case the Form contains a control with DockStyle.Fill else { Form.Refresh(); } _lastState = Form.WindowState; }
public void show(bool upArrow, Form parent) { if (!this.created || (upArrow != this.lastUpArrow)) { this.created = true; this.lastUpArrow = upArrow; base.clearControls(); this.transparentBackground.Size = base.Size; this.transparentBackground.FillColor = Color.FromArgb(0xff, 0, 0xff); base.addControl(this.transparentBackground); this.background.Position = new Point(0, 0); if (upArrow) { this.background.Image = (Image) GFXLibrary.tutorial_arrow_yellow[0]; } else { this.background.Image = (Image) GFXLibrary.tutorial_arrow_yellow[1]; } this.background.Size = new Size(this.background.Image.Width, this.background.Image.Height); base.addControl(this.background); base.Invalidate(); if (parent != null) { parent.Invalidate(); } } }
/// <summary> /// /// </summary> /// <param name="mainForm"></param> /// <param name="clientInfo"></param> public static void setPermission(Form mainForm,ClientInfo clientInfo) { MenuStrip mainMenu = mainForm.MainMenuStrip; setPermission(clientInfo.LoggedUser, ref mainMenu, clientInfo.MenuPermissions); mainForm.Invalidate(); mainForm.Refresh(); mainMenu.Refresh(); }
void _form_Layout(object sender, LayoutEventArgs e) { if (_lastState == _form.WindowState) { return; } Form.Invalidate(); _lastState = _form.WindowState; }
private void btApply_Click(object sender, System.EventArgs e) { try { objLine.Name = txtName.Text; objLine.Point1 = new Point(int.Parse(txtX1.Text), int.Parse(txtY1.Text)); objLine.Point2 = new Point(int.Parse(txtX2.Text), int.Parse(txtY2.Text)); objLine.LineWidth = float.Parse(txtWidth.Text); objLine.Color = lblColor.BackColor; } catch { } frmOwner.Invalidate(); }
void _form_Layout(object sender, LayoutEventArgs e) { if (_lastState == _form.WindowState) { return; } if (WinApi.IsGlassEnabled) { Form.Invalidate(); } else // on XP systems Invalidate is not sufficient in case the Form contains a control with DockStyle.Fill { Form.Refresh(); } _lastState = _form.WindowState; }
/// <summary> /// Gives a dialog window the style WS_THICKFRAME. This makes a dialog sizeable /// in combination with WS_EX_DLGMODALFRAME. In effect the window is sizeabe, has /// a dialog frame, a system menu, a close box, but no system menu button. /// </summary> public static void MakeDialogSizable(Form form) { // LexiROM says it is 'sizeable'?? // MSDN search hits: sizeable 19, sizable 90 // From MSDN documentation of AccessibleStates: // Sizeable A sizable object. // TODO use create params instead of this hack... if (form != null) { int ws = GetWindowLong(form.Handle, GWL_STYLE); ws = ws | 0x00040000; SetWindowLong(form.Handle, GWL_STYLE, ws); // Force a WM_NCCALCSIZE //User32.SetWindowPos(_form.Handle, IntPtr.Zero, 0, 0, 0, 0, SWP_FRAMECHANGED); form.Invalidate(); } }
public void TestPublicMethods () { // Public Methods that force Handle creation: // - CreateGraphics () // - GetChildAtPoint () // - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created // - PointToClient () // - PointToScreen () // - RectangleToClient () // - RectangleToScreen () // - Select () // - Show (IWin32Window) // Notes: // - CreateControl does NOT force Handle creation! Form c = new Form (); c.BringToFront (); Assert.IsFalse (c.IsHandleCreated, "A1"); c.Contains (new Form ()); Assert.IsFalse (c.IsHandleCreated, "A2"); c.CreateControl (); Assert.IsFalse (c.IsHandleCreated, "A3"); c = new Form (); Graphics g = c.CreateGraphics (); g.Dispose (); Assert.IsTrue (c.IsHandleCreated, "A4"); c.Dispose (); c = new Form (); c.Dispose (); Assert.IsFalse (c.IsHandleCreated, "A5"); c = new Form (); // This is weird, it causes a form to appear that won't go away until you move the mouse over it, // but it doesn't create a handle?? //DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None); //Assert.IsFalse (c.IsHandleCreated, "A6"); //Assert.AreEqual (DragDropEffects.None, d, "A6b"); //Bitmap b = new Bitmap (100, 100); //c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100)); //Assert.IsFalse (c.IsHandleCreated, "A7"); //b.Dispose (); c.FindForm (); Assert.IsFalse (c.IsHandleCreated, "A8"); c.Focus (); Assert.IsFalse (c.IsHandleCreated, "A9"); c.GetChildAtPoint (new Point (10, 10)); Assert.IsTrue (c.IsHandleCreated, "A10"); c.Dispose (); c = new Form (); c.GetContainerControl (); Assert.IsFalse (c.IsHandleCreated, "A11"); c.Dispose (); c = new Form (); c.GetNextControl (new Control (), true); Assert.IsFalse (c.IsHandleCreated, "A12"); c.GetPreferredSize (Size.Empty); Assert.IsFalse (c.IsHandleCreated, "A13"); c.Hide (); Assert.IsFalse (c.IsHandleCreated, "A14"); c.Invalidate (); Assert.IsFalse (c.IsHandleCreated, "A15"); //c.Invoke (new InvokeDelegate (InvokeMethod)); //Assert.IsFalse (c.IsHandleCreated, "A16"); c.PerformLayout (); Assert.IsFalse (c.IsHandleCreated, "A17"); c.PointToClient (new Point (100, 100)); Assert.IsTrue (c.IsHandleCreated, "A18"); c.Dispose (); c = new Form (); c.PointToScreen (new Point (100, 100)); Assert.IsTrue (c.IsHandleCreated, "A19"); c.Dispose (); c = new Form (); //c.PreProcessControlMessage ??? //c.PreProcessMessage ??? c.RectangleToClient (new Rectangle (0, 0, 100, 100)); Assert.IsTrue (c.IsHandleCreated, "A20"); c.Dispose (); c = new Form (); c.RectangleToScreen (new Rectangle (0, 0, 100, 100)); Assert.IsTrue (c.IsHandleCreated, "A21"); c.Dispose (); c = new Form (); c.Refresh (); Assert.IsFalse (c.IsHandleCreated, "A22"); c.ResetBackColor (); Assert.IsFalse (c.IsHandleCreated, "A23"); c.ResetBindings (); Assert.IsFalse (c.IsHandleCreated, "A24"); c.ResetCursor (); Assert.IsFalse (c.IsHandleCreated, "A25"); c.ResetFont (); Assert.IsFalse (c.IsHandleCreated, "A26"); c.ResetForeColor (); Assert.IsFalse (c.IsHandleCreated, "A27"); c.ResetImeMode (); Assert.IsFalse (c.IsHandleCreated, "A28"); c.ResetRightToLeft (); Assert.IsFalse (c.IsHandleCreated, "A29"); c.ResetText (); Assert.IsFalse (c.IsHandleCreated, "A30"); c.SuspendLayout (); Assert.IsFalse (c.IsHandleCreated, "A31"); c.ResumeLayout (); Assert.IsFalse (c.IsHandleCreated, "A32"); c.Scale (new SizeF (1.5f, 1.5f)); Assert.IsFalse (c.IsHandleCreated, "A33"); c.Select (); Assert.IsTrue (c.IsHandleCreated, "A34"); c.Dispose (); c = new Form (); c.SelectNextControl (new Control (), true, true, true, true); Assert.IsFalse (c.IsHandleCreated, "A35"); c.SetBounds (0, 0, 100, 100); Assert.IsFalse (c.IsHandleCreated, "A36"); c.Update (); Assert.IsFalse (c.IsHandleCreated, "A37"); // Form c.Activate (); Assert.IsFalse (c.IsHandleCreated, "F1"); c.AddOwnedForm (new Form ()); Assert.IsFalse (c.IsHandleCreated, "F2"); c.Close (); Assert.IsFalse (c.IsHandleCreated, "F3"); c.Hide (); Assert.IsFalse (c.IsHandleCreated, "F4"); c.LayoutMdi (MdiLayout.Cascade); Assert.IsFalse (c.IsHandleCreated, "F5"); #if !MONO c.PerformAutoScale (); Assert.IsFalse (c.IsHandleCreated, "F6"); #endif c.PerformLayout (); Assert.IsFalse (c.IsHandleCreated, "F7"); c.AddOwnedForm (new Form ()); c.RemoveOwnedForm (c.OwnedForms [c.OwnedForms.Length - 1]); Assert.IsFalse (c.IsHandleCreated, "F8"); c.ScrollControlIntoView (null); Assert.IsFalse (c.IsHandleCreated, "F9"); c.SetAutoScrollMargin (7, 13); Assert.IsFalse (c.IsHandleCreated, "F10"); c.SetDesktopBounds (-1, -1, 144, 169); Assert.IsFalse (c.IsHandleCreated, "F11"); c.SetDesktopLocation (7, 13); Assert.IsFalse (c.IsHandleCreated, "F12"); c = new Form (); c.Show (null); Assert.IsTrue (c.IsHandleCreated, "F13"); c.Close (); c = new Form (); //c.ShowDialog () c.ToString (); Assert.IsFalse (c.IsHandleCreated, "F14"); c.Validate (); Assert.IsFalse (c.IsHandleCreated, "F15"); #if !MONO c.ValidateChildren (); Assert.IsFalse (c.IsHandleCreated, "F16"); #endif c.Close (); }
void _form_ResizeEnd(object sender, EventArgs e) { UpdateRibbonConditions(); Form.Invalidate(); }
public static void SetGlassEffect(Form Frm, int fromTop = 0, int fromRight = 0, int fromBottom = 0, int fromLeft = 0) { if (GlassEnabled && (Frm != null)) { APIs.MARGINS margins = new APIs.MARGINS { Top = fromTop, Right = fromRight, Left = fromLeft, Bottom = fromBottom }; APIs.DwmExtendFrameIntoClientArea(Frm.Handle, ref margins); Frm.Invalidate(); } }
/// <summary> /// Processes the WndProc for a form with a Ribbbon. Returns true if message has been handled /// </summary> /// <param name="m">Message to process</param> /// <returns><c>true</c> if message has been handled. <c>false</c> otherwise</returns> public virtual bool WndProc(ref Message m) { if (DesignMode) { return(false); } bool handled = false; if (WinApi.IsVista) { #region Checks if DWM processes the message IntPtr result; int dwmHandled = WinApi.DwmDefWindowProc(m.HWnd, m.Msg, m.WParam, m.LParam, out result); if (dwmHandled == 1) { m.Result = result; handled = true; } #endregion } //if (m.Msg == WinApi.WM_NCLBUTTONUP) //{ // UpdateRibbonConditions(); //} if (!handled) { if (m.Msg == WinApi.WM_NCCALCSIZE && (int)m.WParam == 1) { #region Catch the margins of what the client area would be WinApi.NCCALCSIZE_PARAMS nccsp = (WinApi.NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam, typeof(WinApi.NCCALCSIZE_PARAMS)); if (!MarginsChecked) { //Set what client area would be for passing to DwmExtendIntoClientArea SetMargins(new Padding( nccsp.rect2.Left - nccsp.rect1.Left, nccsp.rect2.Top - nccsp.rect1.Top, nccsp.rect1.Right - nccsp.rect2.Right, nccsp.rect1.Bottom - nccsp.rect2.Bottom)); MarginsChecked = true; } Marshal.StructureToPtr(nccsp, m.LParam, false); m.Result = IntPtr.Zero; handled = true; #endregion } else if (m.Msg == WinApi.WM_NCHITTEST && (int)m.Result == 0) { #region Check the Non-client area hit test m.Result = new IntPtr(Convert.ToInt32(NonClientHitTest(new Point(WinApi.LoWord((int)m.LParam), WinApi.HiWord((int)m.LParam))))); handled = true; if (Ribbon != null && Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaCustomDrawn) { Form.Invalidate(); } #endregion } //else if ((m.Msg == WinApi.WM_SIZE) && Ribbon != null && Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass) //{ // //UpdateRibbonConditions(); //} else if ( (Ribbon != null && Ribbon.ActualBorderMode != RibbonWindowMode.NonClientAreaCustomDrawn) && (m.Msg == 0x112 || m.Msg == 0x47 || m.Msg == 0x46 || m.Msg == 0x2a2)) //WM_SYSCOMMAND { //InvalidateCaption(); //using (Graphics g = Form.CreateGraphics()) //{ // g.DrawRectangle(Pens.Red, new Rectangle(Form.Width - 200, 0, 200, 50)); //} }/* * else if ( * (Ribbon != null && Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaCustomDrawn) && * (m.Msg == 0x86 || m.Msg == 0x85 || m.Msg == 0xc3c2 || m.Msg == 0xc358) * ) * { * m.Result = new IntPtr(-1); * handled = true; * }*/ } return(handled); }
public void createCardTooltip(int tooltipID, int data, Form parent, bool force) { int totalSeconds; if (((this.lastTooltip == tooltipID) && (this.lastData == data)) && !force) { WorldData localWorldData = GameEngine.Instance.LocalWorldData; DateTime time3 = VillageMap.getCurrentServerTime(); CardData userCardData = GameEngine.Instance.World.UserCardData; DateTime minValue = DateTime.MinValue; totalSeconds = 0; int length = userCardData.cards.Length; for (int i = 0; i < length; i++) { int cardType = userCardData.cards[i]; if (cardType == data) { minValue = userCardData.cardsExpiry[i]; TimeSpan span2 = (TimeSpan) (minValue - time3); CardTypes.getCardDuration(cardType); totalSeconds = (int) span2.TotalSeconds; if (totalSeconds < 0) { totalSeconds = 0; } if (span2.TotalDays > 100.0) { totalSeconds = -1; } break; } } } else { this.lastText = "x"; this.lastData = data; this.lastTooltip = tooltipID; parent.Size = new Size(300, 240); base.clearControls(); this.background.Size = parent.Size; this.background.Position = new Point(0, 0); base.addControl(this.background); this.background.Create((Image) GFXLibrary.cardpanel_grey_9slice_left_top, (Image) GFXLibrary.cardpanel_grey_9slice_middle_top, (Image) GFXLibrary.cardpanel_grey_9slice_right_top, (Image) GFXLibrary.cardpanel_grey_9slice_left_middle, (Image) GFXLibrary.cardpanel_grey_9slice_middle_middle, (Image) GFXLibrary.cardpanel_grey_9slice_right_middle, (Image) GFXLibrary.cardpanel_grey_9slice_left_bottom, (Image) GFXLibrary.cardpanel_grey_9slice_middle_bottom, (Image) GFXLibrary.cardpanel_grey_9slice_right_bottom); this.cardTooltipName.Text = CardTypes.getDescriptionFromCard(data); this.cardTooltipName.Color = ARGBColors.Black; this.cardTooltipName.Position = new Point(100, 4); this.cardTooltipName.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); this.cardTooltipName.Size = new Size(190, 40); this.cardTooltipName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.background.addControl(this.cardTooltipName); this.cardTooltipDescription.Text = CardTypes.getEffectTextFromCard(data); this.cardTooltipDescription.Color = ARGBColors.Black; this.cardTooltipDescription.Position = new Point(100, 50); this.cardTooltipDescription.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.cardTooltipDescription.Size = new Size(190, 100); this.cardTooltipDescription.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.background.addControl(this.cardTooltipDescription); this.cardTooltipImage.Image = (Image) GFXLibrary.Instance.getCardImageBig(data); GFXLibrary.Instance.closeBigCardsLoader(); this.cardTooltipImage.Position = new Point(4, 4); this.cardTooltipImage.Size = new Size(0x5c, 0x83); this.background.addControl(this.cardTooltipImage); switch (CardTypes.getColourFromCard(data)) { case 1: this.cardTooltipImage2.Image = (Image) GFXLibrary.BlueCardOverlayBig; break; case 2: this.cardTooltipImage2.Image = (Image) GFXLibrary.GreenCardOverlayBig; break; case 3: this.cardTooltipImage2.Image = (Image) GFXLibrary.PurpleCardOverlayBig; break; case 4: this.cardTooltipImage2.Image = (Image) GFXLibrary.RedCardOverlayBig; break; case 5: this.cardTooltipImage2.Image = (Image) GFXLibrary.YellowCardOverlayBig; break; } this.cardTooltipImage2.Size = this.cardTooltipImage.Size; this.cardTooltipImage.addControl(this.cardTooltipImage2); if (tooltipID != 0x2710) { if (CardTypes.getCardSubType(data) == 0xc00) { this.cardTooltipTimeLeft.Text = SK.Text("TOOLTIP_CARD_INSTANT", "Instant Card"); } else { int num5 = CardTypes.getCardDuration(data); if ((num5 > 0x474a) || (num5 == 0)) { this.cardTooltipTimeLeft.Text = SK.Text("TOOLTIP_CARD_EXPIRES", "Expires when used"); } else { int secsLeft = (num5 * 60) * 60; string str2 = VillageMap.createBuildTimeString(secsLeft); this.cardTooltipTimeLeft.Text = SK.Text("TOOLTIP_CARD_DURATION", "Duration") + " : " + str2; } } } else { WorldData data1 = GameEngine.Instance.LocalWorldData; DateTime time = VillageMap.getCurrentServerTime(); CardData data2 = GameEngine.Instance.World.UserCardData; DateTime time2 = DateTime.MinValue; int num = 0; int num2 = data2.cards.Length; for (int j = 0; j < num2; j++) { int num4 = data2.cards[j]; if (num4 == data) { time2 = data2.cardsExpiry[j]; TimeSpan span = (TimeSpan) (time2 - time); CardTypes.getCardDuration(num4); num = (int) span.TotalSeconds; if (num < 0) { num = 0; } if (span.TotalDays > 100.0) { num = -1; } break; } } if (num < 0) { this.cardTooltipTimeLeft.Text = SK.Text("TOOLTIP_CARD_EXPIRES", "Expires when used"); } else { string str = VillageMap.createBuildTimeString(num); this.cardTooltipTimeLeft.Text = SK.Text("TOOLTIP_CARD_EXPIRES_IN", "Expires In") + " : " + str; } } this.timeImage.Image = (Image) GFXLibrary.r_building_panel_inset_icon_time; this.timeImage.Position = new Point(10, 0x9e); this.background.addControl(this.timeImage); this.cardTooltipTimeLeft.Color = ARGBColors.Black; this.cardTooltipTimeLeft.Position = new Point(40, 160); this.cardTooltipTimeLeft.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.cardTooltipTimeLeft.Size = new Size(250, 40); this.cardTooltipTimeLeft.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.background.addControl(this.cardTooltipTimeLeft); string str3 = ""; double num7 = CardTypes.getCardEffectValue(data); int num8 = (int) num7; NumberFormatInfo provider = null; if (num8 == num7) { provider = GameEngine.NFI; } else if (CardTypes.getCardType(data) == 0x80d) { provider = GameEngine.NFI_D2; } else { provider = GameEngine.NFI_D1; } if (CardBarGDI.addX(data)) { str3 = "x" + num7.ToString("N", provider); } else if (CardBarGDI.addPlus(data)) { str3 = "+" + num7.ToString("N", provider); } else if (num7 != 0.0) { str3 = num7.ToString("N", provider); } if (CardBarGDI.addPercent(data)) { str3 = str3 + "%"; } if (str3.Length <= 0) { if (tooltipID == 0x2775) { this.cardTooltipEffect.Text = getCardEffectString(data); this.cardTooltipEffect.Color = ARGBColors.Black; this.cardTooltipEffect.Position = new Point(10, 190); this.cardTooltipEffect.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.cardTooltipEffect.Size = new Size(290, 60); this.cardTooltipEffect.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.background.addControl(this.cardTooltipEffect); } else { this.cardTooltipEffect.Text = ""; } } else { switch (CardTypes.getCardType(data)) { case 0xbc0: case 0xbc1: case 0xbc2: str3 = SK.Text("TOOLTIP_CARD_EFFECT_EXPLANATION_CARDTYPE_BASIC_DIPLOMACY", "50% Chance of Averting Enemy Attacks"); break; case 0xc05: case 0xc06: case 0xc07: { int index = GameEngine.Instance.World.getRank(); double num10 = GameEngine.Instance.LocalWorldData.ranks_HonourPerLevel[index]; num10 *= num7; str3 = ((int) num10).ToString("N", GameEngine.NFI); break; } } this.cardTooltipEffect.Text = str3 + " " + getCardEffectString(data); this.cardTooltipEffect.Color = ARGBColors.Black; this.cardTooltipEffect.Position = new Point(10, 190); this.cardTooltipEffect.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.cardTooltipEffect.Size = new Size(290, 60); this.cardTooltipEffect.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.background.addControl(this.cardTooltipEffect); } base.Invalidate(); parent.Invalidate(); return; } if (totalSeconds < 0) { this.cardTooltipTimeLeft.Text = SK.Text("TOOLTIP_CARD_EXPIRES", "Expires when used"); } else { string str4 = VillageMap.createBuildTimeString(totalSeconds); this.cardTooltipTimeLeft.Text = SK.Text("TOOLTIP_CARD_EXPIRES_IN", "Expires In") + " : " + str4; } }
public void setText(string text, int tooltipID, int data, Form parent, bool force) { if ((tooltipID == 0x2710) || (tooltipID == 0x2775)) { this.createCardTooltip(tooltipID, data, parent, force); } else if (tooltipID == 0x8d) { this.createVillagePeasant(tooltipID, data, parent, force); } else if ((this.lastText != text) || force) { this.lastText = text; this.lastTooltip = tooltipID; base.clearControls(); this.tooltipLabel.Text = text; this.tooltipLabel.Color = ARGBColors.Black; this.tooltipLabel.Position = new Point(2, 2); this.tooltipLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); Graphics graphics = base.CreateGraphics(); Size size = graphics.MeasureString(text, this.tooltipLabel.Font, 350).ToSize(); graphics.Dispose(); this.tooltipLabel.Size = new Size(size.Width + 1, size.Height + 1); Size size2 = new Size((size.Width + 4) + 1, (size.Height + 4) + 1); if (!size2.Equals(parent.Size)) { parent.Size = size2; } this.tooltipLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.background.Size = size2; this.background.Position = new Point(0, 0); base.addControl(this.background); this.background.Create((Image) GFXLibrary.cardpanel_grey_9slice_left_top, (Image) GFXLibrary.cardpanel_grey_9slice_middle_top, (Image) GFXLibrary.cardpanel_grey_9slice_right_top, (Image) GFXLibrary.cardpanel_grey_9slice_left_middle, (Image) GFXLibrary.cardpanel_grey_9slice_middle_middle, (Image) GFXLibrary.cardpanel_grey_9slice_right_middle, (Image) GFXLibrary.cardpanel_grey_9slice_left_bottom, (Image) GFXLibrary.cardpanel_grey_9slice_middle_bottom, (Image) GFXLibrary.cardpanel_grey_9slice_right_bottom); this.background.addControl(this.tooltipLabel); base.Invalidate(); parent.Invalidate(); } }
public void createVillagePeasant(int tooltipID, int data, Form parent, bool force) { if (((this.lastTooltip != tooltipID) || (this.lastData != data)) || force) { this.lastText = "x"; this.lastData = data; this.lastTooltip = tooltipID; Graphics graphics = base.CreateGraphics(); Font font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); Size size = graphics.MeasureString(SK.Text("TOOLTIP_VILAGEMAP_TOTAL_PEASANTS", "Total Peasants"), font, 800).ToSize(); Size size2 = graphics.MeasureString(SK.Text("TOOLTIP_VILAGEMAP_UNEMPLOYEED_PEASANTS", "Unemployed Peasants"), font, 800).ToSize(); Size size3 = graphics.MeasureString(SK.Text("TOOLTIP_VILAGEMAP_HOUSING_CAPACITY", "Housing Capacity"), font, 800).ToSize(); int width = size.Width; if (size2.Width > width) { width = size2.Width; } if (size3.Width > width) { width = size3.Width; } width += 60; graphics.Dispose(); parent.Size = new Size(width, 100); base.clearControls(); this.background.Size = parent.Size; this.background.Position = new Point(0, 0); base.addControl(this.background); this.background.Create((Image) GFXLibrary.cardpanel_grey_9slice_left_top, (Image) GFXLibrary.cardpanel_grey_9slice_middle_top, (Image) GFXLibrary.cardpanel_grey_9slice_right_top, (Image) GFXLibrary.cardpanel_grey_9slice_left_middle, (Image) GFXLibrary.cardpanel_grey_9slice_middle_middle, (Image) GFXLibrary.cardpanel_grey_9slice_right_middle, (Image) GFXLibrary.cardpanel_grey_9slice_left_bottom, (Image) GFXLibrary.cardpanel_grey_9slice_middle_bottom, (Image) GFXLibrary.cardpanel_grey_9slice_right_bottom); this.peasantsLabel.Text = SK.Text("TOOLTIP_VILAGEMAP_TOTAL_PEASANTS", "Total Peasants"); this.peasantsLabel.Color = ARGBColors.Black; this.peasantsLabel.Position = new Point(10, 10); this.peasantsLabel.Font = font; this.peasantsLabel.Size = new Size(width - 20, 30); this.background.addControl(this.peasantsLabel); this.peasantsValue.Text = "0"; this.peasantsValue.Color = ARGBColors.Black; this.peasantsValue.Position = new Point(10, 10); this.peasantsValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.peasantsValue.Size = new Size(width - 20, 30); this.peasantsValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.background.addControl(this.peasantsValue); this.spareWorkersLabel.Text = SK.Text("TOOLTIP_VILAGEMAP_UNEMPLOYEED_PEASANTS", "Unemployed Peasants"); this.spareWorkersLabel.Color = ARGBColors.Black; this.spareWorkersLabel.Position = new Point(10, 40); this.spareWorkersLabel.Font = font; this.spareWorkersLabel.Size = new Size(width - 20, 30); this.background.addControl(this.spareWorkersLabel); this.spareWorkersValue.Text = "0"; this.spareWorkersValue.Color = ARGBColors.Black; this.spareWorkersValue.Position = new Point(10, 40); this.spareWorkersValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.spareWorkersValue.Size = new Size(width - 20, 30); this.spareWorkersValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.background.addControl(this.spareWorkersValue); this.housingLabel.Text = SK.Text("TOOLTIP_VILAGEMAP_HOUSING_CAPACITY", "Housing Capacity"); this.housingLabel.Color = ARGBColors.Black; this.housingLabel.Position = new Point(10, 70); this.housingLabel.Font = font; this.housingLabel.Size = new Size(width - 20, 30); this.background.addControl(this.housingLabel); this.housingValue.Text = "0"; this.housingValue.Color = ARGBColors.Black; this.housingValue.Position = new Point(10, 70); this.housingValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.housingValue.Size = new Size(width - 20, 30); this.housingValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.background.addControl(this.housingValue); base.Invalidate(); parent.Invalidate(); } VillageMap village = GameEngine.Instance.Village; if (village != null) { this.peasantsValue.Text = village.m_totalPeople.ToString(); this.spareWorkersValue.Text = village.m_spareWorkers.ToString(); this.housingValue.Text = village.m_housingCapacity.ToString(); } }
// Delete the last line drawn on the Scratch Pad from collection. // Does NOT delete the line from the form itself, but calls Invalidate() & Update() // to force a repaint. public void DeleteLastLine(Form frmDraw) { // Retrieve count of LineGraphic objects in collection. int nLineGraphicCount = f_collLineGraphics.Count; // If not empty, delete last line added (drawn). if (nLineGraphicCount > 0) { // Delete last line from LineGraphic collection. f_collLineGraphics.RemoveAt(nLineGraphicCount - 1); // Invalidate entire screen area for repaint. frmDraw.Invalidate(); // Force repaint. frmDraw.Update(); } }
public skine(Form myForm) { m_Parent = myForm; // MeD = new DBGraphics(); textFlags = new TextFormatFlags(); textFlags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter; myForm.Paint += OnPaint; myForm.Resize += OnResize; myForm.MouseDown += OnMouseDown; myForm.MouseUp += OnMouseUp; myForm.MouseMove += OnMouseMove; myForm.MouseDoubleClick += OnMouseDoubbleClick; m_Parent.Padding = new System.Windows.Forms.Padding(Border_Size, (Panel_Move_Size + Border_Size), Border_Size, Border_Size); m_Parent.Invalidate(); // myForm. VisibleChanged += OnVisibleChanged; m_Parent.FormBorderStyle = FormBorderStyle.None; WindowListener wndlisten = new WindowListener(); wndlisten.AssignHandle(this.Handle); m_Parent.Invalidate(); }
static void Main() { network = new DistanceNetwork(2, task.NetworkWidth * task.NetworkHeight); for (int x=0;x<task.NetworkWidth;x++) for (int y = 0; y < task.NetworkHeight; y++) { var n = network.Layers[0].Neurons[x * task.NetworkHeight + y]; n.Weights[0] = rnd.NextDouble() * 0.2 + 0.4; n.Weights[1] = rnd.NextDouble() * 0.2 + 0.4; } learning = new SOMLearning(network, task.NetworkWidth, task.NetworkHeight); learning.LearningRadius = task.LearningRadius; learning.LearningRate = task.LearningRate; Inputs = task.GenerateInputs().ToArray(); pointsPanel = new MyUserControl() { Dock= DockStyle.Fill}; pointsPanel.Paint += DrawPoints; networkPanel = new MyUserControl() { Dock = DockStyle.Fill }; networkPanel.Paint += DrawNetwork; networkGraphControl = new MyUserControl { Dock = DockStyle.Fill }; networkGraphControl.Paint += DrawGraph; var pauseButton = new Button { Text = "Pause/Resume" }; pauseButton.Click+=PauseResume; var table = new TableLayoutPanel() { Dock = DockStyle.Fill, RowCount=2, ColumnCount=2 }; table.Controls.Add(pointsPanel, 0, 0); table.Controls.Add(networkPanel, 0, 1); table.Controls.Add(networkGraphControl, 1, 0); table.Controls.Add(pauseButton,1,1); // table.Controls.Add(pause, 1, 1); table.RowStyles.Add(new RowStyle(SizeType.Percent, 50f)); table.RowStyles.Add(new RowStyle(SizeType.Percent, 50f)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); form = new Form() { ClientSize = new Size(600, 600), Controls = { table } }; timer = new System.Windows.Forms.Timer(); timer.Tick += (sender, args) => { Learning(); form.Invalidate(true); }; timer.Interval = 100; timer.Start(); Application.Run(form); }
private void InvalidateNonGlassClientArea(Form form) { Padding glassMargin = GetGlassMargins(form); if (glassMargin != Padding.Empty) { Rectangle rect = new Rectangle(glassMargin.Left, glassMargin.Top, form.ClientRectangle.Width - glassMargin.Right, form.ClientRectangle.Height - glassMargin.Bottom); form.Invalidate(rect, false); } }
/// <summary> /// Sets the glass margins. /// </summary> /// <param name="form">The <see cref="System.Windows.Forms.Form"/> to be extended.</param> /// <param name="value">The margins where the glass will be extended.</param> public void SetGlassMargins(Form form, Padding value) { GlassFormProperties prop = GetFormProperties(form); if (value == null || value == Padding.Empty) { prop.GlassMargins = Padding.Empty; UnhookForm(form); } else { prop.GlassMargins = value; form.Paint += new PaintEventHandler(form_Paint); if (!form.IsDesignMode()) { form.MouseDown += new MouseEventHandler(form_MouseDown); form.MouseMove += new MouseEventHandler(form_MouseMove); form.MouseUp += new MouseEventHandler(form_MouseUp); form.Resize += new EventHandler(form_Resize); form.Shown += new EventHandler(form_Shown); } } form.Invalidate(); }
void GetNeuroData() { Form frm = new Form(); ProgressBar pb = new ProgressBar(); frm.Controls.Add(pb); frm.Width = 300; frm.Height = 50; frm.TopMost = true; frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; pb.Visible = true; pb.Maximum = NNH.Signes.Count; pb.Value = 0; pb.Height = 50; pb.Dock = DockStyle.Fill; pb.Invalidate(); Application.DoEvents(); frm.Show(); int n = 0; for (int i = 0; i < NNH.Signes.Count ; i++) { if (i%5==0) { pb.Value = n; pb.Refresh(); frm.Invalidate(); Application.DoEvents(); } if (NNH.Signes[i].Spectr == null) { NNH.Signes[i].Spectr = (GetDoubAr(SpecA.GetRawSpectrData(NNH.Signes[i].filepath, BassGetSpectrum.Spectrum.FFTSize.FFT1024, 30, 10000))); } var item = NNH.Signes[i]; NNH.GetNeuroData(ref item); NNH.Signes[i].NeuroDays = item.NeuroDays; NNH.Signes[i].NeuroHours = item.NeuroHours; n++; } frm.Close(); }
void GetAllSignes() { Form frm = new Form(); ProgressBar pb = new ProgressBar(); frm.Controls.Add(pb); frm.Width = 200; frm.Height = 50; frm.TopMost = true; frm.Show(); frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; pb.Visible = true; pb.Dock = DockStyle.Fill; pb.Maximum = listBox1b.Items.Count ; pb.Value = 0; int n = 0; foreach (var item in listBox1b.Items) { pb.Value = n; frm.Invalidate(); Application.DoEvents(); pb.Refresh(); Application.DoEvents(); NNH.GetBaseSign((string)item); n++; } frm.Close(); }
public void setText(int tutorialID, Form parent, bool force) { this.lastTutorialID = tutorialID; m_parent = parent; base.clearControls(); this.transparentBackground.Size = base.Size; this.transparentBackground.FillColor = Color.FromArgb(0xff, 0, 0xff); base.addControl(this.transparentBackground); this.background.Position = new Point(0, 0); this.background.Image = (Image) GFXLibrary.tutorial_background; this.background.Size = new Size(this.background.Image.Width, this.background.Image.Height); base.addControl(this.background); this.advisor.Image = (Image) GFXLibrary.tutorial_longarm1; int index = 0; switch (tutorialID) { case 0: this.advisor.Image = (Image) GFXLibrary.tutorial_longarm3; break; case 2: index = 2; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm6; break; case 3: index = 4; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm2; break; case 5: index = 5; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm1; break; case 6: index = 6; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm11; break; case 7: index = 7; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm2; break; case 8: index = 8; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm3; break; case 10: index = 11; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm11; break; case 11: index = 12; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm8; break; case 12: index = 13; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm6; break; case -25: index = -1; break; case 100: index = 1; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm2; break; case 0x65: index = 3; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm5; break; case 0x66: index = 9; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm5; break; case 0x67: index = 10; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm1; break; case 0x68: index = 14; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm10; break; case 0x69: index = 15; this.advisor.Image = (Image) GFXLibrary.tutorial_longarm1; break; } this.advisor.Position = new Point(5, (base.Height - this.advisor.Image.Height) - 3); base.addControl(this.advisor); try { this.illustration.Image = (Image) GFXLibrary.tutorial_illustrations[index]; this.illustration.Position = new Point(0x26a, 0x1f); this.illustration.ClipRect = new Rectangle(0, 0, 150, 0xac); this.background.addControl(this.illustration); } catch (Exception) { } if (tutorialID == -25) { this.headerLabel.Text = SK.Text("QuestRewardPopup_Reward", "Reward"); } else { this.headerLabel.Text = Tutorials.getTutorialHeaderText(tutorialID); } this.headerLabel.Color = ARGBColors.Black; this.headerLabel.Position = new Point(0, 2); this.headerLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Regular); this.headerLabel.Size = new Size(this.background.Width - 30, 40); this.headerLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.background.addControl(this.headerLabel); this.bodyLabel.Text = Tutorials.getTutorialBodyText(tutorialID); this.rewardLabel.Text = ""; this.rewardLabel.Color = ARGBColors.Black; this.rewardLabel.Position = new Point(120, 40); this.rewardLabel.Font = FontManager.GetFont("Arial", 13f, FontStyle.Bold); this.rewardLabel.Size = new Size(510, 0x8a); this.rewardLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.background.addControl(this.rewardLabel); this.bodyLabel.Color = ARGBColors.Black; this.bodyLabel.Position = new Point(120, 0x20); this.bodyLabel.Font = FontManager.GetFont("Arial", 13f, FontStyle.Bold); this.bodyLabel.Size = new Size(510, 0x8a); this.bodyLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.background.addControl(this.bodyLabel); if (this.bodyLabel.TextSize.Height > 120) { this.bodyLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); if (this.bodyLabel.TextSize.Height > 120) { this.bodyLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold); } } int lastStageID = this.lastStageID; for (int i = 0; i < Tutorials.tutorialOrdering.Length; i++) { if (Tutorials.tutorialOrdering[i] == tutorialID) { lastStageID = i; break; } } this.lastStageID = lastStageID; this.stageLabel.Text = ((lastStageID + 1)).ToString() + "/15"; this.stageLabel.Color = ARGBColors.Black; this.stageLabel.Position = new Point(0x174, 7); this.stageLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold); this.stageLabel.Size = new Size(0x13e, 0x3a); this.stageLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.background.addControl(this.stageLabel); this.closeButton.ImageNorm = (Image) GFXLibrary.int_button_close_normal; this.closeButton.ImageOver = (Image) GFXLibrary.int_button_close_over; this.closeButton.ImageClick = (Image) GFXLibrary.int_button_close_in; this.closeButton.Position = new Point(this.background.Size.Width - 40, 0); this.closeButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeTutorial), "TutorialPanel_close"); this.background.addControl(this.closeButton); this.minimizeButton.ImageNorm = (Image) GFXLibrary.minimize_Normal; this.minimizeButton.ImageOver = (Image) GFXLibrary.minimize_Over; this.minimizeButton.Position = new Point((this.background.Size.Width - 40) - 40, 0); this.minimizeButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(TutorialPanel.minimizeTutorial), "TutorialPanel_minimize"); this.background.addControl(this.minimizeButton); bool autoAdvance = false; QuestsPanel2.Instance.downloadedQuestInfo = false; if (tutorialID != -100) { if (!this.hasCollectableReward()) { this.advanceButton.ImageNorm = (Image) GFXLibrary.tutorial_button_normal; this.advanceButton.ImageOver = (Image) GFXLibrary.tutorial_button_over; this.advanceButton.Position = new Point(280, 0xa9); this.advanceButton.Text.Text = SK.Text("QuestRewardPopup_Next", "Next"); this.advanceButton.TextYOffset = -3; this.advanceButton.Text.Color = ARGBColors.White; this.advanceButton.Text.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); this.advanceButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.advanceTutorial), "TutorialPanel_advance"); this.advanceButton.Visible = true; this.advanceButton.Enabled = this.isNextButtonAvailable(ref autoAdvance); this.background.addControl(this.advanceButton); this.collectRewardButton.Visible = false; } else { this.advanceButton.ImageNorm = (Image) GFXLibrary.tutorial_button_normal; this.advanceButton.ImageOver = (Image) GFXLibrary.tutorial_button_over; this.advanceButton.Position = new Point(380, 0xa9); this.advanceButton.Text.Text = SK.Text("QuestRewardPopup_Next", "Next"); this.advanceButton.TextYOffset = -3; this.advanceButton.Text.Color = ARGBColors.White; this.advanceButton.Text.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); this.advanceButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.advanceTutorial), "TutorialPanel_advance"); this.advanceButton.Visible = false; this.advanceButton.Enabled = false; this.background.addControl(this.advanceButton); this.collectRewardButton.ImageNorm = (Image) GFXLibrary.tutorial_button_normal; this.collectRewardButton.ImageOver = (Image) GFXLibrary.tutorial_button_over; this.collectRewardButton.Position = new Point(280, 0xa9); this.collectRewardButton.Text.Text = SK.Text("QuestRewardPopup_Collect_Reward", "Collect Reward"); this.collectRewardButton.TextYOffset = -3; this.collectRewardButton.Text.Color = ARGBColors.White; if (Program.mySettings.LanguageIdent == "fr") { this.collectRewardButton.Text.Font = FontManager.GetFont("Arial", 11f, FontStyle.Bold); } else { this.collectRewardButton.Text.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); } this.collectRewardButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.collectReward), "TutorialPanel_collect_reward"); this.collectRewardButton.Visible = true; if (tutorialID == -25) { this.collectRewardButton.Enabled = true; } else { this.collectRewardButton.Enabled = false; } this.background.addControl(this.collectRewardButton); } } else { this.cancelButton.ImageNorm = (Image) GFXLibrary.tutorial_button_normal; this.cancelButton.ImageOver = (Image) GFXLibrary.tutorial_button_over; this.cancelButton.Position = new Point(180, 0xa9); this.cancelButton.Text.Text = SK.Text("GENERIC_Cancel", "Cancel"); this.cancelButton.TextYOffset = -3; this.cancelButton.Text.Color = ARGBColors.White; this.cancelButton.Text.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); this.cancelButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.cancelTutorialQuit), "TutorialPanel_cancel"); this.cancelButton.Visible = true; this.background.addControl(this.cancelButton); this.quitButton.ImageNorm = (Image) GFXLibrary.tutorial_button_normal; this.quitButton.ImageOver = (Image) GFXLibrary.tutorial_button_over; this.quitButton.Position = new Point(380, 0xa9); this.quitButton.Text.Text = SK.Text("QuestRewardPopup_Exit_Tutorial", "Exit Tutorial"); this.quitButton.TextYOffset = -3; this.quitButton.Text.Color = ARGBColors.White; this.quitButton.Text.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); this.quitButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.quitTutorial), "TutorialPanel_quit"); this.quitButton.Visible = true; this.background.addControl(this.quitButton); } if (tutorialID == 0x68) { this.advanceButton.Text.Text = SK.Text("QuestRewardPopup_Complete_The_Tutorial", "Complete the Tutorial"); if (Program.mySettings.LanguageIdent.ToLower() == "de") { this.advanceButton.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold); } } base.Invalidate(); if (parent != null) { parent.Invalidate(); } if (autoAdvance && !GameEngine.Instance.World.TutorialIsAdvancing()) { this.advanceTutorial(); } else { this.update(); } }
protected virtual void Activate() { form.Invalidate(true); form.Update(); }
public void ParseClick(int x, int y) { //Find cell where mouse clicked and change it's state if (XYinGrid(x, y)) { int X = (x - OffX) / CellW; int Y = (y - OffY) / CellH; ClopWar.MakeMove(X, Y); cx = X; cy = Y; OwnerForm.Invalidate(); } }
public static void ChangePanel(Form frm,Control panel) { if (frm != null && panel != null) { FT.Commons.Win32.WindowFormDelegate.RemoveAllControlFrom(frm); frm.MaximizeBox = true; frm.MinimizeBox = true; frm.FormBorderStyle = FormBorderStyle.Sizable; frm.StartPosition = FormStartPosition.Manual; frm.WindowState = FormWindowState.Normal; frm.Parent = null; // MessageBox.Show("1-现有窗体宽度为Width:" + frm.Width.ToString() + ":Height:" + frm.Height.ToString()); frm.MaximumSize = new Size(panel.Width, panel.Height); frm.MinimumSize = new Size(panel.Width, panel.Height); frm.Width = panel.Width; frm.Height = panel.Height; //frm.WindowState = FormWindowState.Maximized; //System.Threading.Thread.Sleep(1000); //frm. // MessageBox.Show("2-现有窗体宽度为Width:" + frm.Width.ToString() + ":Height:" + frm.Height.ToString()); // frm.Size = new Size(panel.Width, panel.Height); // frm.BackColor = Color.Red; panel.Dock = DockStyle.Fill; //frm.StartPosition = FormStartPosition.CenterScreen; WinFormHelper.CenterForm(frm); FT.Commons.Win32.WindowFormDelegate.AddControlTo(frm, panel); frm.FormBorderStyle = FormBorderStyle.None; frm.Invalidate(); // frm.ResumeLayout(true); // frm.PerformLayout(); //MessageBox.Show("3-现有窗体宽度为Width:" + frm.Width.ToString() + ":Height:" + frm.Height.ToString()); //frm.Controls.Add(panel); } }