Exemple #1
0
 static void DrawFrame(EPolygon frame, int left, int top, int right, int bottom, int thickness)
 {
     frame.ClearPoints();
     if (left + thickness >= right || top + thickness >= bottom)
     {
         if (left >= right || top >= bottom)
         {
             return;
         }
         // shape reduces to a rectangle
         frame.AddPoint(left, top);
         frame.AddPoint(right, top);
         frame.AddPoint(right, bottom);
         frame.AddPoint(left, bottom);
         return;
     }
     // outside edge
     frame.AddPoint(left, top);
     frame.AddPoint(right, top);
     frame.AddPoint(right, bottom);
     frame.AddPoint(left, bottom);
     frame.AddPoint(left, top + thickness);
     // and inside edge
     frame.AddPoint(left + thickness, top + thickness);
     frame.AddPoint(left + thickness, bottom - thickness);
     frame.AddPoint(right - thickness, bottom - thickness);
     frame.AddPoint(right - thickness, top + thickness);
     frame.AddPoint(left, top + thickness);
 }
Exemple #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Layout> e)
        {
            if (Control == null)
            {
                SetNativeControl(new Native.Canvas(Forms.NativeParent));

                _shadow       = new EPolygon(NativeView);
                _shadow.Color = s_ShadowColor;
                Control.Children.Add(_shadow);

                _frame = new EPolygon(NativeView);
                _frame.Show();
                Control.Children.Add(_frame);
                Control.LayoutUpdated += OnLayoutUpdated;
            }
            base.OnElementChanged(e);
        }