Author Topic: A stupid question about C# and Visual Studio  (Read 2121 times)

0 Members and 1 Guest are viewing this topic.

Offline 97hilfelTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: it
A stupid question about C# and Visual Studio
« on: May 16, 2016, 01:05:28 pm »
Hello everybody,
I don't know if this is the right place, but I am currently building my own 3D-Printer and I wante do write my own softwaren.
So I started coding and came to the point where I came to a question:
Everytime I start my Windows Forms application its different from they style i should be.
its like it doesn't leave the space beteween the comboboxes, the 100 by 100px buttons arent exactly 100 by 100px (I have circular immages on them so I can see it).
Does somebody know why?
Felix
 

Offline CM800

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: A stupid question about C# and Visual Studio
« Reply #1 on: May 16, 2016, 01:35:17 pm »
Hello everybody,
I don't know if this is the right place, but I am currently building my own 3D-Printer and I wante do write my own softwaren.
So I started coding and came to the point where I came to a question:
Everytime I start my Windows Forms application its different from they style i should be.
its like it doesn't leave the space beteween the comboboxes, the 100 by 100px buttons arent exactly 100 by 100px (I have circular immages on them so I can see it).
Does somebody know why?
Felix

Would it be possible to show us some pictures and code?
 

Offline 97hilfelTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: it
Re: A stupid question about C# and Visual Studio
« Reply #2 on: May 16, 2016, 02:09:57 pm »
I use PNGs as Icons in the buttons.
But I had that problem also without Images
 

Offline elecman14

  • Supporter
  • ****
  • Posts: 169
  • Country: us
Re: A stupid question about C# and Visual Studio
« Reply #3 on: May 16, 2016, 02:18:51 pm »
You may want to look into placing your controls in a table layout panel control. If you dock the panel in the form (or another panel) and properly anchor the controls they will expand and contract if the user re-sizes the gui.

If you are against using a table layout panel you should check your autoSize, and your growAndShrink properties on your buttons.

Your text width may be causing your buttons to expand in width. You could test this by creating a grid of buttons with a single char in the visible text.

If you really get stuck you can use the control.location and control.width to determine the actual location of the controls and see if you are getting any painting position weirdness.

Good Luck.
 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: gb
Re: A stupid question about C# and Visual Studio
« Reply #4 on: May 16, 2016, 08:05:38 pm »
The web has many examples of adding custom images/glyphs to controls on winforms.  I would use wpf instead as xaml is handy in the future (that is if you're just starting out, even though its been depreciated).  It also makes it easier, and makes more sense, when adding and manipulating custom controls at runtime.
 

Offline 97hilfelTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: it
Re: A stupid question about C# and Visual Studio
« Reply #5 on: May 17, 2016, 04:32:34 am »
I don't manipulate controld during runtime, exept from the enabling a disenabling of buttons and switching from a tab control tab to another.
But Im going to try it.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf