logo
down
shadow

How to draw line in Silverlight Specifying Height?


How to draw line in Silverlight Specifying Height?

Content Index :

How to draw line in Silverlight Specifying Height?
Tag : chash , By : Heals1ic
Date : December 05 2020, 12:18 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Does a Silverlight <Line> need Width and Height defined?


Tag : development , By : CM.
Date : March 29 2020, 07:55 AM
I wish this help you No, you can use one of this templates to define coordinates:
X1, X2, Y1, Y2 Canvas.Left, Canvas.Top, Width, Height.

Silverlight - how to draw a line with an arc?


Tag : silverlight , By : Frank Rotolo
Date : March 29 2020, 07:55 AM
it fixes the issue Take a look at drawing Bezier curves (MSDN Link) and learn about the different geometry types (MSDN Link)
Below is a code sample to get you started that will produce the following image:
<Canvas x:Name="LayoutRoot" Background="White">
        <Path Stroke="Blue" StrokeThickness="2" >
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="50,50">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                       <BezierSegment 
                                           Point1="50,20"
                                           Point2="120,170"
                                           Point3="350,150"
                                       /> 
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
        <Path Fill="Gold" Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <EllipseGeometry Center="50,50" RadiusX="20" RadiusY="20" />
            </Path.Data>
        </Path>
        <Path Fill="Gold" Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <EllipseGeometry Center="350,150" RadiusX="20" RadiusY="20" />
            </Path.Data>
        </Path>
    </Canvas>

Draw line in ComboBox in Silverlight


Tag : chash , By : SA.
Date : March 29 2020, 07:55 AM
this will help I see from your code that you didn't set Line's Stroke color. Try setting it to black (and don't forget to add ComboBox to some container):
var lineTypeComboBox = new ComboBox
         {
            Width = 40,
            Background = Background,
            Margin = new Thickness(0),
            Padding = new Thickness(0)
         };
lineTypeComboBox.Items.Add(new Line { X1 = 1, X2 = 20, Y1 = 1, Y2 = 20, Stroke = new SolidColorBrush(Colors.Black) });
//add ComboBox to StackPanel
spMain.Children.Add(lineTypeComboBox);
<ComboBox Width="40">
    <ComboBox.Resources>
        <Style TargetType="Line">
            <Setter Property="X1" Value="1" />
            <Setter Property="Y1" Value="1" />
            <Setter Property="X2" Value="20" />
            <Setter Property="Y2" Value="1" />
            <Setter Property="Stroke" Value="Black" />
        </Style>
    </ComboBox.Resources>

    <ComboBox.Items>
        <ComboBoxItem>
            <Line StrokeThickness="1" />            
        </ComboBoxItem>
        <ComboBoxItem>
            <Line StrokeThickness="3" />            
        </ComboBoxItem>
        <ComboBoxItem>
            <Line StrokeThickness="5" />            
        </ComboBoxItem>
    </ComboBox.Items>
</ComboBox>

Draw line with high StrokeThickness in silverlight


Tag : chash , By : Stephen Dewar
Date : March 29 2020, 07:55 AM
this one helps. I have an application where you can draw on a Canvas (like Paint). The C# code looks basically like this: , I think you are going to be charmed with my answer:
    Point _drawingStart;
    bool _isDrawing;
    private void startDrawing(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
        _drawingStart = e.GetPosition((UIElement)sender);
        InitializePath();
        _isDrawing = true;
    }

    private void stopDrawing(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
        _isDrawing = false;
    }

    private void doDrawing(object sender, System.Windows.Input.MouseEventArgs e)
    {
        if (_isDrawing)
        {
            AddPoint(e.GetPosition((UIElement)sender));
        }
    }
 private void AddPoint(Point newpoint)
 {
        LineSegment l = new LineSegment() { Point = newpoint };
        pathFigure.Segments.Add(l);
        pathFigure.StartPoint = (pathFigure.Segments.First() as LineSegment).Point;
    }

    PathFigure pathFigure;
    Path path;
    private void InitializePath()
    {
        path = new Path()
        {
            StrokeLineJoin = PenLineJoin.Bevel,
            StrokeDashCap = PenLineCap.Round,
            StrokeEndLineCap = PenLineCap.Round,
            StrokeStartLineCap = PenLineCap.Round,
            StrokeThickness = 100.0,
            Stroke = new SolidColorBrush(Colors.Red)
        };

        pathFigure = new PathFigure();
        PathGeometry pathGeometry = new PathGeometry();
        pathGeometry.Figures = new PathFigureCollection();
        pathGeometry.Figures.Add(pathFigure);
        path.Data = pathGeometry;
        DrawingCanvas.Children.Add(path);
    }

How to draw dot on touch in the same line (width or height) with other dot?


Tag : android , By : Yolanda N. Ceron
Date : March 29 2020, 07:55 AM
Does that help I have some situation here, I have one screen and when I touch on it drawing a dot on this coordinates, problem is that I want to draw second dot on the same line x or y it depend if we touch under the dot or next to it? Have you got any ideas about that? , Calculate the maximum of the absolute difference of your positions.
float deltaX = Math.abs(event.getX()-otherPoint.getX());
float deltaY = Math.abs(event.getY()-otherPoint.getY());
if(Math.max(deltaX , deltaY) == deltaX){
// touched rather to left or to right of the otherPoint
}else{
// touched rather below or above the otherPoint
}
Related Posts Related QUESTIONS :
  • Why are unsigned int's not CLS compliant?
  • Why is Array.Length an int, and not an uint
  • How do I make event callbacks into my win forms thread safe?
  • Genealogy Tree Control
  • WCF Service - Backward compatibility issue
  • Binary patch-generation in C#
  • Tab Escape Character?
  • When do Request.Params and Request.Form differ?
  • The imported project "C:\Microsoft.CSharp.targets" was not found
  • Numeric Data Entry in WPF
  • Print a Winform/visual element
  • C# logic order and compiler behavior
  • When to use an extension method with lambda over LINQtoObjects to filter a collection?
  • How to make a button appear as if it is pressed?
  • C# and Arrow Keys
  • How do you resolve a domain name to an IP address with .NET/C#?
  • Should the folders in a solution match the namespace?
  • How can I evaluate C# code dynamically?
  • CSharpCodeProvider Compilation Performance
  • How can I create Prototype Methods (like JavaScript) in C#.Net?
  • DataTable Loop Performance Comparison
  • CSV string handling
  • What is the best way to do unit testing for ASP.NET 2.0 web pages?
  • High availability
  • What to use for Messaging with C#
  • Accessing a Dictionary.Keys Key through a numeric index
  • ConfigurationManager.AppSettings Performance Concerns
  • What Are Some Good .NET Profilers?
  • Is this a good way to determine OS Architecture?
  • How to create a tree-view preferences dialog type of interface in C#?
  • Searching directories for tons of files?
  • Can I have a method returning IEnumerator<T> and use it in a foreach loop?
  • Why can't I have abstract static methods in C#?
  • Displaying ad content from Respose.WriteFile()/ Response.ContentType
  • Convert integers to written numbers
  • Absolute path back to web-relative path
  • How can we generate getters and setters in Visual Studio?
  • Bringing Window to the Front in C# using Win32 API
  • Possible to "spin off" several GUI threads? (Not halting the system at Application.Run)
  • Reading a C/C++ data structure in C# from a byte array
  • How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox?
  • Setting Objects to Null/Nothing after use in .NET
  • Converting ARBG to RGB with alpha blending
  • Is it better to create Model classes or stick with generic database utility class?
  • Passing enum type to Converter with integer value
  • Pool of objects with objects that are already on the scene in advance
  • StatusBar text fade-out when binding using Caliburn.Micro
  • Queryfilter on ApplicationUser in OnModelCreating in ApplicationDbContext creates StackOverflowException
  • How to get record form a different table based on a value from first table with linq expression?
  • Show data in Grid from returned model
  • Using Attributes to Override Data Model Conventions
  • Basic OOP console calculator, result Error
  • Compositon and Repository pattern
  • Multiple using statements with if condition
  • How do i increase a number by 1 in every line that contain the number 1
  • Add binding to elements that are created in codebehind
  • How to add a column in an existing AspNetUsers table
  • Order a list of elements with another list of doubles
  • How to setup a NuGet package to copy content files to output build directory?
  • In SignalR Core using ChannelWriter: Do I need to call TryComplete twice if there's an exception?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com