avenuespot.blogg.se

Border red rectangle outline
Border red rectangle outline










border red rectangle outline

The converter is not the source of the problem, I've tried binding directly to a property on the underlying object and the box still appears.The border disappears when I attempt to examine the control tree with Snoop.Other dropdown controls on the same page are not doing this.This is an XBAP application running in IE8.It will not go away once it appears, and it shows up over anything that I place on top of the control. The text "red" is not even mentioned anywhere in the project. Where on earth did the red border come from? I am building the form from scratch, there is no styling or anything on it right now. This is what my dropdown looks like after selecting an item from the list: Seems like pretty simple stuff, all stuff I've done in WPF before. When I select an item in the ComboBox, an event handler rebuilds a collection which is the data source for a listbox. Note that I used renderer as my reference for size, but obviously you can use any rectangle, as long as x,y is the top left corner.įrom what I can tell this works really well, looks great in game because I can easily move my bordered object around in all 3 axis (Even rotate it, and since line renderers always face the camera it doesn't look weird), and is not hard to implement.I have a WPF app - an XBAP - with a ComboBox on the main page.

border red rectangle outline

#Border red rectangle outline update

In my case I needed to constantly resize the border to keep it around my object (A text mesh for a custom text field) so every update I did this:įloat width = Mathf.Max( + paddingX * 2, minWidth) įloat x = - width / 2 įloat height = + paddingY * 2 įloat y = - height / 2 ĪlterBorder(0, new Vector3(x - thickness / 2, y, 0), new Vector3(x + width + thickness / 2, y, 0)) //Bottom edge going left to rightĪlterBorder(1, new Vector3(x + width, y + thickness / 2, 0), new Vector3(x + width, y + height - thickness / 2, 0)) //Right edge going bottom to topĪlterBorder(2, new Vector3(x + width + thickness / 2, y + height, 0), new Vector3(x - thickness / 2, y + height, 0)) //Top edge going right to leftĪlterBorder(3, new Vector3(x, y + height - thickness / 2, 0), new Vector3(x, y + thickness / 2, 0)) //Left edge going top to bottomĪlterBorder() simply accesses the appropriate line renderer (specified by first parameter) and set its start and end to the first and second vector respectively. I am currently facing the same problem, and my solution is exactly what DuckMaestro and Raven Dreamer suggested - Have a script that creates 4 child objects at runtime each of which representing a side of the border and attach line renderers to each one. Though I believe you're asking for 2-d only, note that this same idea can be applied to 3d boxes if needed, where the BoxBuilder now must create and manage 12 child edges, but again only scaling each edge in one local dimension. It will be a lot of pos.x=w/2, pos.y=h/2. With a width and height defined BoxBuilder level, you can calculate the necessary positioning and non-uniform scale of the four child edges. Each child game object is one of your box edges, and can simply be a 3d cube that is stretched in only one dimension. With that in mind, you can devise a Component, say BoxBuilder, which when attached to a GameObject, creates and manages four child GameObjects. This is much like if you were to construct a box in real-life, where you are piecing together variable lengths of wood that all have the same cross-section size. Think of your 2d box as nothing more than four lines, where each line is stretched in only one dimension (the other two dimensions are the cross-section of the edge). GUI.Box(new Rect(boxPosHiLeftCamera.x, Screen.Height - boxPosHiLeftCamera.y, width, height),"", highlightBox) Vector3 boxPosLowRightCamera = (boxPosLowRightWorld) įloat width = boxPosHiLeftCamera.x - boxPosLowRightCamera.x įloat height = boxPosHiLeftCamera.y - boxPosLowRightCamera.y Vector3 boxPosHiLeftCamera = (boxPosHiLeftWorld) Vector3 boxPosLowRightWorld = new Vector3(1.5f, 0, 0) Vector3 boxPosHiLeftWorld = new Vector3(0.5f, 12, 0) 3D), just remember that in Unity's world coordinates y goes from bottom to top, and in GUI y goes from top to bottom. You can use Camera.WorldToScreenPoint method if you want to outline something in world coordinates (i.e. Create a new GUIStyle using a simple rectangle as a texture (the inside of the rectangle should be transparent, of course), set up its Border value so that it is not stretched, and call GUI.Box(new Rect(.),"",myGuiStyle). If you only need a 2D rectangle, GUI is the way to go.












Border red rectangle outline