public void setTextureSheet(TextureSheet Ts, String Name)
        {
            TileBrowserTabPage test = new TileBrowserTabPage();
            test.Location = new System.Drawing.Point(0, 0);
            test.Name = Name;
            test.Padding = new System.Windows.Forms.Padding(3);
            test.Size = new System.Drawing.Size(this.Width, this.Height);
            test.TabIndex = 0;
            test.Text = Name;
            test.UseVisualStyleBackColor = true;

            test.setTextureSheet(Ts);

            this.testTabCon.Controls.Add(test);
            this.testTabCon.SelectedTab = test;

            //Invalidate();
            //_textureSheet = Ts;

            //_selectedTile = new Point(-1, -1);
            //_multiSelectedTiles = new bool[_textureSheet.XTiles, _textureSheet.YTiles];

            //if (_textureSheet == null)
            //{
            //    vScrollBar.Enabled = false;
            //    hScrollBar.Enabled = false;
            //    Update();
            //    return;
            //}
            ////Schauen wir mal wieviele teile wir grad darstellen können
            //int columns = _browserWidth / _textureSheet.TileWidth;
            //int rows = _browserHeight / _textureSheet.TileHeight;
            ////gucken ob das ohne Scrollbars reicht
            //if (columns < _textureSheet.XTiles) //reicht nicht von der Breite
            //{
            //    hScrollBar.Enabled = true;
            //    hScrollBar.Minimum = 0;
            //    hScrollBar.Maximum = _textureSheet.XTiles - columns / 2; //check if wirklich so /2
            //    hScrollBar.Value = 0;
            //}
            //else
            //{
            //    hScrollBar.Enabled = false;
            //    hScrollBar.Value = 0;
            //}
            //if (rows < _textureSheet.YTiles) //reicht nicht von der Höhe
            //{
            //    vScrollBar.Enabled = true;
            //    vScrollBar.Minimum = 0;
            //    vScrollBar.Maximum = _textureSheet.YTiles - rows / 2; //check if wirklich so /2
            //    vScrollBar.Value = 0;
            //}
            //else
            //{
            //    vScrollBar.Enabled = false;
            //    vScrollBar.Value = 0;
            //}
            //PaintAll();
            //Update();
        }
        public void setTextureSheet(TextureSheet Ts)
        {
            Invalidate();
            _textureSheet = Ts;

            _selectedTile = new Point(-1, -1);
            _multiSelectedTiles = new bool[_textureSheet.XTiles, _textureSheet.YTiles];

            if (_textureSheet == null)
            {
                vScrollBar.Enabled = false;
                hScrollBar.Enabled = false;
                Update();
                return;
            }
            checkUpdateScrollBar();
            ////Schauen wir mal wieviele teile wir grad darstellen können
            //int columns = this.Width / _textureSheet.TileWidth;
            //int rows = this.Height / _textureSheet.TileHeight;
            ////gucken ob das ohne Scrollbars reicht
            //if (columns < _textureSheet.XTiles) //reicht nicht von der Breite
            //{
            //    hScrollBar.Enabled = true;
            //    hScrollBar.Minimum = 0;
            //    hScrollBar.Maximum = _textureSheet.XTiles - columns / 2; //check if wirklich so /2
            //    hScrollBar.Value = 0;
            //}
            //else
            //{
            //    hScrollBar.Enabled = false;
            //    hScrollBar.Value = 0;
            //}
            //if (rows < _textureSheet.YTiles) //reicht nicht von der Höhe
            //{
            //    vScrollBar.Enabled = true;
            //    vScrollBar.Minimum = 0;
            //    vScrollBar.Maximum = _textureSheet.YTiles - rows / 2; //check if wirklich so /2
            //    vScrollBar.Value = 0;
            //}
            //else
            //{
            //    vScrollBar.Enabled = false;
            //    vScrollBar.Value = 0;
            //}
            PaintAll();
            Update();
        }
 private void buildTextureSheet()
 {
     _textureSheet = new TextureSheet(_width, _height, Image.FromFile((_sheetFile.FullName),true));
 }