当前位置: 首页>>代码示例>>C#>>正文


C# Viewport.Add方法代码示例

本文整理汇总了C#中Viewport.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Viewport.Add方法的具体用法?C# Viewport.Add怎么用?C# Viewport.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Viewport的用法示例。


在下文中一共展示了Viewport.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateViewport

	   public static ScrolledWindow CreateViewport()
	   {
		   ScrolledWindow scroller = new ScrolledWindow();
		   Viewport viewer = new Viewport();
		   
		   Table widgets = new Table(1, 2, false);
		   
		   widgets.Attach(new Button("This is example Entry 1"), 0, 1, 0, 1);
		   widgets.Attach(new Button("This is example Entry 2"), 1, 2, 0, 1);
 
		   // Place the widgets in a Viewport, and the 
		   // Viewport in a ScrolledWindow
		   viewer.Add(widgets);
		   scroller.Add(viewer);
		   return scroller;
	   }
开发者ID:emtees,项目名称:old-code,代码行数:16,代码来源:viewport.cs

示例2: OnIvFtpBrowserItemActivated_NPlot

    //========NPLOT===========
    void OnIvFtpBrowserItemActivated_NPlot(object o, ItemActivatedArgs args)
    {
        //TODO: Implement OnIvFtpBrowserItemActivated

        /* Get and parse file.
         * Populate appropriate classes.
         * --> LogFileEntries.
         * --> Graph Class
         * Plot graph and alarms.
         */

        NPlot.Gtk.PlotSurface2D graph = null;

        string selected_file = get_BrowserItem_Value (ivFtpBrowser);
        StreamReader file_reader = c_current_ftp_session.CFTP_GetFile (selected_file);

        Viewport _port = new Viewport (new Adjustment(1000, 500, 1000, 5, 0, 500),
            new Adjustment (500, 500, 500, 0, 0, 500));
        _port.WidthRequest = 2000;
        _port.ResizeMode = ResizeMode.Parent;

        c_current_logfile = new CLogFile
            (
                file_reader,
                c_current_ftp_session.CFTP_LogFileDate,
                c_current_device.DeviceFileDescription
            );

        c_current_graph = new CGraph (c_current_logfile.LogFileEntries);
        //c_current_graph.YAxisCodeIndex = c_current_logfile.CLogFile_Get_Y_Axis_Code_Index (c_current_device);
        c_current_graph.Title = selected_file;
        c_current_graph.YAxisCode = "CURTEMP";
        c_current_graph.YAxisLabel = "Current Temperature";
        c_current_graph.XAxisLabel = "Time Stamp";
        c_current_graph.CGRAPH_X_AxisData = c_current_logfile.LogFileTime;
        c_current_graph.CGRAPH_Y_AxisData = c_current_logfile.LogFileTemps;

        /**
         * Plot Graph
         */

        swGraph.Remove ((Widget)swGraph.Child);

        graph = new PlotSurface2D();
        graph.WidthRequest = 2000;
        graph.Allocation  = (new Gdk.Rectangle (0, 0, 2000, 500));

        c_current_graph.plot_nplot (out graph);

        swGraph.ReallocateRedraws = true;

        //swGraph.AddWithViewport (graph);
        _port.Add (graph);
        swGraph.ResizeMode = ResizeMode.Queue;
        swGraph.Add (_port);
        graph.QueueResize ();
        swGraph.QueueDraw ();
        swGraph.ShowAll ();

        /**
         * Fill Alarms Table
         */

        FillAlarmsTable (c_current_logfile.LogFileAlarms);

        file_reader.Close ();
        file_reader.Dispose ();

        nbFrames.CurrentPage = (int)nb_Notebook_Pages.GRAPH;
    }
开发者ID:johnnyrequiem,项目名称:SubZeroViewer2,代码行数:71,代码来源:MainWindow.cs

示例3: addLinkPanel

    /**
     * Creates the "link" panel, which shows links between free blocks
     * */
    private void addLinkPanel()
    {
        //master mid panel container
        midPanel = new VBox ();

        //will store links between free blocks
        linkPanel = new VBox ();
        linkPanel.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);

        Label linkHeader = new Label (Constants.Constants.LinkHeader);
        linkHeader.Style = subHeaderLabelStyle.Copy ();

        linkPanel.PackStart (linkHeader, false, false, 10);

        //get the address link and insert values in form list[i] -> list[i + 1]
        List<int> addresses = FileParser.FileParser.AddressList;

        String link = "";
        for (int i = 0; i < addresses.Count; i++)
        {
            //make the link string
            link += "0x";
            link += addresses [i].ToString ("X");
            link += " -> ";

            if (i < addresses.Count - 1)
                link += ("0x" + addresses [i + 1].ToString ("X"));
            else
                link += "NULL";

            //insert it into thepanel
            Label linkInfoLabel = new Label (link);
            linkInfoLabel.Style = linkInfoStyle.Copy ();
            linkPanel.PackStart (linkInfoLabel, false, false, 5);

            //reset link
            link = "";
        }

        Viewport linkViewPort = new Viewport ();
        linkViewPort.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);
        linkViewPort.Add (linkPanel);

        //add the window for the graph frame
        linkWindow = new ScrolledWindow ();
        linkViewPort.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);
        linkWindow.Add (linkViewPort);

        //give border to legend container
        Frame f = new Frame ();
        f.Add (linkWindow);

        midPanel.PackStart (f, false, false, 10);
    }
开发者ID:gnikonorov,项目名称:MemoryVisualizer,代码行数:57,代码来源:MainWindow.cs

示例4: addMainPanel

    /**
     * Method will be responsible for creating all main visual information used in this tool.
     * Achieved with numerous helper methods.
     * **/
    private void addMainPanel()
    {
        //holds graph + mem row size info
        graphContainer = new VBox ();

        EventBox rowSizeLabelContainer = new EventBox ();

        Label rowSizeLabel = new Label ("Row size: " + FileParser.FileParser.MemRowSize);
        rowSizeLabel.Style = subHeaderLabelStyle.Copy ();

        rowSizeLabel.SetSizeRequest(Constants.Constants.GRAPH_SIDE, 50);
        rowSizeLabelContainer.Add (rowSizeLabel);
        graphContainer.PackStart (rowSizeLabelContainer, false, false, 10);
        populateGraph ();

        //create grid layout that will hold block information and visual representation of memory
        HBox graphHBox = new HBox ();
        graphHBox.PackStart (graph, true, true, 40);

        graphContainer.PackStart (graphHBox, false, false, 50);

        //give border to legend container
        graphFrame = new Frame ();
        graphFrame.SetSizeRequest (Constants.Constants.GRAPH_CONTAINER_SIDE, Constants.Constants.LINK_PANEL_HEIGHT + 100);

        Viewport graphViewPort = new Viewport ();

        graphViewPort.SetSizeRequest (Constants.Constants.GRAPH_CONTAINER_SIDE, Constants.Constants.LINK_PANEL_HEIGHT);
        graphViewPort.Add (graphContainer);

        //add the window for the graph frame
        graphWindow = new ScrolledWindow ();
        graphWindow.SetSizeRequest (Constants.Constants.GRAPH_SIDE, Constants.Constants.LINK_PANEL_HEIGHT);
        graphWindow.Add (graphViewPort);

        graphFrame.Add (graphWindow);
    }
开发者ID:gnikonorov,项目名称:MemoryVisualizer,代码行数:41,代码来源:MainWindow.cs

示例5: DiffWidget

	private DiffWidget(Hunk[] hunks, Options options) : base(false, 0) {
		if (hunks == null || hunks.Length == 0 || options == null)
			throw new ArgumentException();
		
		if (options.LeftName != null && options.RightName != null) {
			HBox filetitles = new HBox(true, 2);
			PackStart(filetitles, false, false, 2);
			Label leftlabel = new Label(options.LeftName);
			Label rightlabel = new Label(options.RightName);
			filetitles.PackStart(leftlabel);
			filetitles.PackStart(rightlabel);
		}
		
		HBox centerpanel = new HBox(false, 0);
		PackStart(centerpanel);

		ScrolledWindow scroller = new ScrolledWindow();
		
		centerpanel.PackStart(new OverviewRenderer(scroller, hunks, options.SideBySide), false, false, 0);
		
		Viewport textviewport = new Viewport();
		
		centerpanel.PackStart(scroller);
		scroller.Add(textviewport);
		
		int nRows = 0;
		foreach (Hunk hunk in hunks) {
			if (options.SideBySide) {
				nRows += hunk.MaxLines();
			} else {
				if (hunk.Same) {
					nRows += hunk.Original().Count;
				} else {
					for (int i = 0; i < hunk.ChangedLists; i++)
						nRows += hunk.Changes(i).Count;
				}
			}
		}
		
		uint nCols = 1 + (uint)hunks[0].ChangedLists;
		if (options.SideBySide) nCols += 2;
		if (options.LineNumbers) nCols++;
		
		Table difftable = new Table((uint)nRows, (uint)nCols, false);
		textviewport.Add(difftable);	
		
		uint row = 0;
		
		Pango.FontDescription font = null;
		if (options.Font != null)
			font = Pango.FontDescription.FromString(options.Font);
		
		foreach (Hunk hunk in hunks) {
			char leftmode = hunk.Same ? ' ' : (hunk.ChangedLists == 1 && hunk.Changes(0).Count == 0) ? '-' : 'C';
			uint inc = 0;
			
			if (options.SideBySide) {
				ComposeLines(hunk.Original(), leftmode, -1, difftable, row, false, 0, options.LineWrap, font, options.LineNumbers);
				inc = (uint)hunk.Original().Count;
			} else { 
				if (leftmode == 'C') leftmode = '-';
				int altlines = -1;
				if (hunk.ChangedLists == 1 && hunk.Same)
					altlines = hunk.Changes(0).Start;
				ComposeLines(hunk.Original(), leftmode, altlines, difftable, row, true, 0, options.LineWrap, font, options.LineNumbers);
				row += (uint)hunk.Original().Count;
			}

			for (int i = 0; i < hunk.ChangedLists; i++) {
				char rightmode = hunk.Same ? ' ' : hunk.Original().Count == 0 ? '+' : 'C';
				
				if (options.SideBySide) {
					int colsper = 1 + (options.LineNumbers ? 1 : 0);			
					ComposeLines(hunk.Changes(i), rightmode, -1, difftable, row, false, (uint)((i+1)*colsper), options.LineWrap, font, options.LineNumbers);
					if (hunk.Changes(i).Count > inc)
						inc = (uint)hunk.Changes(i).Count;
				} else {
					if (rightmode == 'C') rightmode = '+';
	
					if (!hunk.Same) 
						ComposeLines(hunk.Changes(i), rightmode, -1, difftable, row, true, 0, options.LineWrap, font, options.LineNumbers);
					
					if (!hunk.Same) row += (uint)hunk.Changes(i).Count;
				}
			}
			
			if (options.SideBySide)
				row += inc;
		}
	}
开发者ID:xxjeng,项目名称:nuxleus,代码行数:90,代码来源:NDiff.cs


注:本文中的Viewport.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。