本文整理汇总了C#中Label.SetSizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Label.SetSizeRequest方法的具体用法?C# Label.SetSizeRequest怎么用?C# Label.SetSizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label.SetSizeRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Gtk.Window window;
EventBox eventbox;
Label label;
Application.Init();
window = new Gtk.Window ("Eventbox");
window.DeleteEvent += new DeleteEventHandler (delete_event);
window.BorderWidth = 10;
window.Resize(400,300);
eventbox = new EventBox ();
window.Add (eventbox);
eventbox.Show();
label = new Label ("Click here to quit");
eventbox.Add(label);
label.Show();
label.SetSizeRequest(110, 20);
eventbox.ButtonPressEvent += new ButtonPressEventHandler (exitbutton_event);
eventbox.Realize();
window.Show();
Application.Run();
}
示例2: SharpApp
public SharpApp()
: base("EventBox Example")
{
SetDefaultSize(230,150);
SetPosition(WindowPosition.Center);
DeleteEvent += delegate {Application.Quit();};
EventBox ebox = new EventBox();
Add(ebox);
ebox.Show();
Label label = new Label("Do Not Touch");
ebox.Add(label);
label.Show();
label.SetSizeRequest(110,20);
ebox.ButtonPressEvent += delegate{ System.Console.WriteLine("Hello");};
ebox.Realize();
Show();
}
示例3: populateGraph
private void populateGraph()
{
//calculate number of rows (totalHeapSize/memRowSize)
uint numRows = (uint)(((uint)FileParser.FileParser.TotalHeapSize) / (Constants.Constants.NUM_GRAPH_COLUMNS * 4));//FileParser.FileParser.MemRowSize;
uint numColumns = (uint)Constants.Constants.NUM_GRAPH_COLUMNS;
//get size of free blocks and starting addresses
List <int> addresses = FileParser.FileParser.AddressList;
List <int> sizes = FileParser.FileParser.SizeList;
int maxFreeAddrPoz = addresses.Count - 1;
int currFreeAddrIndex = 0; //the current index in the list we are looking at
//sort addresses and currfreestartaddr
int inner, outer;
for (outer = addresses.Count - 1; outer > 0; outer--)
{
for (inner = 0; inner < outer; inner++) {
if (addresses [inner] > addresses [inner + 1])
{
int tempAddress = addresses [inner];
int tempSize = sizes [inner];
addresses[inner] = addresses[inner + 1];
sizes [inner] = sizes [inner + 1];
addresses [inner + 1] = tempAddress;
sizes[inner + 1] = tempSize;
}
}
}
bool occupiedForever = false;
int currFreeStartAddr = -1, currFreeEndAddr = -1;
if (addresses.Count != 0) {
currFreeStartAddr = addresses [currFreeAddrIndex];
currFreeEndAddr = currFreeStartAddr + sizes [currFreeAddrIndex]; //the last index of the current free block we are looking in
} else
occupiedForever = true;
graph = new Table (numRows, numColumns, true);
graph.WidthRequest = 200; //set width of graph to fit inside its viewport
//save the starting memoryaddress for use in graph (for now assume it is zero)
uint startMemAddr = (uint)FileParser.FileParser.EarliestFreeAddr;
int currMemAddr = (int) FileParser.FileParser.EarliestFreeAddr; //The current mem address based on the position in the graph we are in
//the rowMarker is used to current byte number in a column (0, 4, 8, 12...)
int rowMarker = 0;
bool makingOccupied = false;
//check if we start off making occupied
if (currMemAddr < currFreeStartAddr)
makingOccupied = true;
for (uint i = 0; i <= numRows; i++)
{
for (uint j = 0; j <= numColumns + 1; j++)
{
//if i is 0, we must be making the address row
if (i == 0) {
//keep padding space empty
if (j <= 1)
continue;
//insert offset from row
graph.Attach (new Label (" " + rowMarker + " "), j, j + 1, i, i + 1);
rowMarker += 4;
continue;
}
else if (j == 0)
{
String hexValue = "0x";
hexValue += startMemAddr.ToString ("X");
Label indexMarker = new Label (" " + hexValue + " ");
indexMarker.Style = graphIndexLabelStyle;
indexMarker.SetSizeRequest (125, 50);
graph.Attach (indexMarker, j, j + 2, i, i + 1);
startMemAddr += (uint)(Constants.Constants.NUM_GRAPH_COLUMNS * 4);
j++;
continue;
}
if (currMemAddr < currFreeStartAddr)
makingOccupied = true;
else if(!occupiedForever)// if (currMemAddr == currFreeStartAddr && !occupiedForever)
makingOccupied = false;
if (currMemAddr != currFreeEndAddr) {
if (makingOccupied || occupiedForever)
graph.Attach (MakeOccupiedColorContainer (), j, j + 1, i, i + 1);
else
graph.Attach (MakeFreeColorContainer (), j, j + 1, i, i + 1);
}
if(occupiedForever)
graph.Attach (MakeOccupiedColorContainer (), j, j + 1, i, i + 1);
//.........这里部分代码省略.........
示例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);
}