I don't know the GUI libraries for C++, so I'm going to talk about C# only. There, there are two common GUI libraries: the older Windows Forms (Winforms for short) and the newer Windows Presentation Foundation (WPF):
Winforms is primarily based on drag-and-drop graphical GUI editor. This editor is somewhat clumsy: for example, I wasn't able to figure out how to place a button at the bottom center of a window (exactly). So, using Winforms might be okay if you're creating non-resizable windows and if you're okay either with the limited tools that are available or with manually deciding the pixel position of every control.
What this editor actually generates is a .Designer.cs file containing code like:
this.button1 = new System.Windows.Forms.Button();
this.button1.Location = new System.Drawing.Point(124, 258);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
And you can write code like this into your normal .cs files too, bypassing the graphical editor (though I would probably use object initializer syntax here). But since there will be no IDE preview, it will probably take some time to make it look the way you want. And it still doesn't fix the issues that Winforms have, like window resizing.
WPF, on the other hand, while still supporting drag-and-drop to a limited degree, is all about writing structured code in XAML. By “structured”, I mean that controls are placed into groups called panels, which can themselves be in other panels, creating a structure of the window. And each panel decides the placement of controls in it, so by combining panels, you can achieve pretty much any layout, which is now resizable.
For example, to place two buttons at the bottom center of a window, you could write:
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Margin="5" Width="100">OK</Button>
<Button Margin="5" Width="100">Cancel</Button>
(The repetition of
Width can be avoided, but it requires more advanced features of WPF.)
And while you're editing the XAML code, the IDE shows you the layout you're creating, so you get one of the main advantages of graphical editors too.
You can also write the same code in C# instead of XAML, but there's only rarely a reason to do that.