I'm facing a problem with displaying a Winform I've created in the unity editor, for some reason the form is not displaying as it should in the unity editor...
most controls in the form have the "autosize" property set to true
and the "autoSizeMode" property set to "GrowAndShrink". and whenever
I display the form in the unity editor, these controls just vanish..
their size is set to (0,0) regardless of the inner controls they
hold. (setting manually the "minimumSize" property of these controls does makes them visible again.)
the "sutoScroll" property is not displaying the sliders.
the "dock" property is not acting as it should.
some of the majors I've taken:
I've added the right dlls (such as the "system.windows.forms.dll) to the unity project.
I've merged the ".cs" and ".designer.cs" of each form into a single file, so I won't face this problem "Form and designer files not linking in Solution Explorer", and I copied them to the unity project.
I've tried making a "class library" project and copy the forms into it.
placing the build/debug dll in the unity project and displaying the form. (still the same result though)
I've copied the ".exe" of the winform project to unity, and
calling/displaying the exe does show the form correctly, but I want
to be able to share collection references between the exe and unity
editor... and from what I've read online don't think it's passable ..
any suggestions on how to resolve the issue? or no how to display a Winform in unity editor without it getting all messed up, and share argument references between the both?
this is an image of the winform running in visual studio:
this is an image of the form displayed through unity:
this is a link to the Winform project
Related
I am following a video tutorial for a .NET application.
This is my first .NET application so I am very new to this.
I downloaded the tutorial project given in the video.
In the video, the tutor is able to view the form.designer.cs file visually and 'see' the actual UI and rearrange the buttons, drag and drop new objects etc.
For me it just shows the code view when I click on the form.designer.cs file. How can I shift to the drag-drop UI view?
I have a MAC OSx. Furthermore, in terms of file structure, I have a Form1.cs file and when I click on that in VS Studio, I get a down arrow with Form1.resx and Form1.Designer.cs file inside it.
Push Shift+F7, which is the shortcut to open the designer. You should also be able to access it using the Solution Explorer on the right-hand side of your VS environment.
I have a form in a C# VS 2019 project which contains a Windows Media Player object. When I try and view it in design view I get the error
'Could not find type 'AxWMPLib.AxWindowsMediaPlayer'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.'
Windows Media Player was not present in the Toolbox when viewing another form without a Media Player Object, so I added it from the COM tab. It then appeared in the Toolbox but without an icon. If I drag it onto the new form I get the error AXHost not found.
If I look in VS Object Browser I can see AxWMPLib.AxWindowsMediaPlayer and its properties OK.
The project containing the form builds for platform AnyCPU (64 bit not available as an option) and runs OK.
How can I see the form containing the Windows Media Player object in Design view?
Turns out that the Build options (Any CPU, Mixed Platforms,x86 and Configuration Manager) shown at the top of the screen to the right of the Debug etc Dropdown are not the same as those shown in the Project-> Properties->Build->Platform Target. The option shown was x64, even though Any CPU was shown at the top of the screen. Changing this to Any CPU allowed the Designer for the form to be viewed
I had made a user control which was in the toolbox and i'd dragged onto the form.
I wanted to delete it and draw it back on again(as i'd updated the background image of one of the buttons on it and it hadn't updated yet).
So I deleted that user control.. And for some reason I think at that point I did a clean and rebuild.. perhaps thinking it'd make sure it'd refresh. But then things went wrong. It didn't rebuild (understandably).. since there is code that references that user control. And also, the control isn't showing in the toolbox. (Normally to get it to show in the toolbox i'd rebuild and worst case i'd restart visual studio).. But visual studio won't close the project..
It gives this error hpro is the name of my program/project.
I have looked at other questions on SO with that error but they seem to be very specific to a particular dll.. and never to their program itself. Like in their cases it's maybe some third party program where they're missing a dll. But that's not the case with the error in my situation. As hpro is my project and the current project - the project with the issue.
I don't see why it'd need to load my program as an assembly. It should be building it. Though it can't build it because the user control I need to draw on the form isn't in the toolbox. And I can't get it in the toolbox if I can't rebuild it.
I want to insert a textbox into a window form so I chose FastColoredTextbox(this). It's a user-control which can be used to make a textblock component that's very similar to the one in a text editor.
I've been trying to get it to work and have done everything I could with my limited knowledge (started winforms a few days ago)
After installing the NuGet package, I tried getting it to work but I am not even able to start. I need help getting started.
I checked if it had the relevant assembly reference and it did.
I expected a component like a button/label to appear in my toolbox which I could drag into my designer but it didn't, so I tried rebuilding and changed settings to see if it appeared in the toolbox as given here. I didn't see anything in the toolbox that I could drag and drop.
I downloaded a sample project and went through the code. The designer.cs file had the variable and code for the textbox. I modified and pasted it into my designer.cs file thinking that it would appear in my designer. Visual Studio gave me a warning that the changes I make in the designer appear here and I shouldn't directly edit it.
There's no documentation to display the textbox. There's documentation for syntax highlighting, code folding etc.
I tried googling "how to use custom user-components" and I got links detialing the process of making a custom component.
If you need anymore details please let me know.
Help is greatly appreciated :)
Since you are using a nuget package (Install-Package FCTB), the control is in this dll:
Solution Directory → packages → FCTB.2.16.11.0 → lib → FastColoredTextBox.dll
You can add the control to Toolbox and drop in on the form and simply assign some text to Text property of control.
To add the control to toolbox, just right click on a group in Toolbox and click Choose Items ..., then from .NET Framework Components tab use Browse... button to choose FastColoredTextBox.dll from this path:
Solution Directory → packages → FCTB.2.16.11.0 → lib → FastColoredTextBox.dll
After choosing the dll, press OK to add FastColoredTextBox control to the toolbox. Then simply drop an instance on form and in code, assign a text to it's Text property:
this.fastColoredTextBox1.Text = "Some Text";
"
If you want to play along, you can create a Visual Studio project named NaiveTextMovement
and add the 14-point Segoe UI Mono font to the Content directory. The fields in the Game1
class are defined like so: "
how to add 14-point Segoe UI Mono font to the Content directory?
iv tried creating a folder in the solution and placing the font in it then i try to load it using Content.Load ... but it doesnt work. how is that?
You need to create a content project, then create a font description file. Reference the content project from your main XNA project.
In fact, a content project should already have been generated for you.
The font description file is an XML file. Editing it will be self-explanatory once you open it, as it will be auto-generated and well-commented.
When you create a new Windows Phone 7 game project, the template creates two different projects in your solution. One is the WindowsPhoneGame project and the other is the WindowsPhoneGameContent project.
The Game project is where you'll be adding all your code and the Content project is where you'll be adding all your game assets like sprites, textures and spritefonts.
You can see in the image below the two projects shown in the Solution Explorer (that's the pane in the upper right if you have the default configuration for Visual Studio).
The "Content" project is the one highlighted in the above image.
To add a SpriteFont, simple right click on the Content project and select "Add" and then "New Item" from the Add menu. This will open up the below dialog.
From the "Add New Item" dialog, simply select SpriteFont and give it the name you want. That will add a new SpriteFont object to your Content project and to your game.