本文整理汇总了C#中System.Windows.Forms.Label.Invalidate方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Invalidate方法的具体用法?C# Label.Invalidate怎么用?C# Label.Invalidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Label
的用法示例。
在下文中一共展示了Label.Invalidate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitBorderTitle
public static void InitBorderTitle(this Control ctrl, Window window, Control child)
{
if (window is ActiveWindow)
{
ActiveWindow wnd = (ActiveWindow)window;
if (ctrl.Controls.ContainsKey("LabelTitle")) ctrl.Controls.RemoveByKey("LabelTitle");
if (wnd.BorderVisible)
{
ctrl.SuspendLayout();
child.SuspendLayout();
child.Left += wnd.BorderWidth;
child.Width -= wnd.BorderWidth << 1;
child.Height -= wnd.BorderWidth;
System.Windows.Forms.Label title = new System.Windows.Forms.Label();
title.AutoSize = false;
title.Name = "LabelTitle";
title.BackColor = wnd.BorderColorFrienly;
title.Font = new Font(wnd.TitleFont, wnd.TitleSize);
title.ForeColor = wnd.TitleColorFrienly;
title.Text = wnd.TitleText;
title.Left = wnd.BorderWidth;
title.Top = 0;
using (Graphics g = title.CreateGraphics())
{
title.Size = g.MeasureString(wnd.TitleText, title.Font).ToSize();
}
title.Width = child.Width;
title.AutoEllipsis = true;
title.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ctrl.Controls.Add(title);
if (title.Height == 0)
{
child.Top += wnd.BorderWidth;
child.Height -= wnd.BorderWidth;
}
else
{
child.Top += title.Height;
child.Height -= title.Height;
}
ctrl.BackColor = wnd.BorderColorFrienly;
child.ResumeLayout();
ctrl.ResumeLayout();
title.Invalidate();
}
ctrl.Text = wnd.TitleText;
}
}
示例2: goGenerateProcessesFriendship
//.........这里部分代码省略.........
// panel1.Controls.Add(areYouSeriouslyStillDoingThisLetItGo);
// Oh
// I can just make another form to draw over and go have turnips with parameters
// Also credits to Microsoft Word's "Sentence Case" option as this came out in all caps originally
//Measuring string turnt-up-edness was guided by an answer on Stack Overflow by Tom Anderson.
String keepThisShortWeNeedToOptimize = Process.GetProcessById(theProcess.Id).MainWindowTitle;
Graphics heyGuessWhatGraphicsYeahThatsRight = Graphics.FromImage(new Bitmap(1, 1));
SizeF sure = heyGuessWhatGraphicsYeahThatsRight.MeasureString(keepThisShortWeNeedToOptimize, new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular, GraphicsUnit.Point));
Size sureAgain = sure.ToSize();
int recordThatJim;
if (sureAgain.Width >= 300)
{
recordThatJim = sureAgain.Width + 10;
}
else
{
recordThatJim = 300;
}
CanWeMakeAHoverFormLikeThisIsThisLegal notAsLongInstanceName = new CanWeMakeAHoverFormLikeThisIsThisLegal(recordNao + 150, bottomPanel.Height, recordThatJim, keepThisShortWeNeedToOptimize);
notAsLongInstanceName.Show();
notAsLongInstanceName.BringToFront();
//hmGreatJobFantasticAmazing.BringToFront();
//panel1.Controls.Add(hmGreatJobFantasticAmazing);
//hmGreatJobFantasticAmazing.Top = bottomPanel.Top - 40;
//hmGreatJobFantasticAmazing.Left = recordNao + 150;
//hmGreatJobFantasticAmazing.BringToFront();
//hmGreatJobFantasticAmazing.Invalidate();
/*hmGreatJobFantasticAmazing.Height = 100;
hmGreatJobFantasticAmazing.Width = 100;*/
};
hmGreatJobFantasticAmazing.MouseLeave += (sender, args) =>
{
/*hmGreatJobFantasticAmazing.ImageAlign = ContentAlignment.MiddleCenter;
hmGreatJobFantasticAmazing.AutoEllipsis = false;
hmGreatJobFantasticAmazing.Width = 40;
hmGreatJobFantasticAmazing.BackColor = Color.Transparent;
//hmGreatJobFantasticAmazing.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular);
//hmGreatJobFantasticAmazing.ForeColor = Color.White;
hmGreatJobFantasticAmazing.TextAlign = ContentAlignment.MiddleLeft;
hmGreatJobFantasticAmazing.Text = "";*/
try
{
Application.OpenForms["CanWeMakeAHoverFormLikeThisIsThisLegal"].Close();
}
catch (Exception exTurnip)
{
}
hmGreatJobFantasticAmazing.BackColor = Color.Transparent;
hmGreatJobFantasticAmazing.Invalidate();
Properties.Settings.Default.stayHere = false;
Properties.Settings.Default.Save();
};
//openFileToolTip.SetToolTip(hmGreatJobFantasticAmazing, theProcess.MainWindowTitle);
//hmGreatJobFantasticAmazing.BackgroundImage = Icon.ExtractAssociatedIcon(theProcess.Modules[0].FileName).ToBitmap();
hmGreatJobFantasticAmazing.Height = bottomPanel.Height;
hmGreatJobFantasticAmazing.Width = 50;
spaceForProcesses.Controls.Add(hmGreatJobFantasticAmazing);
hmGreatJobFantasticAmazing.Invalidate();
}}
}
currentCountProc = artOfficial;
}
示例3: PB_Pet_Load
private void PB_Pet_Load(PBwithText_v2 pB, Label label, BattlePet pet)
{
if (pet.Name == "nil") { pB.Text = ""; }
else
{
pB.Text = AddInfo(pet);
}
pB.Favourite = pet.IsFavorite;
pB.Percent = pet.HealthPercent;
label.Text = pet.Level.ToString();
if (pet.Rarity > 3)
{ pB.ForeColor = label.ForeColor = Color.DarkBlue; }
else if (pet.Rarity > 2)
{ pB.ForeColor = label.ForeColor = Color.DarkGreen; }
else
{
pB.ForeColor = Color.Black;
label.ForeColor = Color.Gray;
}
pB.Invalidate(); label.Invalidate();
}
示例4: goGenerateProcessesFriendship
private void goGenerateProcessesFriendship()
{
spaceForProcesses.Left = 150;
spaceForProcesses.Width = spaceForProcesses.Width - 150;
spaceForProcesses.Top = bottomPanel.Top;
spaceForProcesses.Height = bottomPanel.Height;
spaceForProcesses.Invalidate();
foreach (var theProcess in Process.GetProcesses())
{
Label hmGreatJobFantasticAmazing = new Label();
// hmGreatJobFantasticAmazing.BackgroundImageLayout = ImageLayout.Center;
if (theProcess.MainWindowTitle != "")
{
//hmGreatJobFantasticAmazing.Text = theProcess.MainWindowTitle;
hmGreatJobFantasticAmazing.Margin = new Padding(6,0,6,0);
hmGreatJobFantasticAmazing.Visible = true;
// hmGreatJobFantasticAmazing.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 13, FontStyle.Italic);
Icon.ExtractAssociatedIcon(theProcess.Modules[0].FileName).ToBitmap().Save(@"C:\ProjectSnowshoes\temptaskico.png");
DualImageForm thanksVKLines = new DualImageForm();
thanksVKLines.pic = Icon.ExtractAssociatedIcon(theProcess.Modules[0].FileName).ToBitmap();
thanksVKLines.analyze();
thanksVKLines.pic2.Save(@"C:\ProjectSnowshoes\newtemptaskico.png");
ImageFactory grayify = new ImageFactory();
grayify.Load(@"C:\ProjectSnowshoes\temptaskico.png");
//grayify.Tint(Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge]));
//grayify.Tint(Color.FromName("Gray"));
hmGreatJobFantasticAmazing.Image = grayify.Image;
Label areYouSeriouslyStillDoingThisLetItGo = new Label();
hmGreatJobFantasticAmazing.Click += (sender, args) =>
{
System.Diagnostics.Process.Start(theProcess.Modules[0].FileName);
};
hmGreatJobFantasticAmazing.MouseHover += (sender, args) =>
{
int recordNao = hmGreatJobFantasticAmazing.Left;
//hmGreatJobFantasticAmazing.BackgroundImageLayout = ImageLayout.Zoom;
//hmGreatJobFantasticAmazing.Height = 75;
/*hmGreatJobFantasticAmazing.ImageAlign = ContentAlignment.MiddleLeft;
hmGreatJobFantasticAmazing.AutoEllipsis = true;
hmGreatJobFantasticAmazing.Width = 250;
hmGreatJobFantasticAmazing.BackColor = Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge]);
hmGreatJobFantasticAmazing.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular);
hmGreatJobFantasticAmazing.ForeColor = Color.White;
hmGreatJobFantasticAmazing.TextAlign = ContentAlignment.MiddleLeft;
hmGreatJobFantasticAmazing.Text = " " + theProcess.MainWindowTitle;*/
hmGreatJobFantasticAmazing.BackColor = Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge]);
areYouSeriouslyStillDoingThisLetItGo.Left = recordNao + 150;
areYouSeriouslyStillDoingThisLetItGo.Text = theProcess.MainWindowTitle;
areYouSeriouslyStillDoingThisLetItGo.BackColor = Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge]);
areYouSeriouslyStillDoingThisLetItGo.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular);
areYouSeriouslyStillDoingThisLetItGo.ForeColor = Color.White;
areYouSeriouslyStillDoingThisLetItGo.TextAlign = ContentAlignment.MiddleLeft;
panel1.Controls.Add(areYouSeriouslyStillDoingThisLetItGo);
//Measuring string turnt-up-edness was guided by an answer on Stack Overflow by Tom Anderson.
Graphics heyGuessWhatGraphicsYeahThatsRight = Graphics.FromImage(new Bitmap(1,1));
SizeF sure = heyGuessWhatGraphicsYeahThatsRight.MeasureString(theProcess.MainWindowTitle, new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular, GraphicsUnit.Point));
Size sureAgain = sure.ToSize();
if (sureAgain.Width >= 300)
{
areYouSeriouslyStillDoingThisLetItGo.Width = sureAgain.Width + 10;
}
else
{
areYouSeriouslyStillDoingThisLetItGo.Width = 300;
}
areYouSeriouslyStillDoingThisLetItGo.Height = bottomPanel.Height;
areYouSeriouslyStillDoingThisLetItGo.Top = Screen.PrimaryScreen.WorkingArea.Height - bottomPanel.Height;
areYouSeriouslyStillDoingThisLetItGo.Show();
areYouSeriouslyStillDoingThisLetItGo.Visible = true;
areYouSeriouslyStillDoingThisLetItGo.BringToFront();
areYouSeriouslyStillDoingThisLetItGo.Invalidate();
//.........这里部分代码省略.........
示例5: makeBookmarkLabel
Label makeBookmarkLabel(Row row)
{
var label = new Label()
{
Text = (string)row.Tag,
AutoSize = true,
TextAlign = ContentAlignment.MiddleCenter,
BackColor = markBack,
ForeColor = Color.Black,
Cursor = Cursors.Hand
};
label.Padding = new Padding(5);
label.Font = new Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel);
label.Click += delegate { syntaxBox.GotoLine(row.Index); };
label.MouseMove += delegate
{
if (row != currentBookmark)
{
label.BackColor = markBackSelect;//colorHex("597E9A");
label.ForeColor = Color.White;
label.Invalidate();
}
};
label.MouseLeave += delegate
{
if (row != currentBookmark)
{
label.BackColor = markBack;
label.ForeColor = Color.Black;
label.Invalidate();
}
};
return label;
}