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


C# Label.SetBoundsNoScaling方法代码示例

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


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

示例1: QbModelTab

        public QbModelTab(QbModel model)
            : base()
        {
            this.model = model;
            height = Client.window.Qfont.fontData.maxGlyphHeight;
            height = height.ScaleVerticlSize();

            vBorderOffset = -(3f).ScaleVerticlSize();
            hBorderOffset = (3f).ScaleHorizontalSize();

            label = new Label(GetNextAvailableID(), model.name, System.Drawing.Color.White, true);
            closeButton = new Label(GetNextAvailableID(), "x", System.Drawing.Color.DarkRed, true);
            var size = label.MeasureText(label.text + "    ");

            closeButton.Parent = this;
            label.Parent = this;

            closeButton.handler = new WidgetEventHandler()
            {
                mouseenter = (e) =>
                {
                    closeButton.color = Color.Red;
                },
                mouseleave= (e) =>
                {
                    closeButton.color = Color.DarkRed;
                },
                mousedownhandler = (e, mouse) =>
                {
                    if (mouse.IsPressed && mouse.Button == OpenTK.Input.MouseButton.Left)
                    {
                        var result = MessageBox.Show("There might be unsaved changes to this model. Are you sure you want to close it?", "StoneVox : Closing Model", MessageBoxButtons.OKCancel);

                        if (result == DialogResult.Cancel || result == DialogResult.Abort)
                            return;

                        Singleton<QbManager>.INSTANCE.RemoveModel(this.model);
                    }
                }
            };

            SetBounds(null, null, size.Width, height.UnScaleVerticlSize() * borderscale * 1.5f);
            closeButton.SetBoundsNoScaling(Absolute_X + this.size.X - closeButton.size.X * 1.5f, Absolute_Y + closeButton.size.Y * .9f);

            background = appearence.AddAppearence("background", new PlainBackground(new Color4(100 - 10, 87 - 10, 61 - 10, 255)));
            border = appearence.AddAppearence("border", new PlainBorder(4, new Color4(122 - 10, 106 - 10, 70 - 10, 255)));
        }
开发者ID:law4x,项目名称:stonevox3d,代码行数:47,代码来源:QbModelTab.cs

示例2: QbModelMatrixListbox

        public QbModelMatrixListbox(float width, float height)
            : base(-1)
        {
            //input = Singleton<ClientInput>.INSTANCE;

            ID = GetNextAvailableID();
            appearence.AddAppearence("border", new PlainBorder(6, new Color4(122f / 256f, 106f / 256f, 70f / 256f, 1f)));
            appearence.AddAppearence("background", new PlainBackground(new Color4(66, 63, 63, 255)));

            float realheight = Client.window.Qfont.fontData.maxGlyphHeight;
            float fontheight = (float)realheight*2f;
            linecount = (int)((height.UnScaleVerticlSize()) / fontheight);

            //float labelspacing = 25f;

            textbox = new TextBox(100000000, "", Color4.Wheat.ToSystemDrawingColor(), 1000);
            textbox.focused = true;

            fontheight = fontheight.ScaleVerticlSize();

            labels = new List<Label>();
            buttons = new List<ToggleButton>();
            size.X = width;
            size.Y = linecount * fontheight;// + linecount * (labelspacing).ScaleVerticlSize();

            QbModel model = null;
            bool hasmodel = Singleton<QbManager>.INSTANCE.HasModel;

            if (hasmodel)
                model = Singleton<QbManager>.INSTANCE.ActiveModel;

            float previouseY = Absolute_Y + size.Y - realheight.ScaleVerticlSize() * 2f;

            background = new EmptyWidget();
            background.Parent = this;
            PlainBackground bg = new PlainBackground(Color4.Black);
            background.appearence.AddAppearence("background", bg);

            for (int i = 0; i < linecount; i++)
            {
                string labeltext = "";

                if (hasmodel)
                    labeltext = i < model.matrices.Count ? model.matrices[i].name : "";

                Label label = new Label(GetNextAvailableID(), labeltext, System.Drawing.Color.White, true);
                label.Parent = this;
                label.SetBoundsNoScaling(Absolute_X + size.X * .08f, previouseY);

                Boolean editing = false;
                label.customData.Add("edit", editing);

                label.handler = new WidgetEventHandler()
                {
                    mousedownhandler = (e, mouse) =>
                    {
                        if (!mouse.IsPressed || mouse.Button != OpenTK.Input.MouseButton.Left) return;

                        background.Enable = true;
                        bg.color = Color4.Black;
                        background.SetBoundsNoScaling(Absolute_X, label.Absolute_Y, size.X, label.size.Y - (4f).ScaleVerticlSize());

                        QbModel m = Singleton<QbManager>.INSTANCE.ActiveModel;
                        int index = labels.IndexOf(label);
                        int offset = index + offsetindex;

                        Singleton<QbManager>.INSTANCE.ActiveMatrixIndex = offset;

                        lastActiveIndex = labels.ToList().IndexOf(label);
                    },
                    mousedoubleclick = (e, mouse) =>
                    {
                        if (!mouse.IsPressed || mouse.Button != OpenTK.Input.MouseButton.Left) return;

                        QbModel m = Singleton<QbManager>.INSTANCE.ActiveModel;
                        int index = labels.IndexOf(label);
                        int offset = index + offsetindex;

                        Singleton<QbManager>.INSTANCE.ActiveMatrixIndex = offset;
                        Singleton<Camera>.INSTANCE.TransitionToMatrix();
                    },
                    mouseenter =  (e) =>
                    {
                        //lastover = label;

                        int index = labels.IndexOf(label);
                        int offset = index + offsetindex;

                        QbModel m = Singleton<QbManager>.INSTANCE.ActiveModel;

                        m.matrices[offset].highlight = new Colort(1.5f, 1.5f, 1.5f);
                    },
                    mouseleave = (e) =>
                    {
                        int index = labels.IndexOf(label);
                        int offset = index + offsetindex;

                        QbModel m = Singleton<QbManager>.INSTANCE.ActiveModel;

                        m.matrices[offset].highlight = new Colort(1f, 1f, 1f);
//.........这里部分代码省略.........
开发者ID:law4x,项目名称:stonevox3d,代码行数:101,代码来源:QbModelMatrixListbox.cs


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