//////////////////////////////////////////////////////////////// // // GreekDemo.q // //////////////////////////////////////////////////////////////// //(New GreekDemo) (DefClass GreekDemo (: Window) canvas (Def (canvas_MouseDown sender e) (Local point greek run textBlock) (Setq point (e.GetPosition canvas)) // Pick random greek character in CMMI10 font with character code in 174-195 . // NOTE: Quantum's Random function <> .NET System.Random (Setq greek (Convert.ToString (Convert.ToChar (Random 174 195)))) (Setq run (New Run greek)) (Setq textBlock (New TextBlock run)) // NOTE: Here we want System.Windows.Media.FontFamily the Type, // not this.FontFamily . (Setq textBlock.FontFamily (New System.Windows.Media.FontFamily "CMMI10")) (Setq textBlock.FontSize 40.0) (Setq textBlock.FontWeight FontWeights.Bold) (Setq textBlock.Foreground (New SolidColorBrush (Color.FromRgb (Random 0 239) (Random 0 239) (Random 0 239)))) (textBlock.Measure (New System.Windows.Size Double.PositiveInfinity Double.PositiveInfinity)) (Canvas.SetLeft textBlock (- point.X (/ textBlock.DesiredSize.Width 2))) (Canvas.SetTop textBlock (- point.Y (/ textBlock.DesiredSize.Height 2))) (canvas.Children.Add textBlock)) (Def (GreekDemo) (ApplyXaml this "~/GuiDemo/GreekDemo.xaml") (Show)) )