当前位置: 首页>>代码示例>>C#>>正文


C# Button.Refresh方法代码示例

本文整理汇总了C#中System.Windows.Forms.Button.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Refresh方法的具体用法?C# Button.Refresh怎么用?C# Button.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Button的用法示例。


在下文中一共展示了Button.Refresh方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Dialog

        public Dialog(string title, string text, string[] buttons)
        {
            InitializeComponent();
            this.Text = title;
            this.DialogText.Text = text;
            this.DialogText.Refresh();
            this.Width = this.DialogText.Width + 24;
            this.Height = this.DialogText.Height + 18;
            this.buttons = new List<Button>();
            this.focusedButton = 0;

            if (buttons.Length > 0)
            {
                this.SuspendLayout();

                int x = 12;
                int y = this.DialogText.Location.Y + this.DialogText.Size.Height + 9;
                int h = 0;

                for (int i = 0; i < buttons.Length; i++)
                {
                    string buttonText = buttons[i];
                    Button button = new Button();
                    button.Location = new System.Drawing.Point(x, y);
                    button.Name = buttonText;
                    button.Text = buttonText;
                    button.AutoSize = true;
                    button.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold);
                    button.UseVisualStyleBackColor = true;
                    button.BackColor = KomMee.ABCDEFKeyboardView.DefaultBackgroundColor;
                    button.ForeColor = KomMee.ABCDEFKeyboardView.DefaultForegroundColor;
                    this.Controls.Add(button);
                    this.buttons.Add(button);
                    button.Refresh();
                    x += button.Width + 9;
                    if(button.Height > h)
                        h = button.Height;
                }
                if (x + 3 > this.Width)
                    this.Width = x + 3;
                this.Height += h + 50;

                this.buttons[this.focusedButton].BackColor = KomMee.ABCDEFKeyboardView.FocusBackgroundColor;
                this.buttons[this.focusedButton].ForeColor = KomMee.ABCDEFKeyboardView.FocusForegroundColor;

                this.ResumeLayout(false);
                this.PerformLayout();

                //this.Location = Input.getDialogLocation(this.Size);
            }
        }
开发者ID:kommee,项目名称:KomMee,代码行数:51,代码来源:Dialog.cs

示例2: GetUacShieldIcon

        // Technique from http://www.vb-helper.com/howto_2008_uac_shield.html
        private Bitmap GetUacShieldIcon()
        {
            const int width = 50;
            const int height = 50;
            const int margin = 4;
            Bitmap shieldImage;
            Button button = new Button()
            {
                Text = " ",
                Size = new Size(width, height),
                FlatStyle = FlatStyle.System
            };

            button.SetShieldIcon(true);

            Bitmap buttonImage = new Bitmap(width, height);

            button.Refresh();
            button.DrawToBitmap(buttonImage, new Rectangle(0, 0, width, height));

            int minX = width;
            int maxX = 0;
            int minY = width;
            int maxY = 0;

            for (int y = margin; y < height - margin; y++)
            {
                var targetColor = buttonImage.GetPixel(margin, y);

                for (int x = margin; x < width - margin; x++)
                {
                    if (buttonImage.GetPixel(x, y).Equals(targetColor))
                    {
                        buttonImage.SetPixel(x, y, Color.Transparent);
                    }
                    else
                    {
                        if (minY > y) minY = y;
                        if (minX > x) minX = x;
                        if (maxY < y) maxY = y;
                        if (maxX < x) maxX = x;
                    }
                }
            }

            int shieldWidth = maxX - minX + 1;
            int shieldHeight = maxY - minY + 1;

            shieldImage = new Bitmap(shieldWidth, shieldHeight);

            using (Graphics g = Graphics.FromImage(shieldImage))
                g.DrawImage(buttonImage, 0, 0, new Rectangle(minX, minY, shieldWidth, shieldHeight), GraphicsUnit.Pixel);

            buttonImage.Dispose();

            return shieldImage;
        }
开发者ID:andyvand,项目名称:ProcessHacker,代码行数:58,代码来源:HackerWindow.cs

示例3: TableColorSelected

 private void TableColorSelected(Color btnColor, Panel opendPanel, Button ClickBtn, MouseEventArgs e)
 {
     int index = ((e.X - 3) / 0x12) + (((e.Y - 3) / 0x12) * 4);
     btnColor = this.m_Color[index];
     ClickBtn.Refresh();
     opendPanel.Visible = false;
 }
开发者ID:xiaoyj,项目名称:Space,代码行数:7,代码来源:ShadingForm.cs

示例4: SetButtonStyle

        public static void SetButtonStyle(Button ctrl)
        {
            IntPtr hWnd;
            int style;

            ctrl.Capture = true;
            hWnd = GetCapture();
            ctrl.Capture = false;

            style = GetWindowLong(hWnd, GWL_STYLE);
            SetWindowLong(hWnd, GWL_STYLE, (style | BS_CENTER | BS_VCENTER |
              BS_MULTILINE));

            ctrl.Refresh();
        }
开发者ID:jpapayan,项目名称:tuberun_wm,代码行数:15,代码来源:Toolbox.cs

示例5: updateTextFile

        private void updateTextFile(int buttonId, String url, String path, String filename, String description, Button button, PictureBox pic, ref String newContents)
        {
            enableButtons(false);
            shouldBeEnabled[buttonId] = false;

            if (readyToGo[buttonId])
            {
                readyToGo[buttonId] = false;

                if (newContents == null)
                {
                    MessageBox.Show(this, "Sorry, no data found. Please close the update window and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    enableButtons(true);
                    pic.Image = Properties.Resources.x;
                    return;
                }

                button.Text = String.Format("Writing updates to {0}.", filename);
                button.Refresh();

                using (StreamWriter sw = new StreamWriter(path, false))
                {
                    sw.Write(newContents);
                    sw.Close();
                }

                button.Text = String.Format("You now have the latest {0}.", description);
                pic.Image = Properties.Resources.check;
                if (buttonId == Blocks)
                {
                    ColorPalette.Reset();
                    ColorPalette.Preload();
                }
                else if (buttonId == Biomes)
                {
                    BiomeType.Reset();
                    ((Form1)Owner).FillLists();
                }

                enableButtons(true);
                return;
            }

            enableButtons(false);
            shouldBeEnabled[buttonId] = false;
            button.Text = String.Format("Checking for updates to {0}.", filename);
            button.Refresh();

            String json = null;

            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Method = "GET";
                request.Headers["Accept-Encoding"] = "gzip,deflate";
                request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
                request.UserAgent = userAgent;
                request.Proxy = null;

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                StreamReader responseStream = new StreamReader(response.GetResponseStream());
                json = responseStream.ReadToEnd();
                response.Close();
                responseStream.Close();
            }
            catch (Exception)
            {
                button.Text = "Unable to connect to GitHub. Please try again later.";
                shouldBeEnabled[buttonId] = true;
                readyToGo[buttonId] = false;
                enableButtons(true);
                pic.Image = Properties.Resources.x;
                return;
            }

            json = json.Replace("\\n", "");

            String serverSha = new Regex("[\"']sha[\"']: ?\"([^\"']+)[\"']", RegexOptions.IgnoreCase | RegexOptions.Multiline).Match(json).Groups[1].Value;

            byte[] raw = File.ReadAllBytes(path);
            byte[] head = Encoding.UTF8.GetBytes("blob " + raw.Length.ToString() + "\0");
            byte[] combined = new byte[head.Length + raw.Length];
            head.CopyTo(combined, 0);
            raw.CopyTo(combined, head.Length);

            SHA1 sha1 = new SHA1CryptoServiceProvider();
            String localSha = BitConverter.ToString(sha1.ComputeHash(combined)).Replace("-", "").ToLower();

            if (serverSha == localSha)
            {
                button.Text = String.Format("You have the latest {0}. No action is necessary.", description);
                shouldBeEnabled[buttonId] = false;
                readyToGo[buttonId] = false;
                enableButtons(true);
                pic.Image = Properties.Resources.check;
            }
            else
            {
                newContents = new Regex("[\"']content[\"']: ?\"([^\"']+)[\"']", RegexOptions.IgnoreCase | RegexOptions.Multiline).Match(json).Groups[1].Value;
                newContents = Encoding.UTF8.GetString(Convert.FromBase64String(newContents));
//.........这里部分代码省略.........
开发者ID:mblaine,项目名称:BiomePainter,代码行数:101,代码来源:Update.cs

示例6: GetButtonLoction

 private void GetButtonLoction(Button btn)
 {
     Point p = new Point(btnEnd.X - btnStart.X, btnEnd.Y - btnStart.Y);
     btn.Location = new Point(btn.Location.X + p.X, btn.Location.Y + p.Y);
     btn.Refresh();
 }
开发者ID:springer126,项目名称:3DPlay,代码行数:6,代码来源:Form1.cs

示例7: setButtonOn

 public void setButtonOn(Button btn, Form frm)
 {
     foreach (Control c in frm.Controls)
     {
         c.Enabled = true;
     }
     btn.Text = originalText;
     originalText = "";
     btn.Refresh();
     Cursor.Current = Cursors.Default; ;
 }
开发者ID:BGCX262,项目名称:zswi-zadanie-svn-to-git,代码行数:11,代码来源:Database.cs

示例8: setButtonOff

 public void setButtonOff(Button btn, Form frm)
 {
     foreach (Control c in frm.Controls)
     {
         c.Enabled = false;
     }
     originalText = btn.Text;
     btn.Text = "Čakajte...";
     btn.Refresh();
     Cursor.Current = Cursors.WaitCursor;
 }
开发者ID:BGCX262,项目名称:zswi-zadanie-svn-to-git,代码行数:11,代码来源:Database.cs

示例9: LoadElements

        public void LoadElements(System.Xml.XmlReader ids)
        {
            TInterfaceElement ie = new TInterfaceElement();
            while (ids.Read())
                if (ids.IsStartElement())
                {
                    switch (ids.Name)
                    {
                        case "SCREEN_Width":
                            {
                                ids.Read();
                                Width = Convert.ToInt16(ids.Value);
                            }; break;
                        case "SCREEN_Height":
                            {
                                ids.Read();
                                Height = Convert.ToInt16(ids.Value);
                            }; break;
                        case "SCREEN_BackColor":
                            {
                                ids.Read();
                                BackColor = utftUtils.GetUTFTColor(ids.Value);
                            }; break;
                        case "SCREEN_FontColor":
                            {
                                ids.Read();
                                FontColor = utftUtils.GetUTFTColor(ids.Value);
                            }; break;
                        case "SCREEN_ABorderColor":
                            {
                                ids.Read();
                                ActiveBorderColor = utftUtils.GetUTFTColor(ids.Value);
                            }; break;
                        case "SCREEN_PBorderColor":
                            {
                                ids.Read();
                                PassiveBorderColor = utftUtils.GetUTFTColor(ids.Value);
                            }; break;
                        case "Desctop":
                            {
                                ids.Read();
                                Image = new System.Drawing.Bitmap(ids.Value);
                            };break;
                        case "Element":
                            ie = new TInterfaceElement();
                            break;
                        case "ItemType":
                            {
                                ids.Read();
                                switch (ids.Value)
                                {
                                    case "Border":
                                        {
                                            Button btn = new Button();

                                            btn.Parent = pnl;
                                            btn.MouseDown += new MouseEventHandler(MouseDown);
                                            btn.MouseMove += new MouseEventHandler(MouseMove);

                                            btn.ContextMenuStrip = pmElement;
                                            btn.Text = "Border";
                                            btn.Refresh();
                                            ie.border = btn;
                                        } break; // button
                                    case "2": break; // edit
                                    case "Label":
                                        {
                                            Label lbl = new Label();

                                            lbl.Parent = pnl;
                                            lbl.MouseDown += new MouseEventHandler(MouseDown);
                                            lbl.MouseMove += new MouseEventHandler(MouseMove);

                                            lbl.Text = "Label";
                                            lbl.ContextMenuStrip = pmElement;
                                            lbl.Refresh();
                                            ie.border = lbl;
                                        } break; // label
                                    case "4": break; // Checker
                                }
                            }
                            break;
                        case "ID": ids.Read(); ie.ID = Convert.ToByte(ids.Value); break;
                        case "ItemName": ids.Read(); ie.ItemName = ids.Value; listitem.Add(ie.ItemName, ie); AddItem(ie); break;
                        case "X": ids.Read(); ie.X = Convert.ToInt16(ids.Value); break;
                        case "Y": ids.Read(); ie.Y = Convert.ToInt16(ids.Value); break;
                        case "Width": ids.Read(); ie.width = Convert.ToInt16(ids.Value); break;
                        case "Height": ids.Read(); ie.heigth = Convert.ToInt16(ids.Value); break;
                        case "BackColor": ids.Read(); ie.BackColor = utftUtils.GetUTFTColor(ids.Value); break;
                        case "FontColor": ids.Read(); ie.FontColor = utftUtils.GetUTFTColor(ids.Value); break;
                        case "CanSelect": ids.Read(); ie.CanSelect = Convert.ToBoolean(ids.Value); break;
                        case "Text": ids.Read(); ie.Text = ids.Value; break;
                    }// ids.Name
                }//while
        }
开发者ID:AbuShaqra,项目名称:ArduGUI,代码行数:95,代码来源:TScreen.cs

示例10: CreateElement

        public void CreateElement()
        {
            Button btn = new Button();

            btn.Parent = pnl;
            btn.MouseDown += new MouseEventHandler(MouseDown);
            btn.MouseMove += new MouseEventHandler(MouseMove);

            btn.ContextMenuStrip = pmElement;
            btn.Text = "Border";
            btn.Refresh();

            TInterfaceElement item = new TInterfaceElement();
            item.border = btn;
            item.ItemName = "Border";
            item.BackColor = VGA_COLOR.VGA_BLACK;
            item.FontColor = VGA_COLOR.VGA_WHITE;
            Boolean err = true;
            int i = 0;
            while (err)
                try
                {
                    listitem.Add(item.ItemName, item);
                    btn.Tag = item.ItemName;
                    err = false;
                    AddItem(item);
                }
                catch (Exception ee)
                {
                    i++;
                    item.ItemName = "Border" + i.ToString();
                }
        }
开发者ID:AbuShaqra,项目名称:ArduGUI,代码行数:33,代码来源:TScreen.cs


注:本文中的System.Windows.Forms.Button.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。