开发者

how can i make a tablelayout invisible and then visible in winforms

i have a winform that needs to print a chessboard, i have a table with some controls in it.

what i did was to set it invisible when the form loads

private void Chess_Load(object sender, 开发者_StackOverflow社区EventArgs e)
{
    PromotionTable.Visible =false;
}

and then make it visible once the function is triggered.

public void piecePromotionChange(Pieces[,] pieces, int rowEnd2, int columnEnd2, bool blackOrNot)
{
    PromotionTable.Visible = true;
}

but it still remains, invisible :(


You'll need to invalidate/refresh that portion of the screen. Setting the Visible property does not trigger a redraw..

PromotionTable.Visible=true;
PromotionTable.Invalidate();
myForm.Refresh();


You probably ment to set its visibility to false on load

private void Chess_Load(object sender, EventArgs e)
{
   PromotionTable.Visible = false; // false here
}

If its not visible to begin with, you might need to check and make sure its added to the controls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜