private void OnWindowLoad(object sender, EventArgs e) { /* * FormSize frmSizeSetup = new FormSize(); * //Открываем раздел реестра * RegistryKey regkey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\RegApplication"); * //Получаем значения ключей Height и Width * frmSizeSetup.height = Convert.ToInt32(regkey.GetValue("Height")); * frmSizeSetup.width = Convert.ToInt32(regkey.GetValue("Width")); * //Устанавливаем текущие значения ширины и высоты формы * this.Height = frmSizeSetup.height; * this.Width = frmSizeSetup.width; */ //Создаем экземпляр frmSizeSetup класса FormSize: FormSize frmSizeSetup = new FormSize(); //Cоздаем экземпляр xmlser класса XmlSerializer XmlSerializer xmlser = new XmlSerializer(typeof(FormSize)); //Создаем переменную filename, которой присваиваем //название файла applicationSettings.xml в текущей директории string filename = System.Environment.CurrentDirectory + "\\applicationSettings.xml"; //Создаем поток filestream для чтения XML-файла FileStream filestream = new FileStream(filename, FileMode.Open); //Экземпляру frmSizeSetup передаем данные, //полученные в процессе десериализации frmSizeSetup = (FormSize)xmlser.Deserialize(filestream); //Устанавливаем текущие высоту и ширину формы this.Height = frmSizeSetup.height; this.Width = frmSizeSetup.width; //Закрываем поток filestream.Close(); }
public IHttpActionResult PutFormSize(int id, FormSize formSize) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != formSize.FormSizeId) { return BadRequest(); } db.Entry(formSize).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FormSizeExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
private void Tree_Load(object sender, EventArgs e) { this.Width = FormSize.Width(this.Tag.ToString()); this.Height = FormSize.Heigth(this.Tag.ToString()); initialLocation.X = 0; initialLocation.Y = 0; this.Location = initialLocation; }
public IHttpActionResult GetFormSize(int id) { FormSize formSize = db.FormSizes.Find(id); if (formSize == null) { return NotFound(); } return Ok(formSize); }
public override int GetHashCode() { unchecked { int hashCode = (FormName != null ? FormName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FormSize.GetHashCode(); hashCode = (hashCode * 397) ^ FormPosition.GetHashCode(); hashCode = (hashCode * 397) ^ (int)WindowState; return(hashCode); } }
public IHttpActionResult PostFormSize(FormSize formSize) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.FormSizes.Add(formSize); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = formSize.FormSizeId }, formSize); }
private void CustomerCard_Load(object sender, EventArgs e) { int IFW = FormSize.Width(Singleton <Tree> .Instance.Tag.ToString()); initialLocation.X = IFW; initialLocation.Y = 0; this.Location = initialLocation; // dtpSupport_End_Date.Value = Convert.ToDateTime("1990-01-01"); //dtpDue_Date.Value = Convert.ToDateTime("1990-01-01"); //dtpAdded_Date.Value = Convert.ToDateTime("1990-01-01"); /****************/ }
public IHttpActionResult DeleteFormSize(int id) { FormSize formSize = db.FormSizes.Find(id); if (formSize == null) { return NotFound(); } db.FormSizes.Remove(formSize); db.SaveChanges(); return Ok(formSize); }
public void ApplyFormSettings(System.Windows.Forms.Form winform) { if (!Location.Equals(new Point())) { winform.Location = Location; } if (!FormSize.Equals(new Size())) { winform.Size = FormSize; } winform.WindowState = WindowState; }
private void NoRespondLast30Days_Load(object sender, EventArgs e) { this.Width = FormSize.Width(this.Tag.ToString()); this.Height = FormSize.Heigth(this.Tag.ToString()); int IFW = FormSize.Width(Singleton<Tree>.Instance.Tag.ToString()); initialLocation.X = IFW; initialLocation.Y = 0; this.Location = initialLocation; Application.DoEvents(); List<HistoryModel> lm = NoRespondLast30DaysDA.NoRespondLast30Days(Config.VBR4000Connection); BindList(lm); }
private void DueCustomersReportViewer_Load(object sender, EventArgs e) { this.Width = FormSize.Width(this.Tag.ToString()); this.Height = FormSize.Heigth(this.Tag.ToString()); int IFW = FormSize.Width(Singleton <Tree> .Instance.Tag.ToString()); initialLocation.X = IFW; initialLocation.Y = 0; this.Location = initialLocation; Application.DoEvents(); this.CustomerModelBindingSource.DataSource = Customers; this.reportViewer1.RefreshReport(); }
private void NoRespondLast30DaysReportViewer_Load(object sender, EventArgs e) { this.Width = FormSize.Width(this.Tag.ToString()); this.Height = FormSize.Heigth(this.Tag.ToString()); int IFW = FormSize.Width(Singleton <Tree> .Instance.Tag.ToString()); initialLocation.X = IFW; initialLocation.Y = 0; this.Location = initialLocation; Application.DoEvents(); this.BindingSource.DataSource = Historys; this.ReportViewer.RefreshReport(); }
private void CustomerList_Load(object sender, EventArgs e) { this.Width = FormSize.Width(this.Tag.ToString()); this.Height = FormSize.Heigth(this.Tag.ToString()); int IFW = FormSize.Width(Singleton <Tree> .Instance.Tag.ToString()); initialLocation.X = IFW; initialLocation.Y = 0; this.Location = initialLocation; Application.DoEvents(); List <CustomerModel> lm = CustomerDA.GetAllCustomer(Config.VBR4000Connection); BindList(lm); }
private void Main_Load(object sender, EventArgs e) { this.Width = FormSize.Width(this.Tag.ToString()); this.Height = FormSize.Heigth(this.Tag.ToString()); initialLocation.X = 0; initialLocation.Y = 0; this.Location = initialLocation; Singleton <Tree> .Instance.MdiParent = Main.mdi; Application.DoEvents(); Singleton <Tree> .Instance.Show(); Application.DoEvents(); Singleton <Tree> .Instance.Activate(); Application.DoEvents(); }
private void OnWindowClosing(object sender, CancelEventArgs e) { /* * FormSize frmSize = new FormSize(); * frmSize.height = this.Height; * frmSize.width = this.Width; * //Открываем раздел RegApplication * RegistryKey regkey = Registry.CurrentUser.OpenSubKey * ("SOFTWARE\\Microsoft\\RegApplication", true); * //Если раздел не обнаружен, создаем его * if (regkey == null) * { * RegistryKey newregkey = Registry.CurrentUser.OpenSubKey * ("SOFTWARE\\Microsoft", true); * regkey = newregkey.CreateSubKey("RegApplication"); * } * //Записываем значения ширины и высоты формы в ключи Height и Width * regkey.SetValue("Height", frmSize.height); * regkey.SetValue("Width", frmSize.width); */ //Создаем экземпляр frmSize класса FormSize: FormSize frmSize = new FormSize(); // Присваиваем текущие значения высоты и ширины формы //переменным height и width frmSize.height = this.Height; frmSize.width = this.Width; //Cоздаем экземпляр xmlser класса XmlSerializer XmlSerializer xmlser = new XmlSerializer(typeof(FormSize)); //Создаем переменную filename, которой присваиваем //название файла applicationSettings.xml в текущей директории string filename = System.Environment.CurrentDirectory + "\\applicationSettings.xml"; //Создаем поток filestream для создания XML-файла FileStream filestream = new FileStream(filename, FileMode.Create); //Создаем сериализацию для экземпляра frmSize xmlser.Serialize(filestream, frmSize); //Закрываем поток filestream.Close(); }
/// <summary> /// Calculates the dimensions of the Legend. This includes the maximum width /// and height of a single entry, as well as the total width and height of /// the Legend. public void CalculateDimensions(Paint paint, ViewPortHandler viewPortHandler) { var maxEntrySize = GetMaximumEntrySize(paint); float defaultFormSize = FormSize.DpToPixel(); float stackSpace = StackSpace.DpToPixel(); float formToTextSpace = FormToTextSpace.DpToPixel(); float xEntrySpace = XEntrySpace.DpToPixel(); float yEntrySpace = YEntrySpace.DpToPixel(); var wordWrapEnabled = WordWrapEnabled; var entries = Entries; int entryCount = entries.Count; TextWidthMax = maxEntrySize.Width; TextHeightMax = maxEntrySize.Height; switch (Orientation) { case Orientation.Vertical: { float maxWidth = 0f, maxHeight = 0f, width = 0f; float labelLineHeight = paint.LineHeight(); bool wasStacked = false; for (int i = 0; i < entryCount; i++) { LegendEntry e = entries[i]; var drawingForm = e.Form != Form.None; float formSize = float.IsNaN(e.FormSize) ? defaultFormSize : e.FormSize.DpToPixel(); var label = e.Label; if (!wasStacked) { width = 0.0f; } if (drawingForm) { if (wasStacked) { width += stackSpace; } width += formSize; } // grouped forms have null labels if (label != null) { var size = paint.MeasureWidth(label); // make a step to the left if (drawingForm && !wasStacked) { width += formToTextSpace; } else if (wasStacked) { maxWidth = Math.Max(maxWidth, width); maxHeight += labelLineHeight + yEntrySpace; width = 0.0f; wasStacked = false; } width += size; maxHeight += labelLineHeight + yEntrySpace; } else { wasStacked = true; width += formSize; if (i < entryCount - 1) { width += stackSpace; } } maxWidth = Math.Max(maxWidth, width); } NeededWidth = maxWidth; NeededHeight = maxHeight; break; } case Orientation.Horizontal: { float labelLineHeight = paint.LineHeight(); float labelLineSpacing = paint.LineSpacing() + yEntrySpace; float contentWidth = viewPortHandler.ContentWidth * MaxSizePercent; // Start calculating layout float maxLineWidth = 0.0f; float currentLineWidth = 0.0f; float requiredWidth = 0.0f; int stackedStartIndex = -1; CalculatedLabelBreakPoints.Clear(); CalculatedLabelSizes.Clear(); CalculatedLineSizes.Clear(); for (int i = 0; i < entryCount; i++) { LegendEntry e = entries[i]; var drawingForm = e.Form != Form.None; float formSize = float.IsNaN(e.FormSize) ? defaultFormSize : e.FormSize.DpToPixel(); var label = e.Label; CalculatedLabelBreakPoints.Add(false); if (stackedStartIndex == -1) { // we are not stacking, so required width is for this label // only requiredWidth = 0.0f; } else { // add the spacing appropriate for stacked labels/forms requiredWidth += stackSpace; } // grouped forms have null labels if (label != null) { CalculatedLabelSizes.Add(paint.Measure(label)); requiredWidth += drawingForm ? formToTextSpace + formSize : 0.0f; requiredWidth += CalculatedLabelSizes[i].Width; } else { CalculatedLabelSizes.Add(new ChartSize(0, 0)); requiredWidth += drawingForm ? formSize : 0.0f; if (stackedStartIndex == -1) { // mark this index as we might want to break here later stackedStartIndex = i; } } if (label != null || i == entryCount - 1) { float requiredSpacing = currentLineWidth == 0.0f ? 0.0f : xEntrySpace; if (!wordWrapEnabled // No word wrapping, it must fit. // The line is empty, it must fit || currentLineWidth == 0.0f // It simply fits || (contentWidth - currentLineWidth >= requiredSpacing + requiredWidth)) { // Expand current line currentLineWidth += requiredSpacing + requiredWidth; } else { // It doesn't fit, we need to wrap a line // Add current line size to array CalculatedLineSizes.Add(new ChartSize(currentLineWidth, labelLineHeight)); maxLineWidth = Math.Max(maxLineWidth, currentLineWidth); // Start a new line CalculatedLabelBreakPoints.Insert( stackedStartIndex > -1 ? stackedStartIndex : i, true); currentLineWidth = requiredWidth; } if (i == entryCount - 1) { // Add last line size to array CalculatedLineSizes.Add(new ChartSize(currentLineWidth, labelLineHeight)); maxLineWidth = Math.Max(maxLineWidth, currentLineWidth); } } stackedStartIndex = label != null ? -1 : stackedStartIndex; } NeededWidth = maxLineWidth; NeededHeight = labelLineHeight * (float)(CalculatedLineSizes.Count) + labelLineSpacing * (float)(CalculatedLineSizes.Count == 0 ? 0 : (CalculatedLineSizes.Count - 1)); break; } } NeededHeight += YOffset; NeededWidth += XOffset; }
private void MainWindow_ResizeEnd(object sender, EventArgs e) { FormSize.X = Width; FormSize.Y = Height; FormSize.Save(); }