/// <summary>Create new button instance</summary> protected void RaiseChangedEvent(ComboBox sender, bool wasTriggeredByUser) { // Discard events triggered programatically if these types of events haven't been // enabled if (!Parent.IsUsingNonUserEvents && !wasTriggeredByUser) return; // Fire both the changed and clicked event base.RaiseClickEvent(sender, wasTriggeredByUser); if (Changed != null) Changed(sender, EventArgs.Empty); }
/// <summary>Adds a combobox control to the dialog</summary> public ComboBox AddComboBox(int id, int x, int y, int w, int h, System.Windows.Forms.Keys hotkey, bool isDefault) { // First create the combo ComboBox c = new ComboBox(this); // Now call the add control method AddControl(c); // Set the properties of the button now c.ID = id; c.SetLocation(x, y); c.SetSize(w,h); c.Hotkey = hotkey; c.isDefault = isDefault; return c; }
/// <summary> /// Creates the controls for use in the dialog /// </summary> private void CreateControls() { dialog = new Dialog(parent); dialog.IsUsingKeyboardInput = true; dialog.SetFont(0, "Arial", 15, FontWeight.Normal); dialog.SetFont(1, "Arial", 28, FontWeight.Bold); // Right justify static controls Element e = dialog.GetDefaultElement(ControlType.StaticText, 0); e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Right; // Title StaticText title = dialog.AddStatic((int)SettingsDialogControlIds.Static, "Direct3D Settings", 10, 5, 400, 50); e = title[0]; e.FontIndex = 1; e.textFormat = DrawTextFormat.Top | DrawTextFormat.Left; // Adapter dialog.AddStatic((int)SettingsDialogControlIds.Static, "Display Adapter", 10, 50, 180, 23); adapterCombo = dialog.AddComboBox((int)SettingsDialogControlIds.Adapter, 200, 50, 300, 23); // Device Type dialog.AddStatic((int)SettingsDialogControlIds.Static, "Render Device", 10, 75, 180, 23); deviceCombo = dialog.AddComboBox((int)SettingsDialogControlIds.DeviceType, 200, 75, 300, 23); // Windowed / Fullscreen windowedButton = dialog.AddRadioButton((int)SettingsDialogControlIds.Windowed, (int)SettingsDialogControlIds.RadioButtonGroup, "Windowed", 240, 105, 300, 16, false); clipBox = dialog.AddCheckBox((int)SettingsDialogControlIds.DeviceClip, "Clip to device when window spans across multiple monitors", 250, 126, 400, 16, false); fullscreenButton = dialog.AddRadioButton((int)SettingsDialogControlIds.Fullscreen, (int)SettingsDialogControlIds.RadioButtonGroup, "Full Screen", 240, 147, 300, 16, false); // Adapter Format adapterFormatStatic = dialog.AddStatic((int)SettingsDialogControlIds.AdapterFormatLabel, "Adapter Format", 10, 180, 180, 23); adapterFormatCombo = dialog.AddComboBox((int)SettingsDialogControlIds.AdapterFormat, 200, 180, 300, 23); // Resolution resolutionStatic = dialog.AddStatic((int)SettingsDialogControlIds.ResolutionLabel, "Resolution", 10, 205, 180, 23); resolution = dialog.AddComboBox((int)SettingsDialogControlIds.Resolution, 200, 205, 300, 23); resolution.SetDropHeight(106); // Refresh Rate refreshStatic = dialog.AddStatic((int)SettingsDialogControlIds.RefreshRateLabel, "Refresh Rate", 10, 230, 180, 23); refreshCombo = dialog.AddComboBox((int)SettingsDialogControlIds.RefreshRate, 200, 230, 300, 23); // BackBuffer Format dialog.AddStatic((int)SettingsDialogControlIds.Static, "Back Buffer Format", 10, 265, 180, 23 ); backBufferCombo = dialog.AddComboBox((int)SettingsDialogControlIds.BackBufferFormat, 200, 265, 300, 23 ); // Depth Stencil dialog.AddStatic((int)SettingsDialogControlIds.Static, "Depth/Stencil Format", 10, 290, 180, 23 ); depthStencilCombo = dialog.AddComboBox((int)SettingsDialogControlIds.DepthStencil, 200, 290, 300, 23 ); // Multisample Type dialog.AddStatic((int)SettingsDialogControlIds.Static, "Multisample Type", 10, 315, 180, 23 ); multiSampleTypeCombo = dialog.AddComboBox((int)SettingsDialogControlIds.MultisampleType, 200, 315, 300, 23 ); // Multisample Quality dialog.AddStatic((int)SettingsDialogControlIds.Static, "Multisample Quality", 10, 340, 180, 23 ); multiSampleQualityCombo = dialog.AddComboBox((int)SettingsDialogControlIds.MultisampleQuality, 200, 340, 300, 23 ); // Vertex Processing dialog.AddStatic((int)SettingsDialogControlIds.Static, "Vertex Processing", 10, 365, 180, 23 ); vertexCombo = dialog.AddComboBox((int)SettingsDialogControlIds.VertexProcessing, 200, 365, 300, 23 ); // Present Interval dialog.AddStatic((int)SettingsDialogControlIds.Static, "Present Interval", 10, 390, 180, 23 ); presentCombo = dialog.AddComboBox((int)SettingsDialogControlIds.PresentInterval, 200, 390, 300, 23 ); // Add the ok/cancel buttons Button okButton = dialog.AddButton((int)SettingsDialogControlIds.OK, "OK", 230,435,73,31); Button cancelButton = dialog.AddButton((int)SettingsDialogControlIds.Cancel, "Cancel", 315,435,73,31,0, true); okButton.Click += new EventHandler(OnOkClicked); cancelButton.Click += new EventHandler(OnCancelClicked); }