本文整理汇总了C#中System.Windows.Forms.Form.Invalidate方法的典型用法代码示例。如果您正苦于以下问题:C# Form.Invalidate方法的具体用法?C# Form.Invalidate怎么用?C# Form.Invalidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.Invalidate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: show
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();
}
}
}
示例2: setPermission
/// <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();
}
示例3: MakeDialogSizable
/// <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();
}
}
示例4: setText
//.........这里部分代码省略.........
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();
}
}
示例5: Main
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);
}
示例6: createCardTooltip
//.........这里部分代码省略.........
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;
}
}
示例7: createVillagePeasant
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();
}
}
示例8: setText
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();
}
}
示例9: TestPublicMethods
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 ();
//.........这里部分代码省略.........
示例10: ChangePanel
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);
}
}
示例11: InvalidateNonGlassClientArea
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);
}
}
示例12: DeleteLastLine
// 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();
}
}
示例13: SetGlassMargins
/// <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();
}
示例14: GetNeuroData
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();
}
示例15: GetAllSignes
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();
}