Dynamic grid-ish Flow-Layout using LayoutGroupControl and GroupControl - c#

I am about to write a main menu for a Windows Forms application.
Rather than trying to explain my goal with a wall of text i made a quick(ugly) paint sketch:
As you can see here i want the Group Controls to automatically scale with their content(similar to the wrap_content attribute in android) and fit underneath each other if possible.
If anyone knows how to achieve this or even has a sample where he already did achieve it, that would help me massively!
thanks, Felix.

Related

how to mirror the richtextbox control in two screens [Edited]

i'm trying to mirror my Richtextbox to another screen in Pictuerbox. actually i did that but my issue is (Lets to make my question clear say that we have 2 screens (Screen A and Screen B).
I want to show the Richtextbox in Screen B. As when i open a start menu in screen A it mustn't be shown in screen B. All i want in my program is to mirror the richtextbox as a control not the whole screen.
is that possible?
I dont know if it works and i dont have time to try it but i think you need to create 2 controls. By the 1st one you check the .textChanged() and when it is triggered you update the second textbox.
Example (pseudo code):
TextboxA;
TextboxB;
If TextboxA.TextChanged()
{
TextboxB.Text() = TextboxA.Text();
}
Maybe there is an better way, but this is the way i should try when i make it for my self. Hope it helps you.
What you describe sound like two over network connected applications. I would suggest to look for a chat network app. There are lots of examples in the net. On one side you will have a server and on the other side a client. Then you transfer your text char by char or word by word over the network.

How would you create stackable rectangles in Xamarin C# for iOS?

I have a UIView that I want to fill with multiple rectangles stacked on top of each other horizontally at 100% width. They all need to have their own name and need to work for any iOS device regardless of size.
Here's a simple diagram showing what I would like to accomplish:
With Xamarin.Forms, this is achieved by using a StackLayout.
http://iosapi.xamarin.com/?link=T%3aXamarin.Forms.StackLayout
I find it difficult to control the exact sizes of StackLayouts if you're not sure of the size of your content.
If i need something to stay fixed size, i use Grids:
http://iosapi.xamarin.com/?link=T%3aXamarin.Forms.Grid
I would recommend XibFree for this:
http://www.toptensoftware.com/xibfree/
They have a few great examples which covers these case as well:
http://www.toptensoftware.com/xibfree/example_2
http://www.toptensoftware.com/xibfree/example_1
If you would need any more help with XibFree feel free to ask anything in comment :)

how can I lock shapes in PowerPoint?

I'm working on a Add-in for PowerPoint 2010 (C#) and I want to prevent the end-user to move or edit all the shapes that I have programmatically created.
I have already sought in the framework but I think it's not allowed programmaticaly. Has anyone already encountered this kind of limitations and could help me to find a solution?
I know that some people create their add-in thanks to C++ because there are a lot of limitations in office.
I have found two solutions :
The first is to catch all events from the "commandBars.OnUpdate" like this great sample code : http://code.msdn.microsoft.com/CSExcelNewEventForShapes-0e26b1f2#content
Then you can impose the position/the color or everything you want to your shape.
The second one is more "brutal" > unselect immediately the shape. When you catch all the events from the "CommandBars.OnUpdate" do this :
To see which shape is selected :
var selectedShape = this.Application.ActiveWindow.Selection.ShapeRange[1]
In all my shapes, I have set a tag with an ID. I have just to check that there are an ID in the tags of the selectedShape and if this is the case :
this.Application.ActiveWindow.Selection.Unselect();
Then I show a messageBox to warn the user to do not select this kind of shape.
I don't like this solution but it's the only one that I have found and it works.
I believe this is not possible. A way of achieving this to a certain extent (people can work around it if they figure out how to select the shapes below) is by making a transparent rectangle the size of the canvas and binding a custom event to that (like you described in your comment). The transparent rectangle is overlaying the shapes you created so people can no longer access the shapes that way. Of course if they are capable of figuring out how to select the shapes they can move them anyway...
Alternatively, to make people not do stuff like that (you only stop the inexperienced) you can also set them up as master slides.
Only 'real' solution for people not doing that? Images .. but then they can move the image too!

Design a TagVisualization for a control dial

I'd like to design a UI-Element, which gives the User the possibility to switch between different options. Therefore I want to use a Tangible which acts as control dial... I have already designed a Pointer and a Menu. The problem:
When the User rotates the Tangible, the Menu should stand still and the pointer should follow the rotation-movement. But when the User just moves the Tangible (without a rotation), the whole UI-Element should move.
Here a example for a non-Tangible control dial:
http://msdn.microsoft.com/en-us/library/ee804832%28v=surface.10%29.aspx
Does anyone know how to deal this with a TagVisualization?
Thanks in advance,
Chris
EDIT:
I've written a small tutorial, which can be viewed on: http://project-premium.org/
Set UsesTagOrientation=false on the TagVisualization or TagVisualizationDefinition
Inside the TagVisualization, monitor TrackedContact.Orientation to update your dial UI

Projector Control/Display C#

I've had a bit of a search around, but couldn't find anything similar to what I was looking for. I'm interested in knowing how to display differing contents on secondary/tertiary monitors or projectors using C#. Basically, what I'm wanting to achieve is to have some form of presenter view (a lá Powerpoint) on one particular screen (the primary display), and the output on a secondary screen or projector. I've never really attempted to develop something with multiple display outputs, so any guidance will probably have to be at a fairly obvious level.
If someone could point me in the right direction as to how to handle this sort of thing in C#, that would be greatly appreciated!
Just to expand on Keven's answer (I +1'd it), The Screen.AllScreens array gives you have an array of Screen objects. The Screen object has a property called IsPrimary, which you can use to determine which is the primary screen, and which is the secondary (duh) and it also has a property called WorkingArea, which is a rectangle that gives you back all the coordinates of the second screen. The cool thing about this is, that even if let's say the secondary screen is configured to be on the left of the primary, the WorkingArea.X will be a negative number, and you can place forms there or whatever.
You can use the System.Windows.Forms.Screen.AllScreens property to access a list of all the monitors Windows knows about. If you're looking to utilize a display that hasn't been configured by the user, it gets more difficult - you'd probably need to initialize and access the display adapter using DirectX.
One of the main classes you will need to interact with is Screen (this is in the WinForms namespace). In general all the screens are treated as a set of working areas that you can use the screen class to get properties for each one.
You can get all the screens like this...
Screen [] screens = Screen.AllScreens;
Here is a short article about doing multi-monitor programming in C#.
Also remember to set the property 'StartPosition' to 'Manual' on your the window you want to display on the secondary screen otherwise it will always display on the primary screen.

Categories

Resources