private void glCanvas1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 'b') { BlendingSourceFactor source; BlendingDestinationFactor dest; this.blendFactorHelper.GetNext(out source, out dest); this.glText.BlendSwitch.SourceFactor = source; this.glText.BlendSwitch.DestFactor = dest; this.UpdateLabel(); } else if (e.KeyChar == 'o') { if (this.openTextureDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string ttfFilename = this.openTextureDlg.FileName; this.glText.Dispose(); FontResource fontResouce = FontResource.Load(ttfFilename, ' ', (char)126); var glText = new GLText(AnchorStyles.Left | AnchorStyles.Top, new Padding(3, 3, 3, 3), new Size(850, 50), -100, 100, fontResouce); glText.Initialize(); glText.SwitchList.Add(new ClearColorSwitch());// show black back color to indicate glText's area. glText.SetText("The quick brown fox jumps over the lazy dog!"); this.glText = glText; uiRoot.Controls.Add(glText); this.formPropertyGrid.DisplayObject(glText); } } }
private void Form02OrderIndependentTransparency_Load(object sender, EventArgs e) { { var camera = new Camera(CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); camera.Position = new vec3(0, 0, 1); camera.Target = new vec3(0, 0, 0); camera.UpVector = new vec3(0, 1, 0); var rotator = new SatelliteRotator(camera); this.camera = camera; this.rotator = rotator; } { var UIRoot = new GLControl(this.glCanvas1.Size, -100, 100); UIRoot.Initialize(); this.uiRoot = UIRoot; var glAxis = new GLAxis(AnchorStyles.Right | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(70, 70), -100, 100); glAxis.Initialize(); this.glAxis = glAxis; UIRoot.Controls.Add(glAxis); var glText = new GLText(AnchorStyles.Left | AnchorStyles.Top, new Padding(3, 3, 3, 3), new Size(500, 50), -100, 100); glText.Initialize(); glText.SwitchList.Add(new ClearColorSwitch());// show black back color to indicate glText's area. glText.SetText("The quick brown fox jumps over the lazy dog!"); this.glText = glText; uiRoot.Controls.Add(glText); this.UpdateLabel(); } { var frmPropertyGrid = new FormProperyGrid(); frmPropertyGrid.DisplayObject(this.glText); frmPropertyGrid.Show(); this.formPropertyGrid = frmPropertyGrid; } }