// These are C# 'event' handlers. public void redraw_main_window(object sender, Wimp.RedrawEventArgs e) { ColourTrans.SetGCOL(ColourTrans.FullRed, OS.GCOLAction.Replace_FG); OS.PlotCircleFill(e.Origin.X + 1000, e.Origin.Y + 1000, 400); ColourTrans.SetGCOL(ColourTrans.FullGreen, OS.GCOLAction.Replace_FG); OS.PlotLine(e.Origin.X, e.Origin.Y, e.Origin.X + 2000, e.Origin.Y + 2000); ColourTrans.SetGCOL(ColourTrans.FullBlue, OS.GCOLAction.Replace_FG); OS.PlotLine(e.Origin.X, e.Origin.Y + 2000, e.Origin.X + 2000, e.Origin.Y); ColourTrans.SetFontColours(ColourTrans.White, ColourTrans.FullBlue, 7); main_font.Paint("CSharp string", Font.PlotType.OSUnits, e.Origin.X + 100, e.Origin.Y + 1000, 0); // Length ignored (paint whole string) if bit 7 of flags not set ColourTrans.SetFontColours(ColourTrans.White, ColourTrans.Black, 7); main_font.Paint("CSharp string rotated", 0, // Coords are in millipoints (e.Origin.X + 1000) * 400, (e.Origin.Y + 1000) * 400, matrix, 0); // Length ignored (paint whole string) if bit 7 of flags not set }
// For a derived class, it is recommended to override the event notifier rather // than subscribe to the event. protected override void OnPaint(Wimp.RedrawEventArgs e) { if (ColourSetBy == ColourSetter.Dialogue) { ColourTrans.SetFontColours(ColourTrans.White, font_palette_colour, 7); } else if (ColourSetBy == ColourSetter.Menu) { Wimp.SetFontColours((int)OS.DesktopColour.White, (int)font_wimp_colour); } font.Paint(Text, Font.PlotType.OSUnits, e.Origin.X + 10, e.Origin.Y - 100, 0); // Length ignored (paint whole string) if bit 7 of flags not set // Technically, we should call the base method to ensure that event subscribers // are also notified of this event, but I don't think that's necessary in this // case. // base.OnPaint (e); }