Пример #1
0
        //============================================================
        // <T>配置资源处理。</T>
        //
        // @param resource 资源
        //============================================================
        public void SetupResource(FUiPicture resource)
        {
            if (!resource.IsValid())
            {
                resource.resource = null;
                return;
            }
            // 释放旧资源
            if (resource.bitmap != null)
            {
                resource.bitmap.Dispose();
                resource.bitmap = null;
            }
            // 选择新资源
            FRsResourcePicture picture = RContent2dManager.ResourceConsole.FindOpen(resource.Code) as FRsResourcePicture;

            if (picture != null)
            {
                resource.bitmap   = _context.Device.CreateBitmap(picture.Bitmap.Native);
                resource.resource = picture;
                // 设置属性
                //string padding = RString.SubStringLast(picture.Label, "(", ")");
                //if (!RString.IsEmpty(padding)) {
                //   if(_groundResource.Padding.Parse(padding)) {
                //      _groundResource.AlignCd = ERcPictureAlign.Square;
                //   }
                //}
            }
        }
Пример #2
0
 //============================================================
 // <T>接收尺寸对象。</T>
 //
 // @param size 尺寸对象
 //============================================================
 public void Assign(FUiPicture picture)
 {
     if (picture == null)
     {
         return;
     }
     //id = picture.id;
     //_alignCd = picture._alignCd;
     //_location.Assign(picture._location);
     //_padding.Assign(picture._padding);
 }
Пример #3
0
 //============================================================
 // <T>绘制资源。</T>
 //
 // @param resource 资源
 // @param rectangle 范围
 //============================================================
 public void DrawResource(FUiPicture resource, SIntRectangle rectangle)
 {
     if (resource.HasBitmap())
     {
         // 获得坐标
         float scale = _context.Scale;
         int   x     = resource.Location.X;
         int   y     = resource.Location.Y;
         // 绘制资源
         FDxContext2d context = _context.Context;
         if (resource.AlignCd == ERcPictureAlign.Square)
         {
             context.DrawBitmapPadding(resource.bitmap, rectangle, x, y, ControlResource.Size.Width, ControlResource.Size.Height, resource.Padding, scale);
         }
         else
         {
             SIntSize2 size = resource.bitmap.Size;
             context.DrawBitmap(resource.bitmap, rectangle, x, y, size.Width, size.Height, scale);
         }
     }
 }