Best way to use a background image in a diagram


Author
Message
Marius Bucur
Marius Bucur
Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)
Group: Forum Members
Posts: 12, Visits: 1
I am trying to implement a diagram that will help my customers to set up various furniture in a building. To easy the work I am trying to use the floor plans as a background, so the user can easily place the shapes of furniture in the rooms. What i am doing now is to upload the image in the background of the document and set up layers for various shapes. But at some point i need to hide the document background so the user can see only the shapes he created.
Right now I don't know how to hide the background. I have tried with document.BackgroundStyle.FillStyle.Dispose() but it doesn't seem to do the trick, also document.BackgroundStyle.FillStyle.SetTransparencyPercent(100.0F) but this clears also the document background color.

What i really like to do is to assign the background image to a default layer and display that only when i need. It seems that this is not possible though since the background is scaling to the the area that have controls draw on it.

Any idea how to better implement this thing?
Reply
Marius Bucur
Marius Bucur
Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)
Group: Forum Members
Posts: 12, Visits: 1
It doesn't help at all.
Let me be more clear: I use layers and I draw shapes in layers accordingly to my needs.
The problem is that i don't know how to add a background to a layer and this background cover all the document size.

Right now i use the following piece of code to add background to a layer:

private NLayer CreateNewLayer(NDrawingDocument document)
{
this.currentLayerNumber = this.currentLayerNumber + 1;
NLayer newLayer = new NLayer();
newLayer.Name = "Layer " + this.currentLayerNumber.ToString();
newLayer.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(0xaa, 0x00, 0x00));
newLayer.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0xff, 0x99, 0x77));
newLayer.Style.ShadowStyle = new NShadowStyle(ShadowType.None, Color.Black, new NPointL(3, 3));

NImageFillStyle imageFrameStyle = new NImageFillStyle("floorplan.jpg");
imageFrameStyle.TextureMappingStyle.MapMode = MapMode.RelativeToViewer;
newLayer.Style.FillStyle = imageFrameStyle;
//this.hasBackground = true;

// add it to the document and make it the active one
document.Layers.AddChild(newLayer);
document.ActiveLayerUniqueId = newLayer.UniqueId;

// add a rectangle
NRectangleShape shape = new NRectangleShape(currentLayerNumber * 11, 1, 10, 10);
shape.Style.TextStyle = new NTextStyle(new Font("Ariel", 100), Color.FromArgb(150, 150, 150));
shape.Text = currentLayerNumber.ToString();
document.ActiveLayer.AddChild(shape);

document.RefreshAllViews();

return newLayer;
}

But the result is that the background image is only shown in the shape area like in the image bellow:

http://ygo.ro/images/wrong.jpg
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search