开发者

Label, Panel,... BorderStyle in compact framework

开发者 https://www.devze.com 2023-04-04 00:05 出处:网络
I want to make border for label and panel in Compact Framework 3.5 but there is no such property like BorderStyle. I search and google but i don\'t know how can i make border for label and Pa开发者_开

I want to make border for label and panel in Compact Framework 3.5 but there is no such property like BorderStyle. I search and google but i don't know how can i make border for label and Pa开发者_开发技巧nel in compact framework.


senzacionale, try to use the panel Paint event to draw your border. In this little example I painted a blue border around the panel:

private void panel1_Paint(object sender, PaintEventArgs e)
{
    e.Graphics.DrawRectangle(new Pen(Color.Blue), 0, 0, 
                             e.ClipRectangle.Width-1, 
                             e.ClipRectangle.Height-1
                            );
}

This example was written in WinForms/.net 4.0/VS2010, but the principle is the same, and the Paint event is available in the Compact Framework. There are a few tricks to redraw things properly in the Paint event, like creating a copy of e.Graphics to work with, but the main idea is presented.

0

精彩评论

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

关注公众号