Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Introducing Windows Azure- P41:The cloud platform is getting more and more attractive to the computing world. Today, service-oriented architecture (SOA) and aspect-oriented programming (AOP) techniques are widely used in enterprise solutions. A question an IT management team or a software development team may ask is, what is the next trend going to be? Cloud computing seems to be the right answer. | CHAPTER 6 AZURE .NET SERVICES SERVICE BUS const PixelFormat PIXELFORMAT PixelFormat.Format24bppRgb protected Bitmap bitmap null protected Random random null protected Graphics graphics null protected int shapeWidth 0 protected int shapeHeight 0 protected int drawAreaWidth 0 protected int drawAreaHeight 0 public Shape Panel drawArea if null drawArea drawArea.Width 0 drawArea.Height 0 throw new ArgumentException The draw area must be specified and valid drawArea.ToString random new Random int DateTime.Now.Ticks bitmap new Bitmap drawArea.ClientRectangle.Width drawArea.ClientRectangle.Height PIXELFORMAT graphics Graphics.FromImage bitmap drawAreaWidth drawArea.Width public Bitmap Map get return bitmap public int ShapeWidth get return shapeWidth public int ShapeHeight get return shapeHeight protected int RandomWidth get shapeWidth random.Next 0 drawAreaWidth return shapeWidth 193 CHAPTER 6 AZURE .NET SERVICES SERVICE BUS protected int RandomHeight get shapeHeight random.Next 0 drawAreaHeight return shapeHeight protected Pen RandomColorPen get return new Pen Color.FromArgb random.Next 0 255 random.Next 0 255 random.Next o 255 endregion region Protected Method protected void Reset if null bitmap Graphics.FromImage this. bitmap .Clear Color.Black endregion abstract public void Draw A class derived from this base class is responsible for drawing a specific shape. Listing 6-11 shows how to draw a Circle bitmap programmatically on the panel surface. A protected function Reset is called before drawing. This function clears the previously drawn bitmap and sets the bitmap to the background color. When an application needs to draw different shapes on the same panel surface it just needs to dynamically construct a drawing class and pass in the panel object instance. The implementation will be presented later in this exercise. Listing 6-11. Derived Drawing Class Used to Draw a Circle Bitmap on a Panel Surface using System using System.Drawing using System.Drawing.Imaging using .