开发者

C# Draw when window is loaded

开发者 https://www.devze.com 2023-03-05 09:52 出处:网络
I want to draw some ellipses when the window is loaded without clicking anything, how can I do it? My code is the following :

I want to draw some ellipses when the window is loaded without clicking anything, how can I do it? My code is the following :

        int kerX = random.Next(10,281);
        int kerY = random.Next(10,281);
        mrPainter.FillEllipse(Brushes.Black, kerX + 10, kerY 开发者_运维问答+ 10, 20, 20);
        mrPainter.FillEllipse(blue,65,65,20,20);
        mrPainter.FillEllipse(red, 205, 65, 20, 20);
        mrPainter.FillEllipse(yellow, 135, 215, 20, 20);


Assuming that your are using WinForms, simply insert the code in the FormLoaded event of your main form.

0

精彩评论

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

关注公众号