當前位置: 首頁>>代碼示例>>C#>>正文


C# TextBox.GetPreferredSize方法代碼示例

本文整理匯總了C#中System.Windows.Forms.TextBox.GetPreferredSize方法的典型用法代碼示例。如果您正苦於以下問題:C# TextBox.GetPreferredSize方法的具體用法?C# TextBox.GetPreferredSize怎麽用?C# TextBox.GetPreferredSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.TextBox的用法示例。


在下文中一共展示了TextBox.GetPreferredSize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RefreshDefines

        private void RefreshDefines()
        {
            if (renderWindow == null)
                return;
            for (var i = 0; i < Controls.Count; i++)
            {
                if (Controls[i].Name.StartsWith("temp_") == false)
                    continue;
                Controls.RemoveAt(i);
                i--;
            }

            if (renderWindow.Renderer.Kernel == null)
                return;

            var y = 325;

            if (renderWindow.Renderer.Parameters != null)
            {
                var help = new TextBox();
                help.Multiline = true;
                help.Text = renderWindow.Renderer.Parameters.ControlsHelp;
                help.Name = "temp_h" + y;
                help.Enabled = false;
                help.Location = new Point(0, y);
                help.Size = help.GetPreferredSize(new Size(200, 23));
                Controls.Add(help);
                y += help.Height;
            }

            AddConfigOption(ref y, "OpenClOptions", StaticSettings.Fetch.OpenClOptions,
                s => StaticSettings.Fetch.OpenClOptions = s);
            AddConfigOption(ref y, "ScreenshotHeight", StaticSettings.Fetch.ScreenshotHeight.ToString(CultureInfo.InvariantCulture),
                s => int.TryParse(s, out StaticSettings.Fetch.ScreenshotHeight));
            AddConfigOption(ref y, "ScreenshotPartialRender", StaticSettings.Fetch.ScreenshotPartialRender.ToString(CultureInfo.InvariantCulture),
                s => int.TryParse(s, out StaticSettings.Fetch.ScreenshotPartialRender));
            AddConfigOption(ref y, "GifFramecount", StaticSettings.Fetch.GifFramecount.ToString(CultureInfo.InvariantCulture),
                s => int.TryParse(s, out StaticSettings.Fetch.GifFramecount));
            AddConfigOption(ref y, "GifFramerate", StaticSettings.Fetch.GifFramerate.ToString(CultureInfo.InvariantCulture),
                s => int.TryParse(s, out StaticSettings.Fetch.GifFramerate));
            AddConfigOption(ref y, "GifHeight", StaticSettings.Fetch.GifHeight.ToString(CultureInfo.InvariantCulture),
                s => int.TryParse(s, out StaticSettings.Fetch.GifHeight));

            foreach (var kvp in renderWindow.Renderer.Kernel.Options)
            {
                var kvp1 = kvp;
                AddConfigOption(ref y, kvp.Key, kvp.Value, s =>
                {
                    if (renderWindow.Renderer.Kernel == null)
                        return;
                    renderWindow.Renderer.Kernel.SetOption(kvp1.Key, s);
                });
            }
        }
開發者ID:khyperia,項目名稱:Clam,代碼行數:54,代碼來源:MainWindow.cs


注:本文中的System.Windows.Forms.TextBox.GetPreferredSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。