/// <summary> /// Initializes the application /// </summary> public void InitializeApplication() { int y = 10; // Initialize the HUD Button fullScreen = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22); Button toggleRef = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22); Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22); // Hook the button events for when these items are clicked fullScreen.Click += new EventHandler(OnFullscreenClicked); toggleRef.Click += new EventHandler(OnRefClicked); changeDevice.Click += new EventHandler(OnChangeDevicClicked); // Now add the sample specific UI y = 10; Checkbox fillModeBox = sampleUi.AddCheckBox(FillModeButton, "WireFrame (F8)", 35, y, 150, 20, false, System.Windows.Forms.Keys.F8, false); sampleUi.AddStatic(SegmentLabel, "Number of segments: 2", 10, y += 30, 150, 16); Slider segmentSlider = sampleUi.AddSlider(SegmentSlider, 10, y += 14, 150, 24, 1, 10, 2, false); Checkbox hwPatch = sampleUi.AddCheckBox(HwPatchButton, "User hardware N-patches", 10, y += 26, 150, 20, true, System.Windows.Forms.Keys.H, false); // Hook the events fillModeBox.Changed += new EventHandler(OnFillmodeChanged); segmentSlider.ValueChanged += new EventHandler(OnSegmentChanged); hwPatch.Changed += new EventHandler(OnHardwareChanged); }
/// <summary> /// Initializes the application /// </summary> public void InitializeApplication() { int y = 10; // Initialize the HUD Button fullScreen = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22); Button toggleRef = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22); Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22); // Hook the button events for when these items are clicked fullScreen.Click += new EventHandler(OnFullscreenClicked); toggleRef.Click += new EventHandler(OnRefClicked); changeDevice.Click += new EventHandler(OnChangeDevicClicked); // Now add the sample specific UI y = 10; sampleUi.IsUsingKeyboardInput = true; sampleUi.AddStatic(DetailLabel, "Level of Detail:", 0, y, 200, 16); Checkbox opt = sampleUi.AddCheckBox(UseOptimizedCheckBox, "Use optimized mesh", 50, y, 200, 20, true); Slider sl = sampleUi.AddSlider(Detail, 10, y += 16, 200, 16, 4, 4, 4, false); // Hook the sample events opt.Changed += new EventHandler(OnOptimizedChanged); sl.ValueChanged += new EventHandler(OnDetailChanged); // Set button masks camera.SetButtonMasks((int)MouseButtonMask.Left, (int)MouseButtonMask.Wheel, 0); }
/// <summary> /// Initializes the application /// </summary> public void InitializeApplication() { int y = 10; // Initialize the HUD Button fullScreen = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22); Button toggleRef = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22); Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22); // Hook the button events for when these items are clicked fullScreen.Click += new EventHandler(OnFullscreenClicked); toggleRef.Click += new EventHandler(OnRefClicked); changeDevice.Click += new EventHandler(OnChangeDevicClicked); y = 10; Button toggleFaiy = sampleUi.AddButton(ButtonToggleCanvas, "Toggle Canvas", 10, y += 24, 125, 22); Checkbox unsafeParticle = sampleUi.AddCheckBox(CheckUnsafeParticle, "Use Unsafe Methods", 30, y += 24, 125, 22, true); Button toggleTiles = sampleUi.AddButton(ButtonToggleTiles, "Toggle Tiles", 10, y += 24, 125, 22); Button toggleAnimatedSprite = sampleUi.AddButton(ButtonToggleAnimatedSprite, "Toggle Animated Sprite", 10, y += 24, 125, 22); Button toggleMovingSprite = sampleUi.AddButton(ButtonToggleMovingSprite, "Toggle Moving Sprite", 10, y += 24, 125, 22); toggleFaiy.Click += new EventHandler(OnToggleParticle); unsafeParticle.Changed += new EventHandler(OnChangeUnsafe); toggleTiles.Click += new EventHandler(OnToggleTiles); toggleAnimatedSprite.Click += new EventHandler(OnToggleAnimatedSprite); toggleMovingSprite.Click += new EventHandler(OnToggleMovingSprite); particleIsUsingUnsafeMethods = true; tilesEnabled = true; }
/// <summary> /// Initializes the application /// </summary> public void InitializeApplication() { int y = 10; // Initialize the HUD Button fullScreen = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22); Button toggleRef = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22); Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22); // Hook the button events for when these items are clicked fullScreen.Click += new EventHandler(OnFullscreenClicked); toggleRef.Click += new EventHandler(OnRefClicked); changeDevice.Click += new EventHandler(OnChangeDeviceClicked); // Now add the sample specific UI y = 10; const int ComboBox1 = ChangeDevice + 1; const int CheckBox1 = ChangeDevice + 2; const int CheckBox2 = ChangeDevice + 3; const int Radiobutton1 = ChangeDevice + 4; const int Radiobutton2 = ChangeDevice + 5; const int Radiobutton3 = ChangeDevice + 6; const int Button1 = ChangeDevice + 7; const int Button2 = ChangeDevice + 8; const int Radiobutton4 = ChangeDevice + 9; const int Radiobutton5 = ChangeDevice + 10; const int SliderControl = ChangeDevice + 11; ComboBox cb1 = sampleUi.AddComboBox(ComboBox1, 35, y += 24, 125, 22); for (int i = 0; i < 50; i++) { cb1.AddItem("Item#" + i.ToString(), null); } sampleUi.AddCheckBox(CheckBox1, "Checkbox1", 35, y += 24, 125, 22, false); sampleUi.AddCheckBox(CheckBox2, "Checkbox2", 35, y += 24, 125, 22, false); sampleUi.AddRadioButton(Radiobutton1, 1, "Radio1G1", 35, y += 24, 125, 22, true); sampleUi.AddRadioButton(Radiobutton2, 1, "Radio2G1", 35, y += 24, 125, 22, false); sampleUi.AddRadioButton(Radiobutton3, 1, "Radio3G1", 35, y += 24, 125, 22, false); sampleUi.AddButton(Button1, "Button1", 35, y += 24, 125, 22); sampleUi.AddButton(Button2, "Button2", 35, y += 24, 125, 22); sampleUi.AddRadioButton(Radiobutton4, 2, "Radio1G2", 35, y += 24, 125, 22, true); sampleUi.AddRadioButton(Radiobutton5, 2, "Radio2G2", 35, y += 24, 125, 22, false); sampleUi.AddSlider(SliderControl, 50, y += 24, 100, 22); // If you wanted to respond to any of these you would need to add an event hook here }
/// <summary>Initializes the application</summary> public void InitializeApplication() { isUsingPreshader = true; for (int i = 0; i < MaxNumberLights; i++) { lightControl[i] = new DirectionWidget(); lightControl[i].LightDirection = new Vector3((float)Math.Sin((float)Math.PI * 2 * i / MaxNumberLights - (float)Math.PI / 6), 0, -(float)Math.Cos((float)Math.PI * 2 * i / MaxNumberLights - (float)Math.PI / 6)); } activeLight = 0; numberActiveLights = 1; lightScale = 1.0f; int y = 10; // Initialize the dialogs Button fullScreen = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22); Button toggleRef = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22); Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22); // Hook the button events for when these items are clicked fullScreen.Click += new EventHandler(OnFullscreenClicked); toggleRef.Click += new EventHandler(OnRefClicked); changeDevice.Click += new EventHandler(OnChangeDevicClicked); // Now add the sample specific UI y = 10; sampleUi.AddStatic(NumberLightsStatic, string.Format("# Lights: {0}", numberActiveLights), 35, y += 24, 125, 22); Slider lightSlider = sampleUi.AddSlider(NumberLights, 50, y += 24, 100, 22, 1, MaxNumberLights, numberActiveLights, false); y += 24; sampleUi.AddStatic(LightScaleStatic, string.Format("Light scale: {0}", lightScale.ToString("f2", System.Globalization.CultureInfo.CurrentUICulture)), 35, y += 24, 125, 22); Slider scaleSlider = sampleUi.AddSlider(LightScaleControl, 50, y += 24, 100, 22, 0, 20, (int)(lightScale * 10.0f), false); y += 24; Button activeLightControl = sampleUi.AddButton(ActiveLightControl, "Change active light (K)", 35, y += 24, 125, 22, System.Windows.Forms.Keys.K, false); Checkbox preShader = sampleUi.AddCheckBox(EnablePreshader, "Enable preshaders", 35, y += 24, 125, 22, isUsingPreshader); // Hook the events preShader.Changed += new EventHandler(OnPreshaderClick); lightSlider.ValueChanged += new EventHandler(OnNumberLightsChanged); activeLightControl.Click += new EventHandler(OnActiveLightClick); scaleSlider.ValueChanged += new EventHandler(OnLightScaleChanged); }
private AcroFields TransferFormFields(Device device, PdfStamper pdfStamper) { AcroFields tmpFields = pdfStamper.AcroFields; using (var newDialog = new Dialog(parentForm)) { newDialog.Text = "Additional Input Required"; ComboBox cmbFrom = new ComboBox(); cmbFrom.FillComboBox(Attributes.DeviceAttributes.Locations); newDialog.AddCustomControl("cmbFromLoc", "Transfer FROM:", (Control)cmbFrom); ComboBox cmbTo = new ComboBox(); cmbTo.FillComboBox(Attributes.DeviceAttributes.Locations); newDialog.AddCustomControl("cmbToLoc", "Transfer TO:", (Control)cmbTo); newDialog.AddLabel("Reason For Transfer-Check One:", true); newDialog.AddCheckBox("chkBetterU", "Better Use of asset:"); newDialog.AddCheckBox("chkTradeIn", "Trade-in or exchange:"); newDialog.AddCheckBox("chkExcess", "Excess assets:"); newDialog.AddCheckBox("chkOther", "Other:"); newDialog.AddRichTextBox("rtbOther", "If Other, Please explain:"); newDialog.ShowDialog(); if (newDialog.DialogResult != DialogResult.OK) { return(null); } string fromLocationCode = cmbFrom.SelectedValue.ToString(); string fromLocDescription = cmbFrom.Text; string toLocationCode = cmbTo.SelectedValue.ToString(); string toLocDescription = cmbTo.Text; tmpFields.SetField("topmostSubform[0].Page1[0].AssetTag_number[0]", device.AssetTag); tmpFields.SetField("topmostSubform[0].Page1[0].Serial_number[0]", device.Serial); tmpFields.SetField("topmostSubform[0].Page1[0].Description_of_asset[0]", device.Description); tmpFields.SetField("topmostSubform[0].Page1[0].Department[0]", AttributeFunctions.DepartmentOf(fromLocationCode)); tmpFields.SetField("topmostSubform[0].Page1[0].Location[0]", fromLocDescription); tmpFields.SetField("topmostSubform[0].Page1[0].Department_2[0]", AttributeFunctions.DepartmentOf(toLocationCode)); tmpFields.SetField("topmostSubform[0].Page1[0].Location_2[0]", toLocDescription); tmpFields.SetField("topmostSubform[0].Page1[0].Better_utilization_of_assets[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkBetterU")))); tmpFields.SetField("topmostSubform[0].Page1[0].Trade-in_or_exchange_with_Other_Departments[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkTradeIn")))); tmpFields.SetField("topmostSubform[0].Page1[0].Excess_assets[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkExcess")))); tmpFields.SetField("topmostSubform[0].Page1[0].undefined[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkOther")))); tmpFields.SetField("topmostSubform[0].Page1[0].Other__Please_explain_1[0]", newDialog.GetControlValue("rtbOther").ToString()); //key //topmostSubform[0].Page1[0].AssetTag_number[0] //topmostSubform[0].Page1[0].Serial_number[0] //topmostSubform[0].Page1[0].Description_of_asset[0] //topmostSubform[0].Page1[0].Department[0] //topmostSubform[0].Page1[0].Location[0] //topmostSubform[0].Page1[0].Department_2[0] //topmostSubform[0].Page1[0].Location_2[0] //topmostSubform[0].Page1[0].Better_utilization_of_assets[0] //topmostSubform[0].Page1[0].Trade-in_or_exchange_with_Other_Departments[0] //topmostSubform[0].Page1[0].Excess_assets[0] //topmostSubform[0].Page1[0].undefined[0] //topmostSubform[0].Page1[0].Other__Please_explain_1[0] //topmostSubform[0].Page1[0].Other__Please_explain_2[0] //topmostSubform[0].Page1[0].Method_of_Delivery_or_Shipping_Please_Check_One[0] //topmostSubform[0].Page1[0].Hand-carried_by[0] //topmostSubform[0].Page1[0].undefined_2[0] //topmostSubform[0].Page1[0].Carrier_company[0] //topmostSubform[0].Page1[0].US_Mail[0] //topmostSubform[0].Page1[0].Shipping_receipt_number[0] //topmostSubform[0].Page1[0].Date_of_shipment_or_transfer[0] //topmostSubform[0].Page1[0].Signature_of_SENDING_official[0] //topmostSubform[0].Page1[0].Department_3[0] //topmostSubform[0].Page1[0].Date[0] //topmostSubform[0].Page1[0].Signature_of_RECEIVING_official[0] //topmostSubform[0].Page1[0].Department_4[0] //topmostSubform[0].Page1[0].Date_2[0] //topmostSubform[0].Page1[0].PrintButton1[0] } return(tmpFields); }
private AcroFields DisposalFormFields(Device device, PdfStamper pdfStamper) { AcroFields tmpFields = pdfStamper.AcroFields; using (var newDialog = new Dialog(parentForm, true)) { newDialog.Text = "Additional Input Required"; #region Section2 newDialog.AddLabel("Reason for asset disposal-please check one:", true); newDialog.AddCheckBox("chkAuction", "Prep for public auction:"); newDialog.AddCheckBox("chkObsolete", "Functional obsolescence:"); newDialog.AddCheckBox("chkTradeIn", "Trade-in or exchange:"); newDialog.AddCheckBox("chkDamaged", "Asset is damaged beyond repair:"); newDialog.AddCheckBox("chkScrap", "Sold as scrap, not at a public sale:"); newDialog.AddCheckBox("chkParts", "Used for parts:"); newDialog.AddCheckBox("chkOther", "Other:"); newDialog.AddRichTextBox("rtbOther", "If Other, Please explain:"); #endregion #region Section3 newDialog.AddLabel("Method of asset disposal-please check one:", true); newDialog.AddCheckBox("chkHand", "Hand carried by:"); newDialog.AddRichTextBox("rtbHand", ""); newDialog.AddCheckBox("chkCarrier", "Carrier company:"); newDialog.AddRichTextBox("rtbCarrier", ""); newDialog.AddCheckBox("chkShipping", "Shipping receipt number:"); newDialog.AddRichTextBox("rtbShipping", ""); newDialog.AddCheckBox("chkDisposed", "Disposed of on premises:"); newDialog.AddRichTextBox("rtbDisposed", ""); newDialog.AddCheckBox("chkOtherMethod", "Other. Please explain:"); newDialog.AddRichTextBox("rtpOtherMethod", ""); #endregion #region Section4 newDialog.AddTextBox("txtSaleAmount", "List the amount of proceeds from the sale of the disposed asset, if any."); newDialog.AddLabel("If the asset item was traded, provide the following information for the asset BEGING ACQUIRED:", true); newDialog.AddTextBox("txtAssetTag", "Asset/Tag Number:"); newDialog.AddTextBox("txtSerial", "Serial Number:"); newDialog.AddTextBox("txtDescription", "Description:"); #endregion newDialog.ShowDialog(); if (newDialog.DialogResult != DialogResult.OK) { return(null); } tmpFields.SetField("topmostSubform[0].Page1[0].AssetTag_number[0]", device.AssetTag); tmpFields.SetField("topmostSubform[0].Page1[0].Mfg_serial_number_1[0]", device.Serial); tmpFields.SetField("topmostSubform[0].Page1[0].Mfg_serial_number_2[0]", device.Description); tmpFields.SetField("topmostSubform[0].Page1[0].Mfg_serial_number_3[0]", AttributeFunctions.DepartmentOf(device.Location)); tmpFields.SetField("topmostSubform[0].Page1[0].County_s_possession[0]", DateTime.Now.ToString("MM/dd/yyyy")); #region Section 2 tmpFields.SetField("topmostSubform[0].Page1[0].Preparation_for_public_auction[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkAuction")))); tmpFields.SetField("topmostSubform[0].Page1[0].Functional_obsolescence[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkObsolete")))); tmpFields.SetField("topmostSubform[0].Page1[0].Trade-in_or_exchange[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkTradeIn")))); tmpFields.SetField("topmostSubform[0].Page1[0].Asset_is_damaged_beyond_repair[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkDamaged")))); tmpFields.SetField("topmostSubform[0].Page1[0].Sold_as_scrap__not_at_a_public_sale[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkScrap")))); tmpFields.SetField("topmostSubform[0].Page1[0].Used_for_parts[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkParts")))); tmpFields.SetField("topmostSubform[0].Page1[0].undefined[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkOther")))); tmpFields.SetField("topmostSubform[0].Page1[0].Other__Please_explain_2[0]", newDialog.GetControlValue("rtbOther").ToString()); #endregion #region Section 3 tmpFields.SetField("topmostSubform[0].Page1[0].Method_of_asset_disposal_please_check_one[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkHand")))); tmpFields.SetField("topmostSubform[0].Page1[0].Hand_carried_by[0]", newDialog.GetControlValue("rtbHand").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0]._1[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkCarrier")))); tmpFields.SetField("topmostSubform[0].Page1[0].Carrier_company[0]", newDialog.GetControlValue("rtbCarrier").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0]._2[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkShipping")))); tmpFields.SetField("topmostSubform[0].Page1[0].Shipping_receipt_number[0]", newDialog.GetControlValue("rtbShipping").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0]._3[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkDisposed")))); tmpFields.SetField("topmostSubform[0].Page1[0].Disposed_of_on_premises[0]", newDialog.GetControlValue("rtbDisposed").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0]._4[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkOtherMethod")))); tmpFields.SetField("topmostSubform[0].Page1[0].Other__Please_explain_3[0]", newDialog.GetControlValue("rtpOtherMethod").ToString()); #endregion #region Section 4 tmpFields.SetField("topmostSubform[0].Page1[0].List_the_amount_of_proceeds_from_the_sale_of_the_disposed_asset__if_any[0]", newDialog.GetControlValue("txtSaleAmount").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0].AssetTag_number_2[0]", newDialog.GetControlValue("txtAssetTag").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0].Serial_number[0]", newDialog.GetControlValue("txtSerial").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0].Description_of_asset[0]", newDialog.GetControlValue("txtDescription").ToString()); tmpFields.SetField("topmostSubform[0].Page1[0].Department_1[0]", AttributeFunctions.DepartmentOf(device.Location)); tmpFields.SetField("topmostSubform[0].Page1[0].Date[0]", DateTime.Now.ToString("MM/dd/yyyy")); #endregion } return(tmpFields); }
/// <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); }
/// <summary> /// Initializes the application /// </summary> public void InitializeApplication() { int y = 10; // Initialize the HUD Button fullScreen = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22); Button toggleRef = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22); Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22); // Hook the button events for when these items are clicked fullScreen.Click += new EventHandler(OnFullscreenClicked); toggleRef.Click += new EventHandler(OnRefClicked); changeDevice.Click += new EventHandler(OnChangeDevicClicked); // Update some fonts sampleUi.SetFont(1, "Comic Sans MS", 24, FontWeight.Normal); sampleUi.SetFont(2, "Courier New", 16, FontWeight.Normal); // Now add the sample specific UI y = 10; sampleUi.AddStatic(StaticControl, "This is a static control.", 0, 0, 200, 30); sampleUi.AddStatic(OutputStaticControl, "This static control provides feedback for your action. It will change as you interact with the UI controls.", 20, 50, 620, 300); sampleUi.GetStaticText(OutputStaticControl)[0].FontColor.States[(int)ControlState.Normal] = new ColorValue(0.0f, 1.0f, 0.0f, 1.0f); // Change color to green sampleUi.GetStaticText(OutputStaticControl)[0].textFormat = DrawTextFormat.Left | DrawTextFormat.Top | DrawTextFormat.WordBreak; sampleUi.GetStaticText(OutputStaticControl)[0].FontIndex = 1; // Edit box EditBox edit = sampleUi.AddEditBox(EditBoxControl, "Edit control with default styles. Type text here and press Enter.", 20, 440, 600, 32); // Slider Slider sl = sampleUi.AddSlider(SliderControl, 200, 450, 200, 24, 0, 1000, 500, false); // Check boxes Checkbox hotKey = sampleUi.AddCheckBox(CheckBoxControl, "This is a checkbox with hotkey. Press 'C' to toggle the check state.", 150, 450, 350, 24, false, System.Windows.Forms.Keys.C, false); Checkbox clearEdit = sampleUi.AddCheckBox(ClearEditControl, "This checkbox controls whether the edit control text is cleared when Enter is pressed.", 150, 460, 430, 24, false); // Combo box ComboBox combo = sampleUi.AddComboBox(ComboBoxControl, 0, 0, 200, 24); if (combo != null) { // Add some items combo.SetDropHeight(100); combo.AddItem("Combo box item", 0x11111111); combo.AddItem("Placeholder", 0x12121212); combo.AddItem("One more", 0x13131313); combo.AddItem("I can't get enough", 0x14141414); combo.AddItem("Ok, last one, I promise", 0x15151515); } // Radio buttons sampleUi.AddRadioButton(RadioButton1A, 1, "Radio group 1 Amy", 0, 50, 200, 24, false); sampleUi.AddRadioButton(RadioButton1B, 1, "Radio group 1 Brian", 0, 50, 200, 24, false); sampleUi.AddRadioButton(RadioButton1C, 1, "Radio group 1 Clark", 0, 50, 200, 24, false); sampleUi.AddRadioButton(RadioButton2A, 2, "Single", 0, 50, 70, 24, false); sampleUi.AddRadioButton(RadioButton2B, 2, "Double", 0, 50, 70, 24, false); sampleUi.AddRadioButton(RadioButton2C, 2, "Trouble", 0, 50, 70, 24, false); // List boxes ListBox singleBox = sampleUi.AddListBox(ListBoxControl, 30, 400, 200, 150, ListBoxStyle.SingleSelection); for (int i = 0; i < 15; i++) { singleBox.AddItem("Single-selection listbox item " + i.ToString(), i); } ListBox multiBox = sampleUi.AddListBox(ListBoxControlMulti, 30, 400, 200, 150, ListBoxStyle.Multiselection); for (int i = 0; i < 30; i++) { multiBox.AddItem("Multi-selection listbox item " + i.ToString(), i); } // Hook some events sl.ValueChanged += new EventHandler(OnValueChanged); hotKey.Changed += new EventHandler(OnHotkeyBoxChanged); clearEdit.Changed += new EventHandler(OnClearEditChanged); combo.Changed += new EventHandler(OnComboChanged); edit.Changed += new EventHandler(OnEditChanged); edit.Enter += new EventHandler(OnEnterHit); // All the radio buttons sampleUi.GetRadioButton(RadioButton1A).Changed += new EventHandler(OnRadioButtonChanged); sampleUi.GetRadioButton(RadioButton1B).Changed += new EventHandler(OnRadioButtonChanged); sampleUi.GetRadioButton(RadioButton1C).Changed += new EventHandler(OnRadioButtonChanged); sampleUi.GetRadioButton(RadioButton2A).Changed += new EventHandler(OnRadioButtonChanged); sampleUi.GetRadioButton(RadioButton2B).Changed += new EventHandler(OnRadioButtonChanged); sampleUi.GetRadioButton(RadioButton2C).Changed += new EventHandler(OnRadioButtonChanged); // Finally the listboxes singleBox.DoubleClick += new EventHandler(OnDoubleClick); singleBox.Selection += new EventHandler(OnSingleSelection); multiBox.DoubleClick += new EventHandler(OnDoubleClick); multiBox.Selection += new EventHandler(OnMultiSelection); }
/// <summary>Initializes the application</summary> public void InitializeApplication() { lightControl = new DirectionWidget(); lightControl.LightDirection = new Vector3((float)Math.Sin((float)Math.PI * 2 - (float)Math.PI / 6), 0, -(float)Math.Cos((float)Math.PI * 2 - (float)Math.PI / 6)); lightScale = 1.0f; ambLightScale = 0.1f; int y = 10; // Initialize the dialogs Button fullScreen = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22); Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22); // Hook the button events for when these items are clicked fullScreen.Click += new EventHandler(OnFullscreenClicked); changeDevice.Click += new EventHandler(OnChangeDevicClicked); // Now add the sample specific UI y = 10; //lighting sampleUi.AddStatic(LightScaleStatic, string.Format("Light scale: {0}", lightScale.ToString("f2", System.Globalization.CultureInfo.CurrentUICulture)), 35, y += 24, 125, 22); Slider scaleSlider = sampleUi.AddSlider(LightScaleControl, 50, y += 24, 100, 22, 0, 20, (int)(lightScale * 10.0f), false); Button lightButton = sampleUi.AddButton(LightColorPicker, "Change light colour", 35, y += 24, 125, 22); sampleUi.AddStatic(AmbLightScaleStatic, string.Format("Ambient light scale: {0}", ambLightScale.ToString("f2", System.Globalization.CultureInfo.CurrentUICulture)), 35, y += 24, 125, 22); Slider ambScaleSlider = sampleUi.AddSlider(AmbLightScaleControl, 50, y += 24, 100, 22, 0, 20, (int)(ambLightScale * 10.0f), false); Button ambLightButton = sampleUi.AddButton(AmbLightColorPicker, "Change ambient colour", 35, y += 24, 125, 22); y += 19; ComboBox shaderPicker = sampleUi.AddComboBox(ChangeShader, 35, y += 24, 125, 22); shaderPicker.AddItem("Standard", null); shaderPicker.AddItem("Color map", "ColorMap"); shaderPicker.AddItem("Alpha/height map", "HeightMap"); shaderPicker.AddItem("Normal map", "NormalMap"); shaderPicker.AddItem("Specular map", "SpecularMap"); shaderPicker.AddItem("Glow map", "GlowMap"); shaderPicker.AddItem("Ambient material", "AmbMat"); shaderPicker.AddItem("Diffuse material", "DifMat"); shaderPicker.AddItem("Specular material", "SpecMat"); shaderPicker.AddItem("Emissive material", "GlowMat"); shaderPicker.AddItem("Vertex position", "vPosition"); shaderPicker.AddItem("Vertex normals", "vNormal"); shaderPicker.AddItem("Vertex colours", "vColor"); shaderPicker.AddItem("Texture coords", "vUV"); shaderPicker.AddItem("Vertex tangents", "vTangent"); shaderPicker.AddItem("Vertex binormals", "vBinormal"); Checkbox wireframeCheckbox = sampleUi.AddCheckBox(WireFrame, "Wireframe", 35, y += 24, 125, 22, false); Checkbox cullCheckBox = sampleUi.AddCheckBox(ToggleCulling, "Backface culling", 35, y += 24, 125, 22, true); y += 19; ComboBox subsetControl = sampleUi.AddComboBox(SubsetControl, 35, y += 24, 125, 22); y += 19; Button loadButton = sampleUi.AddButton(LoadMeshButton, "Load mesh", 35, y += 24, 125, 22); // Hook the events scaleSlider.ValueChanged += new EventHandler(OnLightScaleChanged); lightButton.Click += new EventHandler(lightButton_Click); ambScaleSlider.ValueChanged += new EventHandler(ambScaleSlider_ValueChanged); ambLightButton.Click += new EventHandler(ambLightButton_Click); shaderPicker.Changed += new EventHandler(shaderPicker_Changed); wireframeCheckbox.Changed += new EventHandler(wireframeCheckbox_Changed); subsetControl.Changed += new EventHandler(subsetControl_Changed); loadButton.Click += new EventHandler(loadButton_Click); cullCheckBox.Changed += new EventHandler(cullCheckBox_Changed); }