Upload
mihai-saratean
View
220
Download
0
Embed Size (px)
Citation preview
8/10/2019 Curs2 - Lecture Notes
1/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
2/51
This is the content string
Button2.Content = "This is the content string"
button2.Content = "This is the content string";
This is a Humpback Whale
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
3/51
This is a Label
Press Alt+_A
_Name
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
4/51
_Click Me!
Button 1
8/10/2019 Curs2 - Lecture Notes
5/51
HorizontalAlignment="Left" Width="76">Button 2
Button 3
Button 4
Button 1
Button 2
Button 3Button 4
Here is some text
Here is some text
TextBlock1.Text = "Here is the changed text"
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
6/51
TextBlock1.Text = "Here is the changed text";
Here is some text
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
7/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
8/51
' Adds 1 to the Value
ProgressBar1.Value += 1
// Adds 1 to the Value
ProgressBar1.Value += 1;
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
9/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
10/51
This
Is
A
List
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
11/51
Option 1
Option 2
Option 3
Option 4
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
12/51
8/10/2019 Curs2 - Lecture Notes
13/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
14/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
15/51
8/10/2019 Curs2 - Lecture Notes
16/51
Back
Back
Forward
Stop
Go
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
17/51
Application is Loading
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
18/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
19/51
Button
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
20/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
21/51
Button
Button
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
22/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
23/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
24/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
25/51
Button
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
26/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
27/51
8/10/2019 Curs2 - Lecture Notes
28/51
Button
This one is on top
This one is on the bottom
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
29/51
Dim aButton As Button
aButton = CType(grid1.Children(3), Button)
Button aButton;
aButton = (Button)grid1.Children[3];
Dim aButton As New Button()
grid1.Children.Add(aButton)
Button aButton = new Button();
grid1.Children.Add(aButton);
grid1.Children.Remove(aButton)
grid1.Children.Remove(aButton);
grid1.Children.RemoveAt(3)
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
30/51
grid1.Children.RemoveAt(3);
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
31/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
32/51
Bold
Italic
richTextBox1.Selection.ApplyPropertyValue(FontWeightProperty, _
FontWeights.Bold)
richTextBox1.Selection.ApplyPropertyValue(FontWeightProperty,
FontWeights.Bold);
richTextBox1.Selection.ApplyPropertyValue(FontStyleProperty, _
FontStyles.Italic)
richTextBox1.Selection.ApplyPropertyValue(FontStyleProperty,
FontStyles.Italic);
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
33/51
Try
richTextBox1.Selection.ApplyPropertyValue(FontSizeProperty, _
Slider1.Value.ToString())
Catch
End Try
try
{
richTextBox1.Selection.ApplyPropertyValue(FontSizeProperty,
Slider1.Value.ToString());
}catch { }
Public Sub New()
InitializeComponent()
For Each F As FontFamily In Fonts.SystemFontFamilies
Dim l As ListBoxItem = New ListBoxItem()
l.Content = F.ToString()
l.FontFamily = F
listBox1.Items.Add(l)
Next
End Sub
foreach (FontFamily F in Fonts.SystemFontFamilies)
{
ListBoxItem l = new ListBoxItem();
l.Content = F.ToString();
l.FontFamily = F;
listBox1.Items.Add(l);
}
richTextBox1.Selection.ApplyPropertyValue(FontFamilyProperty, _
CType(listBox1.SelectedItem, ListBoxItem).FontFamily)
richTextBox1.Selection.ApplyPropertyValue(FontFamilyProperty,
((ListBoxItem)listBox1.SelectedItem).FontFamily);
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
34/51
8/10/2019 Curs2 - Lecture Notes
35/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
36/51
MenuItem
Button
MenuItem
8/10/2019 Curs2 - Lecture Notes
37/51
Margin="54,57,0,0" Name="button1" VerticalAlignment="Top"
Width="75">Button
MenuItem
Button
MenuItem
Button
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
38/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
39/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
40/51
pack:////
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
41/51
Dim myImage As Image
myImage.Source = New BitmapImage(New _
Uri("pack://application:,,,/myFolder/myPic.bmp"))
Image myImage;
myImage.Source = new BitmapImage(new
Uri("pack://application:,,,/myFolder/myPic.bmp"));
pack://application:,,,/;component//
Pack://application:,,,/myAssembly;component/myFolder/myPic.bmp
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
42/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
43/51
Dim myInfo As System.Windows.Resources.StreamResourceInfo
Dim myString As String
myInfo = Application.GetResourceStream( _New Uri("myTextFile.txt", UriKind.Relative))
Dim myReader As New System.IO.StreamReader(myInfo.Stream)
' myString is set to the text contained in myTextFile.txt
myString = myReader.ReadToEnd()
System.Windows.Resources.StreamResourceInfo myInfo;
string myString;
myInfo = Application.GetResourceStream(
new Uri("myTextFile.txt", UriKind.Relative));
System.IO.StreamReader myReader =
new System.IO.StreamReader(myInfo.Stream);
// myString is set to the text contained in myTextFile.txt
myString = myReader.ReadToEnd();
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
44/51
Dim aName As System.Reflection.AssemblyName
aName = System.Reflection.AssemblyName.GetAssemblyName("C:\myAssembly.dll"))
System.Reflection.AssemblyName aName;aName = System.Reflection.AssemblyName.GetAssemblyName("C:\\myAssembly.dll"));
Dim asm As System.Reflection.Assembly
asm = System.Reflection.Assembly.Load(aName)
System.Reflection.Assembly asm;
asm = System.Reflection.Assembly.Load(aName);
Dim res() As String = asm.GetManifestResourceNames
PictureBox1.Image = New _
System.Drawing.Bitmap(asm.GetManifestResourceStream(res(0)))
String res[] = asm.GetManifestResourceNames();
pictureBox1.Image = new
System.Drawing.Bitmap(asm.GetManifestResourceStream(res[0]));
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
45/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
46/51
{StaticResource myBrush}
{DynamicResource myBrush}
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
47/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
48/51
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
49/51
Dim aBrush As SolidColorBrush
aBrush = CType(Button1.FindResource("myBrush"), SolidColorBrush)
SolidColorBrush aBrush;
aBrush = (SolidColorBrush)Button1.FindResource("myBrush");
Dim aBrush As SolidColorBrush
aBrush = CType(Me.Resources("myBrush"), SolidColorBrush)
SolidColorBrush aBrush;
aBrush = (SolidColorBrush)this.Resources["myBrush"];
www.it-ebooks.info
8/10/2019 Curs2 - Lecture Notes
50/51
8/10/2019 Curs2 - Lecture Notes
51/51