本文整理汇总了C#中System.Windows.Forms.ComboBox.SuspendLayout方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.SuspendLayout方法的具体用法?C# ComboBox.SuspendLayout怎么用?C# ComboBox.SuspendLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ComboBox
的用法示例。
在下文中一共展示了ComboBox.SuspendLayout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComboBox
public static ComboBox ComboBox(Parts.Attribute attribute, string[] items, ToolTip tooltip = null)
{
try
{
if (String.IsNullOrWhiteSpace(attribute.Name) || items.Length == 0)
{
throw new ArgumentNullException();
}
var comboBox = new ComboBox();
comboBox.SuspendLayout();
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox.ForeColor = System.Drawing.Color.Black;
comboBox.FlatStyle = FlatStyle.Flat;
comboBox.Font = Methods.BaseFont;
comboBox.FormattingEnabled = true;
comboBox.Name = "cb" + attribute.Name;
comboBox.Size = new System.Drawing.Size(121, 21);
comboBox.Items.AddRange(items);
comboBox.Tag = attribute;
if (String.IsNullOrWhiteSpace(attribute.Value))
{
comboBox.SelectedIndex = comboBox.Items.IndexOf(attribute.Default);
}
else
{
comboBox.SelectedIndex = comboBox.Items.IndexOf(attribute.Value);
}
if (tooltip != null)
{
tooltip.SetToolTip(comboBox, attribute.Documentation);
}
comboBox.ResumeLayout();
return comboBox;
}
catch (Exception ex)
{
log.Debug(ex);
return null;
}
}
示例2: PopulateComboBox
public static void PopulateComboBox(ComboBox comboBox, List<string> items)
{
comboBox.SuspendLayout();
comboBox.Items.Clear();
foreach(string item in items)
{
comboBox.Items.Add(item);
}
comboBox.ResumeLayout();
comboBox.SelectedIndex = 0;
}
示例3: DrawForegroundFromButton
private void DrawForegroundFromButton(PaintEventArgs pevent)
{
if (_imageButton == null)
{
_imageButton = new ComboBox();
//_imageButton.Parent = new TransparentControl();
_imageButton.SuspendLayout();
_imageButton.BackColor = Color.White;
//_imageButton.FlatAppearance.BorderSize = 0;
_imageButton.FlatStyle = FlatStyle.Flat;
}
else
{
_imageButton.SuspendLayout();
}
if (Enabled)
{
_imageButton.ForeColor = ForeColor;
}
else
{
_imageButton.ForeColor = Color.FromArgb((3*ForeColor.R + _backColor.R) >> 2,
(3*ForeColor.G + _backColor.G) >> 2,
(3*ForeColor.B + _backColor.B) >> 2);
}
_imageButton.Font = Font;
_imageButton.RightToLeft = RightToLeft;
/*
_imageButton.Image = Image;
if (Image != null && !Enabled)
{
Size size = Image.Size;
float[][] newColorMatrix = new float[5][];
newColorMatrix[0] = new float[] { 0.2125f, 0.2125f, 0.2125f, 0f, 0f };
newColorMatrix[1] = new float[] { 0.2577f, 0.2577f, 0.2577f, 0f, 0f };
newColorMatrix[2] = new float[] { 0.0361f, 0.0361f, 0.0361f, 0f, 0f };
float[] arr = new float[5];
arr[3] = 1f;
newColorMatrix[3] = arr;
newColorMatrix[4] = new float[] { 0.38f, 0.38f, 0.38f, 0f, 1f };
System.Drawing.Imaging.ColorMatrix matrix = new System.Drawing.Imaging.ColorMatrix(newColorMatrix);
System.Drawing.Imaging.ImageAttributes disabledImageAttr = new System.Drawing.Imaging.ImageAttributes();
disabledImageAttr.ClearColorKey();
disabledImageAttr.SetColorMatrix(matrix);
_imageButton.Image = new Bitmap(Image.Width, Image.Height);
using (Graphics gr = Graphics.FromImage(_imageButton.Image))
{
gr.DrawImage(Image, new Rectangle(0, 0, size.Width, size.Height), 0, 0, size.Width, size.Height, GraphicsUnit.Pixel, disabledImageAttr);
}
}
_imageButton.ImageAlign = ImageAlign;
_imageButton.ImageIndex = ImageIndex;
_imageButton.ImageKey = ImageKey;
_imageButton.ImageList = ImageList;
_imageButton.TextAlign = TextAlign;
_imageButton.TextImageRelation = TextImageRelation;
_imageButton.UseCompatibleTextRendering = UseCompatibleTextRendering;
_imageButton.UseMnemonic = UseMnemonic;
*/
_imageButton.Padding = Padding;
_imageButton.Size = Size;
_imageButton.Text = Text;
_imageButton.ResumeLayout();
InvokePaint(_imageButton, pevent);
/*
if (_imageButton.Image != null && _imageButton.Image != Image)
{
_imageButton.Image.Dispose();
_imageButton.Image = null;
}
*/
}