How to adjust different buttons on the grid of the Visual Studio screen?

0

Very good, I know that lately I ask many questions but every time I go inside more in Visual Studio, more questions and questions arise. Can someone tell me how I could do an auto-adjustment of different buttons or controllers rectangle with the Visual Studio WPF screen? That is, I have connected the Kinect and the screen is auto-adjusted, if the increase is also increased Kinect output screen, then now I would like to do the same with the buttons (drivers) or if you can embed them on the screen. Does anyone know if it is possible? Thank you so much I leave the part of the code that I BELIEVE IS WHERE THIS IS SELF ADJUSTMENT although I'm not sure:

          if (dataReceived)
        {
            using (DrawingContext dc = this.drawingGroup.Open())
            {

                // Draw a transparent background to set the render size 
              dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, 0.0, this.displayWidth, this.displayHeight));





                int penIndex = 0;
                foreach (Body body in this.bodies)
                {
                    Pen drawPen = this.bodyColors[penIndex++];




                    if (body.IsTracked)
                    {
                        this.DrawClippedEdges(body, dc);

                        IReadOnlyDictionary<JointType, Joint> joints = body.Joints;
                        // Console.WriteLine("HandRight" + JointType.HandRight);

                        // convert the joint points to depth (display) space
                        Dictionary<JointType, Point> jointPoints = new Dictionary<JointType, Point>();
                        Joint handLeft = joints[JointType.HandLeft];
    
asked by Daniel Potrimba 29.05.2017 в 09:32
source

1 answer

0

If you are using WPF, I suggest you use Grid :

<Grid>
    <Grid.ColumnDefinitions>
        <Grid.ColumnDefinition Width="*">
        <Grid.ColumnDefinition Width="*">
    </Grid.ColumnDefinitions>

    <Button Grid.Column="0"/>
    <Button Grid.Column="1"/>
</Grid>

When you assign * to Width in the columns or Height in the rows, you are indicating that you assign the remaining size, in this example there are two columns with Width="*" which translates to the size of the screen will be divided between both columns.

To indicate the button in which column it will be, the Grid.Column="[colum_index]" property is used, the button not having a fixed size, will take the size of the column.

For more information, you can review the Microsoft documentation here .

You can help with the following examples: Example 1 and Example 2 .

    
answered by 09.11.2017 в 02:56