Windows Phone 7 set Image Margin using code - windows-phone-7

I have one image on top of another.In code I am trying to set it's position using int's.I have two random int's representing the top and left.How can I set it's position over the other image do I use the Margin? If so how?

Complete use style:
image1.Margin = new Thickness(10,50,300,20); //(left, top, right, bottom)

The way to do it was image.Margin = new Thickness();

Related

vb6: place image control on frame dynamically

I'm working on a new UI-element in an vb6 programm. I need to place pictures dynamically on 2 diffenent colored background lines:
I tried out two different ideas but none of them is working:
Idea 1
I used image control and assigned an image to the control. Then I set left, top, with and hight properties to values where I want to place the image. Image was places at correct position but not in foregound on a frame but in background (behind coloured frame).
Can anyone tell me how I can place an image control in foreground (on green coloured frame)? I need to place these image controlls dynamically from code in running program.
Idea 2
In second sulution I tried to use picturebox instead of image control. Picturebox can be placed on colored background (frame) without any problems.
Here the problem is that loaded picture has to be scaled to size of picturebox picture property. Picture is loaded to picturebox by following code: Picture.Picture = LoadPicture("F:\img.JPG")
Does anyone know how I can scale this img to size of picturebox?
Can anyone help me to follow up one of the solutions. In principle I would prefere to use Image controls if it is polible to place them in foreground on frame.
I'm going to guess that after creating the image control, you are moving it onto the Frame. If so, this is why the control is behind the Frame. You really want the image to be inside the frame. The key to do this is to set the Container property.
Dim img As Image
Set img = Me.Controls.Add("VB.Image", "Image1")
If Not img Is Nothing Then
img.Move 200, 200, 400, 400
img.Stretch = True
img.Picture = LoadPicture("your image.jpg")
Set img.Container = Frame1
img.Visible = True
End If

Qml Item grabToImage save image error

I'm using the
Item.grabToImage()
But I'm getting the following error.
QML ItemX: grabToImage: item has invalid dimensions
This is because I'm using height and width properties like so:
width: {
// return with * 0.4; based for some condition
// for eg
return parent.width * 0.4;
}
// and something similar with height
The only time that I can get the following code working is when I put in a static heigth and width:
grabToImage(
function(result)
{
result.saveToFile("/path/project-name/tmp/something.png");
}
);
Any ideas of why and how do I get around this problem?
Thank you
I'm not a 100% sure why, But it was something about the dynamic width of the parent.
In the program I wrote I has set the anchors of the image to the left and right of the preview container.
So when I tried to get the image capture from another item that was overlaying the image to cut out smaller parts of the image it was not letting me.
How I fixed this was to set a fixed image size of the source image and then just anchor it to the center of the preview section.
The only thing is now it will not size up if you scale the window.
I'm sure I could implement and on size change to the main program window and then set the width of the image (Not tested).
Last thing I should mention is that if the image is small then the cut out images from sections of the source image will be blurry and not good quality.
I fixed this by setting the "sourceSize.width" to a very large image and then used the "scale" property to scale down the image to fit within the preview item.

Migradoc - How do I align a Shapes.Image object?

Dim _image as Shapes.Image = section.Header.Primary.AddImage(filepath)
Using the example above, I want to align the image to the left, center, or right.
I'm placing this under the headers.
Is it also possible to have two logos under headers to be aligned to the right and left.
You can always try to create a table with those images and then place it all in the Header.

same size circles in pack layout in d3.v4.js

I am following the link mentioned below to create d3 pack layout. what I want to change is to get fixed sized circles in every pack layout. https://bl.ocks.org/mbostock/7607535
I found the solution in the following link, but this code is for d3.v3.js S per my knowledge
Possible to use a circle pack layout in d3.js with fixed circle sizes?
can someone help me how can I achieve same size instead of its actual "d.value". Thanks in advance.
Just set the size you want using pack.radius:
If radius is specified, sets the pack layout’s radius accessor to the specified function and returns this pack layout.
So, it can be simply:
pack.radius(() => someNumber)
//your value here-----^
Here is that Bostock's code you linked with every circle having a radius of 10px: https://bl.ocks.org/anonymous/42d0e66ee507ee769907f0519d25bc8a

Center of an Image - Windows Phone

I have a bing map and a pin that is to be pinned on the map. This pin is an image different from the default one. I want this image to be pinned on the map, and It does work until here. But it pins at the left-top of the image. I want it to be pinned thru the center of image. (As if you pin a paper on a pinboard not at the left-top of the paper, just thru the center of paper.)
So how can I set this? VerticalAlignment works for this or not?
Here is my pin image definitions;
Image pinimage = new Image();
pinimage.Source = new BitmapImage(new Uri("/Images/killtarget.png", UriKind.Relative));
pinimage.Width = 64;
pinimage.Height = 64;
I use Nokia Map API for Windows Phone 8 and was facing the same issue. I don't know if the same solution will apply to Bing Maps as well but try setting PositionOrigin property of the Pin...it has to be set the following way:-
PositionOrigin="0.5,1"
the two numbers represent alignment horizontally and vertically so 0.5,1 means Horizontally center and Vertically bottom.
Just a bit of clarity. Windows Phone 8 uses a Microsoft created map control that pulls in Nokia map data. This is exactly what Bing Maps does. There was a bit of a miss communication when they announced the new API.
As for centering the image you can try the position origin, or you can use margins with negative x and y values.

Resources