Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Yet Another Problem...Error message with my OnDraw() method

$
0
0

When I run my app for debugging I get this error: Error CS0115: 'GraphicsAndAnimation.MainActivity.OnDraw(Android.Graphics.Canvas)': no suitable method found to override

Here is my code: { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle);

        Bitmap bitMap = Bitmap.CreateBitmap  (100, 100, Bitmap.Config.Argb8888);
        Canvas canvas = new Canvas (bitMap);
        SetContentView (Resource.Layout.Main);


    }
    protected override void OnDraw(Canvas canvas)
    {
        base.OnDraw (canvas);

        Paint green = new Paint
        {
            AntiAlias = "true",
            Color = Color.RGB(0x99, 0xcc,0)

        };

        Paint red = new Paint 
        {
            AntiAlias = "true",
            Color = Color.Rgb(0xff, 0x44, 0x44)

        };

        red.SetStyle (Paint.Style.FillStroke);


        float middle = canvas.Width * 0.25f;
        canvas.DrawPaint (red);
        canvas.DrawRect (0, 0, middle, canvas.Width, green);
    }

}

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>