VAGSuite.MapViewerEx.SetViewSize C# (CSharp) Method

SetViewSize() public method

public SetViewSize ( ViewSize vs ) : void
vs ViewSize
return void
        public void SetViewSize(ViewSize vs)
        {
            m_vs = vs;
            if (vs == ViewSize.SmallView)
            {
                gridView1.PaintStyleName = "UltraFlat";
                gridView1.Appearance.Row.Font = new Font("Tahoma", 8);
                this.Font = new Font("Tahoma", 8);
                gridView1.Appearance.Row.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                gridView1.Appearance.Row.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            }
            else if (vs == ViewSize.ExtraSmallView)
            {
                gridView1.PaintStyleName = "UltraFlat";
                gridView1.Appearance.Row.Font = new Font("Tahoma", 7);
                this.Font = new Font("Tahoma", 7);
                gridView1.Appearance.Row.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                gridView1.Appearance.Row.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            }
        }

Usage Example

Beispiel #1
0
        private void StartCompareMapViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength, SymbolCollection curSymbols, int symbolnumber)
        {
            try
            {
                SymbolHelper sh = FindSymbol(curSymbols, SymbolName);

                DevExpress.XtraBars.Docking.DockPanel dockPanel;
                bool pnlfound = false;
                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                {

                    if (pnl.Text == "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]")
                    {
                        if (pnl.Tag.ToString() == Filename) // <GS-10052011>
                        {
                            dockPanel = pnl;
                            pnlfound = true;
                            dockPanel.Show();
                        }
                    }
                }
                if (!pnlfound)
                {
                    dockManager1.BeginUpdate();
                    try
                    {
                        dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                        dockPanel.Tag = Filename;// Tools.Instance.m_currentfile; changed 24/01/2008
                        MapViewerEx tabdet = new MapViewerEx();

                        tabdet.AutoUpdateIfSRAM = false;// m_appSettings.AutoUpdateSRAMViewers;
                        tabdet.AutoUpdateInterval = 99999;
                        tabdet.SetViewSize(ViewSize.NormalView);

                        //tabdet.IsHexMode = barViewInHex.Checked;
                        tabdet.Viewtype = m_appSettings.DefaultViewType;
                        tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                        tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                        tabdet.GraphVisible = m_appSettings.ShowGraphs;
                        tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                        tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                        tabdet.Filename = Filename;
                        tabdet.Map_name = SymbolName;
                        tabdet.Map_descr = tabdet.Map_name;
                        tabdet.Map_cat = XDFCategories.Undocumented;
                        tabdet.X_axisvalues = GetXaxisValues(Filename, curSymbols, tabdet.Map_name);
                        tabdet.Y_axisvalues = GetYaxisValues(Filename, curSymbols, tabdet.Map_name);

                        SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                        string x_axis = string.Empty;
                        string y_axis = string.Empty;
                        string x_axis_descr = string.Empty;
                        string y_axis_descr = string.Empty;
                        string z_axis_descr = string.Empty;

                        tabdet.X_axis_name = sh.X_axis_descr;
                        tabdet.Y_axis_name = sh.Y_axis_descr;
                        tabdet.Z_axis_name = sh.Z_axis_descr;
                        tabdet.XaxisUnits = sh.XaxisUnits;
                        tabdet.YaxisUnits = sh.YaxisUnits;
                        tabdet.X_axisAddress = sh.Y_axis_address;
                        tabdet.Y_axisAddress = sh.X_axis_address;

                        tabdet.Xaxiscorrectionfactor = sh.X_axis_correction;
                        tabdet.Yaxiscorrectionfactor = sh.Y_axis_correction;

                        //tabdet.X_axisvalues = GetXaxisValues(Tools.Instance.m_currentfile, curSymbols, tabdet.Map_name);
                        //tabdet.Y_axisvalues = GetYaxisValues(Tools.Instance.m_currentfile, curSymbols, tabdet.Map_name);

                        int columns = 8;
                        int rows = 8;
                        int tablewidth = GetTableMatrixWitdhByName(Filename, curSymbols, tabdet.Map_name, out columns, out rows);
                        int address = Convert.ToInt32(SymbolAddress);
                        if (address != 0)
                        {
                            tabdet.Map_address = address;
                            int length = SymbolLength;
                            tabdet.Map_length = length;
                            byte[] mapdata = Tools.Instance.readdatafromfile(Filename, address, length, Tools.Instance.m_currentFileType);
                            tabdet.Map_content = mapdata;
                            tabdet.Correction_factor = sh.Correction;
                            tabdet.Correction_offset = sh.Offset;// GetMapCorrectionOffset(tabdet.Map_name);
                            tabdet.IsUpsideDown = m_appSettings.ShowTablesUpsideDown;
                            tabdet.ShowTable(columns, true);
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.onSymbolSave += new VAGSuite.MapViewerEx.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onSymbolRead += new VAGSuite.MapViewerEx.NotifyReadSymbol(tabdet_onSymbolRead);
                            tabdet.onClose += new VAGSuite.MapViewerEx.ViewerClose(tabdet_onClose);

                            tabdet.onSliderMove += new MapViewerEx.NotifySliderMove(tabdet_onSliderMove);
                            tabdet.onSplitterMoved += new MapViewerEx.SplitterMoved(tabdet_onSplitterMoved);
                            tabdet.onSelectionChanged += new MapViewerEx.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new MapViewerEx.SurfaceGraphViewChangedEx(tabdet_onSurfaceGraphViewChangedEx);
                            tabdet.onAxisLock += new MapViewerEx.NotifyAxisLock(tabdet_onAxisLock);
                            tabdet.onViewTypeChanged += new MapViewerEx.ViewTypeChanged(tabdet_onViewTypeChanged);

                            //dockPanel.DockAsTab(dockPanel1);
                            dockPanel.Text = "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]";
                            dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 1);
                            bool isDocked = false;
                            // Try to dock to same symbol
                            foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                            {
                                if (pnl.Text.StartsWith("Symbol: " + SymbolName) && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                {
                                    dockPanel.DockAsTab(pnl, 0);
                                    isDocked = true;
                                    break;
                                }
                            }
                            if (!isDocked)
                            {
                                int width = 500;
                                if (tabdet.X_axisvalues.Length > 0)
                                {
                                    width = 30 + ((tabdet.X_axisvalues.Length + 1) * 45);
                                }
                                if (width < 500) width = 500;
                                if (width > 800) width = 800;

                                dockPanel.Width = width;
                            }
                            dockPanel.Controls.Add(tabdet);
                        }
                    }
                    catch (Exception E)
                    {
                        Console.WriteLine(E.Message);
                    }
                    dockManager1.EndUpdate();
                    System.Windows.Forms.Application.DoEvents();
                }
            }
            catch (Exception startnewcompareE)
            {
                Console.WriteLine(startnewcompareE.Message);
            }
        }
All Usage Examples Of VAGSuite.MapViewerEx::SetViewSize
MapViewerEx