I use setSeriesShape(seriesindex, new Rectangle(5,5)) to draw itemshapes.
But somehow they end up not being centered.
Is there a method to set position?
alt text http://dl.dropbox.com/u/1144075/Bildschirmfoto%202010-08-05%20um%2011.36.45.JPG
Try new Rectangle(-2, -2, 5, 5).
Related
I haven't been able to find much about this in my win32 book or using google. I want to move the x position of a push button I created in a dialog window. In a nutshell, I have 6 buttons and want to reposition them based on if I have to display 4, 5, or 6 buttons.
The goal is to send a message to a button during runtime and move it's x position. I can find simple ways to update the buttons text field and color during runtime, but not position.
My button is...
#define IDC_PB_BUTTON_A
and created as this in a dialog window...
PUSHBUTTON "A", IDC_PB_BUTTON_A, 4, 4, 30, 30, BS_MULTILINE
I would like to grab that first 4 value during runtime and move it over 10 units making it... where the x position value has changed from 4 to 14.
PUSHBUTTON "A", IDC_PB_BUTTON_A, 14, 4, 30, 30, BS_MULTILINE
I was hoping I could do this with some sort of SendDlgItemMessage(), but can't find anything on the subject. Any suggestions?
The API call to move a window is SetWindowPos1. Make sure to pass SWP_NOSIZE so that the controls retain their initial size.
1 You could use MoveWindow as well, but that requires that you pass in the new window size as well as the position. To retain the window size you'd have to call GetWindowRect first.
I have WPF/VB application that animates an ellipse geometry along a path using point animation. I used PointAnimationUsingPath and a Storyboard as per this MSDN example and it works great.
I now want to show a number inside the ellipse. To do this I created a combined geometry and set my ellipse as geometry1. I then created a formattedtext(...).buildgeometry for my number and set that as geometry2. Like this:
Dim CarGeo AS New CombinedGeometry()
CarGeo.Geometry1 = New EllipseGeometry(StartPoint, 5, 5)
CarGeo.Geometry2 = New FormattedText(carIndex.ToString, System.Globalization.CultureInfo.GetCultureInfo("en-us"), Windows.FlowDirection.LeftToRight, New Typeface("Veranda"), 7, Brushes.White).BuildGeometry(New Point(StartPoint.X - 4, StartPoint.Y - 4))
The resulting geometry is exactly what I wanted.
The problem is I don't seem to be able to animate this geometry along my path because unlike an ellipse there is no center property in a combined geometry to set the targeted property to on the StoryBoard.
' Create a PointAnimationgUsingPath to move the car along the animation path.
cpAnimation = New PointAnimationUsingPath
cpAnimation.PathGeometry = pgSectorPath(intSector)
cpAnimation.Duration = timDuration
' Set the animation to target the Center property of the EllipseGeometry
Storyboard.SetTargetName(cpAnimation, "CarGeo")
Storyboard.SetTargetProperty(cpAnimation, New PropertyPath(EllipseGeometry.CenterProperty))
Is there I property in a combined geometry that I can use for the animation?
If not can I wrap the geometry in something else that can be animated?
I'm very new to WPF and have wasted way too much time searching for an answer to this. Any help would be greatly appreciated.
Just wrap the CombinedGeometry into a Path object, as in the MS example:
http://msdn.microsoft.com/en-us/library/system.windows.media.combinedgeometry(v=vs.110).aspx
I have problem with SolidColorBrush setting. I create polygon layer in bing map control in silverlight. When I set color as:
Dim kocka As New Microsoft.Maps.MapControl.MapPolygon()
kocka.Fill = New SolidColorBrush(Colors.Blue)
everything is OK and polygon is displayed. But, when I use this approach (dynamic setting):
Dim kocka As New Microsoft.Maps.MapControl.MapPolygon()
kocka.Fill = New SolidColorBrush(Color.FromArgb(0, 233, 14, 55))
'OR: Color.FromArgb(CByte(0), CByte(233), CByte(14), CByte(55)))
the polygon is not displayed. What is wrong? I tried everything and nothing works.
Thanks
The first parameter in Color.FromArgb is the Alpha channel (aka opacity). A value of 0 will make it fully transparent, so you should set it to something greater than 0 if you want to actually see the color. For instance:
kocka.Fill = New SolidColorBrush(Color.FromArgb(255, 233, 14, 55))
Check out this Wikipedia article for more information on ARGB colors.
Is there a way to hide the cursor in a WPF textbox? I know there is Cursor="None" but that only affects the mouse cursor. I want to hide the "text cursor".
Caret is the current insert position in a text editor. Cursor is the shape of the mouse cursor.
There is no way to disable the caret in a read-write TextBox. Instead, change the CaretBrush to be transparent.
TextBox txt = ...;
// Hide the caret.
txt.CaretBrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
// Show the caret.
txt.CaretBrush = null; // use default Brush
You can colour the cursor the same colour as the background or Transparent using the TextBox.CaretBrush property.
I need to get element from canvas by given point.
For example I have Rectangle on Canvas, which CanvasLeft and CanvasTop values are setted to some values.
I whant get element from canvas which CanvasLeft and CanvasTop vaules are for example 10 and 40.
Is it possible?
Thanks.
You can find the elements a specific position by using the VisualTreeHelper. It has a method FindElementsInHostCoordinates. You'll have to give it a host, for example the canvas and the coordinates and it returns a list of UIElements.
Here's the info on MSDN:
http://msdn.microsoft.com/en-us/library/cc838402(v=VS.95).aspx
Code like this should do it:-
UIElement elem = VisualTreeHelper.FindElementsInHostCoordinates(new Point(10, 40), myCanvas).FirstOrDefault();