CadEditor.UtilsGui.getVisibleRectangle C# (CSharp) Метод

getVisibleRectangle() публичный статический Метод

public static getVisibleRectangle ( Control panel, Control insideControl ) : Rectangle
panel System.Windows.Forms.Control
insideControl System.Windows.Forms.Control
Результат System.Drawing.Rectangle
        public static Rectangle getVisibleRectangle(Control panel, Control insideControl)
        {
            Rectangle rect = panel.RectangleToScreen(panel.ClientRectangle);
            while (panel != null)
            {
                rect = Rectangle.Intersect(rect, panel.RectangleToScreen(panel.ClientRectangle));
                panel = panel.Parent;
            }
            rect = insideControl.RectangleToClient(rect);
            return rect;
        }

Usage Example

Пример #1
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            if (!fileLoaded)
            {
                return;
            }
            var g = e.Graphics;

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

            bool renderPhysics = isPhysicsLayerSelected();

            var renderParams = new MapEditor.RenderParams
            {
                bigBlocks       = bigBlocks,
                visibleRect     = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen),
                curScale        = curScale,
                showBlocksAxis  = showAxis,
                renderBlockFunc = renderPhysics ? MapEditor.renderPhysicsOnPanelFunc : MapEditor.renderBlocksOnPanelFunc
            };

            int blocksCount = renderPhysics ? ConfigScript.getPhysicsBlocksCount() : bigBlocks.Length; //hardcode physics blocks count

            MapEditor.renderAllBlocks(g, blocksScreen, curActiveBlock, blocksCount, renderParams);
        }
All Usage Examples Of CadEditor.UtilsGui::getVisibleRectangle