public TabelaElemenataForm(TabelaElemenataFormRezimRada rezimRada, Sprava sprava) { InitializeComponent(); MinimumSize = SystemInformation.MinimizedWindowSize + new Size(0, panel1.Height + panelHeader.Height + 100); try { using (ISession session = NHibernateHelper.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); List <Element> sviElementi = new List <Element>(DAOFactoryFactory.DAOFactory.GetElementDAO().FindAll()); grupe = DAOFactoryFactory.DAOFactory.GetGrupaDAO().FindAll(); Graphics g = CreateGraphics(); float elementSizeMM = Math.Min(210 / 4, 297 / 6); SizeF elementSizePxl = (Size)Point.Round( Utils.mmToPixel(g, new PointF(elementSizeMM, elementSizeMM))); tabela = new TabelaElemenata(sviElementi, elementSizePxl); initUI(); float tezineHeaderHeightMM = 7; float grupaHeaderHeightMM = 5; tezineHeaderHeightPxl = Point.Round( Utils.mmToPixel(g, new PointF(0, tezineHeaderHeightMM))).Y; grupaHeaderHeightPxl = Point.Round( Utils.mmToPixel(g, new PointF(0, grupaHeaderHeightMM))).Y; g.Dispose(); panelHeader.Height = tezineHeaderHeightPxl + grupaHeaderHeightPxl + 1; this.rezimRada = rezimRada; if (rezimRada == TabelaElemenataFormRezimRada.Select) { setSpravaCombo(sprava); cmbSprava.Enabled = false; btnPrint.Enabled = false; btnPrint.Visible = false; btnClose.Enabled = false; btnClose.Visible = false; } else { btnOK.Enabled = false; btnOK.Visible = false; } cmbSprava.SelectedIndexChanged += cmbSprava_SelectedIndexChanged; cmbGrupa.SelectedIndexChanged += cmbGrupa_SelectedIndexChanged; disableTrackBar(); promeniGrupu(); zumiraj(120); panelTabela.MouseWheel += new MouseEventHandler(panelTabela_MouseWheel); } } finally { CurrentSessionContext.Unbind(NHibernateHelper.SessionFactory); } }
public TabelaElemenataForm(TabelaElemenataFormRezimRada rezimRada, Sprava sprava) { InitializeComponent(); MinimumSize = SystemInformation.MinimizedWindowSize + new Size(0, panel1.Height + panelHeader.Height + 100); try { using (ISession session = NHibernateHelper.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); List<Element> sviElementi = new List<Element>(DAOFactoryFactory.DAOFactory.GetElementDAO().FindAll()); grupe = DAOFactoryFactory.DAOFactory.GetGrupaDAO().FindAll(); Graphics g = CreateGraphics(); float elementSizeMM = Math.Min(210 / 4, 297 / 6); SizeF elementSizePxl = (Size)Point.Round( Utils.mmToPixel(g, new PointF(elementSizeMM, elementSizeMM))); tabela = new TabelaElemenata(sviElementi, elementSizePxl); initUI(); float tezineHeaderHeightMM = 7; float grupaHeaderHeightMM = 5; tezineHeaderHeightPxl = Point.Round( Utils.mmToPixel(g, new PointF(0, tezineHeaderHeightMM))).Y; grupaHeaderHeightPxl = Point.Round( Utils.mmToPixel(g, new PointF(0, grupaHeaderHeightMM))).Y; g.Dispose(); panelHeader.Height = tezineHeaderHeightPxl + grupaHeaderHeightPxl + 1; this.rezimRada = rezimRada; if (rezimRada == TabelaElemenataFormRezimRada.Select) { setSpravaCombo(sprava); cmbSprava.Enabled = false; btnPrint.Enabled = false; btnPrint.Visible = false; btnClose.Enabled = false; btnClose.Visible = false; } else { btnOK.Enabled = false; btnOK.Visible = false; } cmbSprava.SelectedIndexChanged += cmbSprava_SelectedIndexChanged; cmbGrupa.SelectedIndexChanged += cmbGrupa_SelectedIndexChanged; disableTrackBar(); promeniGrupu(); zumiraj(120); panelTabela.MouseWheel += new MouseEventHandler(panelTabela_MouseWheel); } } finally { CurrentSessionContext.Unbind(NHibernateHelper.SessionFactory); } }