/// <summary> /// The default constructor. /// </summary> public MyWindow() { // Create the canvas to draw on. int screenWidth; int screenHeight; int bitsPerPixel; int orientation; HardwareProvider.HwProvider.GetLCDMetrics(out screenWidth, out screenHeight, out bitsPerPixel, out orientation); inkCanvas = new MyCanvas(screenWidth - 60, screenHeight - 30); // Create the Clear button. button = new Button("Clear", Resources.GetFont(Resources.FontResources.small)); button.Click += new EventHandler(button_Click); // Create the palette for selecting colors. colorPalette = new MyColorPalette(8, 2, 54, 204); colorPalette.HorizontalAlignment = HorizontalAlignment.Right; colorPalette.VerticalAlignment = VerticalAlignment.Top; colorPalette.ItemClick += new PaletteControlEventHandler(colorPalette_ItemClick); // Add a panel to hold the other controls. this.Child = panel; // Add the canvas, clear button and palette to the panel. panel.Children.Add(inkCanvas); panel.Children.Add(button); panel.Children.Add(colorPalette); // Set the drawing attributes to a default set. DrawingAttributes da = new DrawingAttributes(); inkCanvas.DefaultDrawingAttributes = da; }