コード例 #1
0
ファイル: TabStrip.cs プロジェクト: EReeves/gwen-net-ex
        public override void DragAndDrop_Hover(Package p, int x, int y)
        {
            Point localPos = CanvasPosToLocal(new Point(x, y));

            ControlBase droppedOn = GetControlAt(localPos.X, localPos.Y);

            if (droppedOn != null && droppedOn != this)
            {
                Point dropPos = droppedOn.CanvasPosToLocal(new Point(x, y));
                m_TabDragControl.BringToFront();
                int pos = droppedOn.ActualLeft - 1;

                if (dropPos.X > droppedOn.ActualWidth / 2)
                {
                    pos += droppedOn.ActualWidth - 1;
                }

                Point canvasPos = LocalPosToCanvas(new Point(pos, 0));
                m_TabDragControl.MoveTo(canvasPos.X, canvasPos.Y);
            }
            else
            {
                m_TabDragControl.BringToFront();
            }
        }
コード例 #2
0
ファイル: TabStrip.cs プロジェクト: slagusev/gwen-dotnet
        public override void DragAndDrop_Hover(Package p, int x, int y)
        {
            Point localPos = CanvasPosToLocal(new Point(x, y));

            ControlBase droppedOn = GetControlAt(localPos.X, localPos.Y);

            if (droppedOn != null && droppedOn != this)
            {
                Point dropPos = droppedOn.CanvasPosToLocal(new Point(x, y));
                tabDragControl.SetBounds(new Rectangle(0, 0, 3, Height));
                tabDragControl.BringToFront();
                tabDragControl.SetPosition(droppedOn.X - 1, 0);

                if (dropPos.X > droppedOn.Width / 2)
                {
                    tabDragControl.MoveBy(droppedOn.Width - 1, 0);
                }
                tabDragControl.Dock = Pos.None;
            }
            else
            {
                tabDragControl.Dock = Pos.Left;
                tabDragControl.BringToFront();
            }
        }
コード例 #3
0
        private void CreateText()
        {
            foreach (Label l in labels)
            {
                m_InnerPanel.RemoveChild(l, true);
            }
            labels.Clear();
            if (Text == null)
            {
                return;
            }
            var font     = Skin.DefaultFont;
            int maxwidth = this.m_InnerPanel.Width - (m_InnerPanel.Padding.Left + m_InnerPanel.Padding.Right);
            // ive written similar code to this over and over again and i'm so f*****g tired of it
            // i rewrote f*****g gwen's layout engine and cant actually commit it to master because
            // i can't afford the time it takes to maintain that project too
            var f       = (Gwen.Renderer.BitmapFont)font;
            var wrapped = f.fontdata.WordWrap(Text, maxwidth);

            foreach (var line in wrapped)
            {
                AddLine(line);
            }
            Container.BringToFront();
            m_InnerPanel.Layout();
            m_InnerPanel.SizeToChildren(false, true);
            SizeToChildren(false, true);
        }