I have this panel in my app which is 10400 pixels wide.
I have my CenterOfRotationX and CenterOfRotationZ = 0.5.
I have the GlobalOffsets configured so that the rotation of the panel is visible on the screen.
This video shows the RotationY being set from -180 to 180.
http://www.youtube.com/watch?v=zDrETOueb-w
Its really weird at RotationY = 90 (about 13 seconds on the video), it seems to get stretched to hell when I would expect it to disappear from view.
Also from about 8 - 9 seconds on the video shows the panel starting at RotationY = 0 to RotationY = 20, where it starts to stretch. Over this small rotation it appears to nearly rotate 180 degrees.
Maybe I have some settings wrong but this seems really strange. - The only value changing in this video is the RotationY.
The problem was with the GlobalOffsetX variable on the ProjectionPlane.
This was set to something astronomical so I could see the full rotation on the screen but this had an effect on the rotation.
Setting this to 0 and then moving the Plane to the left using the Canvas.LeftProperty fixed this.
Related
I have a winform, I define the Height to be 436 and the Width to be 470. I then display the mouse position in the title bar to check. What I expected to see is a value of 0 to 469 in the X direction when the mouse is over the form. What I see is that the maximum value in this axis is 459 and that the value changes even when the mouse is some distance from the form. I can bodge this to fit but it would be nice to be able to calculate the required size of the form to fit the controls. The height is not correct either. Could anyone point me to an explanation? This is created using VS 2017 on a Windows 10 PC. This is what the screen looks like as the X axis just stops changing, note the mouse position:
enter image description here
Forms have invisible borders. You can use margin instead of exact coordinates
I need to 'snap' a WPF window to the left edge of my screen. I've tried setting the Left value to zero, but this leaves a small gap, of about 8 pixels. Does anyone know why/what this is?
It's the window border and its size depends on the current Windows theme so that gap could vary.
Try subtracting the current Non-Client Frame thickness:
myWindow.Left = 0.0 - SystemParameters.WindowNonClientFrameThickness.Left;
I want to create a slider, with values from 0 to 100 that I can slide like any other slider... but at position 30, 42 and 55 (for example) I want to snap to these values, to make easy to the user to stop the slider at them
edit: my solution was to have 2 slider, the first one is invisible, value 0 to 200, and the other one is the visible on, value 0 to 100
The visible one cannot be slide, only the the invisible. Like this i can make a gap, ex: when I'm between 50 and 75 on the invisible slider, it's equals to 50 on the visible one...
You have to override OnValueChanged. See this article DiscreteSlider - Adding Functionality with a Simple Control Subclass and then this artice Silverlight slider control that snaps for a detailed explanation.
Instead of using SmallChange, you would check where between your values the slider sits and snap to the nearest.
I have a user control that has a white background with a Zindex = 0. I also have an image on top of the white background with a Zindex = 10. When I use planeprojection to flip the image 180 degrees on the X-axis it just shows my image in reverse. How would I get it to show the white background when it gets flipped?
PlaneProjection inherently won't show the "back side" of a container. What you need to do:
Define two elements in your container: one for the front/visible side and one for the back/hidden side
When your PlaneProjection rotation is greater than 90 degrees, hide the front element, and show the back element. Vice-versa for switching back to < 90 degrees
I believe you can use the VisualStateManager to intercept when the rotation angle hits a certain value and to then apply the visibility.
Here is a Tim Heurer article on the VSM:
http://timheuer.com/blog/archive/2008/06/04/silverlight-introduces-visual-state-manager-vsm.aspx
I'm working on a Windows Form in VB.NET 2005 and I would like to have some buttons with images (I'm talking about the plain, vanilla System.Windows.Forms.Button). I have everything set up the way I want it but the images are displaying too low on the button, such that the bottom of the icon is almost right on the bottom of the button and there is a lot of space above the image.
Here is a screenshot:
Button Screenshot http://www.freeimagehosting.net/uploads/b28a5c63b8.jpg
See how the corner of the icon is brushing up against the bottom of the button?
My button is 23 pixels high and the image is a 16 x 16 icon (converted to a bitmap so that it can be assigned to the button's Image property).
I've tried setting the button's Margin.All property to 0, and verified that the Padding.All property is 0. I've also tried changing the button's ImageAlign to TopLeft, MiddleLeft, and BottomLeft, but none of those settings seem to have any affect.
Does anyone know how I can position the image to be of equal distance from the top and bottom edges of the button? I can resize the button or the image if necessary but they are at my preferred size and I would like to keep them that way if possible.
I just encountered a similar problem, which I was able to solve by thinking really hard. (Ain't those situations great?)
The explanation
First it's important to understand that ImageAlign does NOT mean where on the button do you want the image. It means what point (pixel) on the image should be used for positioning. So if you pick "TopLeft", then the top-left-most pixel of the image will be vertically CENTERED on the button.
The problem comes in when you have a button with a centered image, whose ImageAlign is set vertically to "center", and whose dimensions are of an even number of pixels. Your image is 16x16 pixels- 16 is an even number. The middle pixel would theoretically be somewhere between pixel 8 and pixel 9. Since there is no pixel 8.5, VB rounds down to 8, thereby using pixel 8 as your positioning pixel. This the root cause of your unwanted upper margin.
Your button has an odd pixel height (23px) which means it has a true center pixel- pixel 12. VB tries to position the image's center pixel (8) on top of the button's center pixel (12). This puts 8 of the image's pixels BELOW center, and 7 pixels ABOVE center. To even things out, a 1-pixel margin appears above the image.
The solution
Pad the image with 1 extra row of pixels on the bottom. The image now has a height that's odd (17 px), giving the image a true center pixel which can line up perfectly with the button's center pixel.
That's how I solved the problem for myself. However, a simpler possible solution just occurred to me. You could probably achieve the same result by assigning the image a bottom margin of 1px. I have not tested this solution but it seems theoretically equivalent to the first solution.
Additional note: Two objects of EVEN dimensions should theoretically be able to center-align perfectly. But strangely enough, the alignment problem occurs even if the button AND the image BOTH have even dimensions. (Apparently the compiler is not consistent in the way it determines the center pixel of one control vs another.) Nonetheless, in this case, the same solution applies.
Typically, we'll set the following properties (for an image on the right, for example):
ImageAlign: MiddleRight
TextAlign: MiddleLeft
You'll want to align both the text and image in a similar fashion. Outside of that, make sure that you are setting the Image property, not the BackgroundImage property and make sure you are doing the icon to plain bitmap conversion properly. Have you tried a plain bitmap file?
Just a question: are you positive that the bitmap contains no information on the top of the note image? I have had that happen to me more than once where a crop looked right in Photoshop and came out incorrect in the live code... :)
If that were the case your code may be perfect ;)