블로그 이미지
Magic_kit
study 관련자료를 한곳으로 자기 개발 목적으로 재태크 재무 관리 목적으로 일상생활의 팁을 공유 하기 위하여 블로그를 개설 하였습니다.

calendar

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
반응형

Category

Recent Post

Recent Comment

Archive

2009. 11. 27. 16:01 .Net Project/SilverLight 3.0
반응형
 Repeat Button
- 마우스를 누른 후 마우스를 떼기 전까지 Click 이벤트가 반복하여 발생하는 컨트롤
 Repeat Button 사용 방법

<UserControl x:Class="RiaContent.FrmRepeatButton"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

   

    <Grid x:Name="LayoutRoot" Background="White">

        <Border Background="Green" CornerRadius="15,15,15,15">

            <Border.Child>

                <Canvas>

                    <RepeatButton x:Name="btnMinusSec" Width="30" Height="30"

                                  Canvas.Left="5" Canvas.Top="10" Content="-"

                                  Click="btnMinusSec_Click"></RepeatButton>

                    <TextBlock x:Name="txtBlkSec" Width="30" Height="30"

                               Canvas.Left="40" Canvas.Top="15" Text="3E"
                               TextAlignment
="Center"></TextBlock>

                    <RepeatButton x:Name="btnPlusSec" Width="30" Height="30"

                                  Canvas.Left="70" Canvas.Top="10" Content="+"
                                  Click
="btnPlusSec_Click"></RepeatButton>

                </Canvas>               

            </Border.Child>           

        </Border>

    </Grid>

</UserControl> 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace RiaContent

{

    public partial class FrmRepeatButton : UserControl

    {

        public FrmRepeatButton()

        {

            InitializeComponent();

        }

        private Int32 playTime = 3;

        private void btnMinusSec_Click(object sender, RoutedEventArgs e)

        {

            playTime = Math.Max(1, --playTime);

 

            txtBlkSec.Text = String.Format("{0}sec", playTime);

        }

 

        private void btnPlusSec_Click(object sender, RoutedEventArgs e)

        {

            playTime = Math.Min(60, ++playTime);

 

            txtBlkSec.Text = string.Format("{0}sec", playTime);

        }

    }

} 





반응형
posted by Magic_kit
2009. 11. 27. 15:46 .Net Project/SilverLight 3.0
반응형
  Button
- Hover : 마우스 커서가 Button 컨트롤 위에 올라왔을 때 Click 이벤트 발생
- Press : 마우스 Button 컨트롤 눌렀을 때 Click 이벤트 발생
- Release : 마우스 Button 컨트롤을 눌렀다ㅣ가 뎄을 때 Click 이벤트 발생
 Button 사용 방법

<UserControl x:Class="RiaContent.RiaButton"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

    <StackPanel Orientation="Vertical">

        <Button x:Name="btnHover" ClickMode="Hover"
                  Content="ClickMode=Hover" Click="btnHover_Click"></Button>

        <Button x:Name="btnPress" ClickMode="Press"
                  Content
="ClickMode=Press" Click="btnPress_Click"></Button>

        <Button x:Name="btnRelease" ClickMode="Release"
                  Content
="ClickMode=Release" Click="btnRelease_Click"></Button>

    </StackPanel>   

</UserControl> 

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace RiaContent

{

    public partial class RiaButton : UserControl

    {

        public RiaButton()

        {

            InitializeComponent();

        }

 

        private void btnHover_Click(object sender, RoutedEventArgs e)

        {

            MessageBox.Show("Mouse Hover");

        }

 

        private void btnPress_Click(object sender, RoutedEventArgs e)

        {

            MessageBox.Show("Mouse Press");

        }

 

        private void btnRelease_Click(object sender, RoutedEventArgs e)

        {

            MessageBox.Show("Mouse Release");

        }

    }

} 





반응형
posted by Magic_kit
2009. 11. 27. 15:38 .Net Project/SilverLight 3.0
반응형
 ContentControl
- 문자열, UIElement와 같은 단일 콘텐츠를 화면에 표시하는 컨트롤
  ContentControl의 사용 방법

<UserControl x:Class="RiaContent.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="White">

        <ContentControl Content="SilverLight"></ContentControl>

    </Grid>

</UserControl> 


  ContentControl 두번째 사용 방법


<
UserControl x:Class="RiaContent.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="White">

        <ContentControl>

            <ContentControl.Content>

                <Canvas>

                    <Canvas.Children>

                        <Rectangle Canvas.Left="0"

                                   Canvas.Top="0"

                                   Width="200" Height="100"

                                   Fill="silver"

                                   RadiusX="15" RadiusY="15">                            

                        </Rectangle>

                        <TextBlock Text="SilverLight"
                                 
 FontSize="28" FontFamily="Arial"></TextBlock> 

                    </Canvas.Children>

                </Canvas>

            </ContentControl.Content>            

        </ContentControl>

    </Grid>

</UserControl>




반응형
posted by Magic_kit
2009. 11. 27. 15:29 .Net Project/SilverLight 3.0
반응형
 TextBlock
- 문자열 컨텐츠를 호면에 표시하기 위해 사용하는 컨트롤 입니다
- 서식이 있는 읽기 전용 텍스트를 표시할 수 있는 컨트롤 입니다. (Text 프로퍼티, InIines 프로퍼티) 

 TextBlock.Xmal

<UserControl x:Class="RiaTextBlock.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="White">

        <TextBlock Foreground="Blue"
                   FontFamily="Arial"
                 
 FontSize="50"
                   FontWeight
="Bold"
                 
 FontStyle="Italic">

            Wow! Silverlight !!!

        </TextBlock>

    </Grid>

</UserControl> 

 TextBlock 추가 사용 방법


UserControl x:Class="TextBlock.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <StackPanel>

        <TextBlock x:Name="lblTitle" Text="Hello" FontSize="20"></TextBlock>

        <TextBlock x:Name="lblContent">

            <Run FontSize="30">Hi</Run>           

        </TextBlock>

        <TextBlock>

        <Run FontSize="40" FontStyle="Italic"
             Foreground
="Blue">Hello</Run>

        <LineBreak></LineBreak>

        <Run FontSize="40" FontStyle="Italic"
             Foreground
="Blue">Hello</Run></TextBlock>

       

        <TextBlock><Run FontSize="70" TextDecorations="Underline"

                        FontFamily="Courier New" >Bye~</Run></TextBlock>       

    </StackPanel>  

</UserControl> 


 TextBox
-  사용자로부터 문자열을 입력 받을 수 있는 컨트롤
- TextBox에 지정한 글꼴이나 글꼴 스타일이 모든 문자열 적용
 TextBox.Xmls

<UserControl x:Class="RiaTextBlock.RiaTextBox"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

   

    <Grid x:Name="LayoutRoot" Background="White">

        <TextBox Width="180" Height="100"

                 Foreground="Blue" FontFamily="Arial"

                 FontSize="20" FontWeight="Bold" FontStyle="Italic"

                 Text="WowSilverLight!!"></TextBox>

    </Grid>

</UserControl> 


 Passwordbox
-  TextBox 컨트롤로 부터 상속받어 구현된 컨트롤로, 암호화 같은 데이터를 표시
-  사용자로부터 입력받을 때 사용합니다. Password 컨트롤은 두 줄이상의 문자열을 입력을 허용하지
   않으며, 입력된 문자열은 PasswordChar 프로퍼티에 설정한 문자로 대체 되어 표시 가능
- 3개의 PasswordBox 컨트롤 추가하고 PassWordChar 각각 설정 하는 방법 

<UserControl x:Class="RiaTextBlock.PasswordBox"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

   

    <Grid x:Name="LayoutRoot" Background="White">

        <PasswordBox HorizontalAlignment="Left" VerticalAlignment="Top"

                     Width="200" Height="35" Password="Wow SilverLight"

                     PasswordChar="*">           

        </PasswordBox>

        <PasswordBox HorizontalAlignment="Left" VerticalAlignment="Top"

                     Width="200" Height="35" Password="Wow SilverLight"

                     PasswordChar="@">

        </PasswordBox>

        <PasswordBox HorizontalAlignment="Left" VerticalAlignment="Top"

                     Width="200" Height="35" Password="Wow SilverLight"

                     PasswordChar="A">

        </PasswordBox>

    </Grid>

</UserControl> 

  Password 컨트롤 추가 예제)

<UserControl x:Class="Password.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <StackPanel x:Name="myStackPanel">

        <PasswordBox x:Name="txtPassword"></PasswordBox>

        <PasswordBox x:Name="txtPassword1"></PasswordBox>

    </StackPanel>

</UserControl> 


 Password 컨트롤 .Cs 속성 지정)


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace Password

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);

           

        }

 

        void MainPage_Loaded(object sender, RoutedEventArgs e)

        {

            PasswordBox pwd = new PasswordBox();

 

            pwd.Foreground = new SolidColorBrush(Colors.Red);

            pwd.FontSize = 30;

            pwd.Password = "1234";

            pwd.FontFamily = new FontFamily("malgun gothic");

            pwd.PasswordChar = '?';

            pwd.BorderBrush = new SolidColorBrush(Colors.Green);

            pwd.BorderThickness = new Thickness(5);

 

            //Control/Layout Add

            this.myStackPanel.Children.Add(pwd);

 

            //pwd1

            PasswordBox pwd1 = new PasswordBox();

 

            pwd1.Foreground = new SolidColorBrush(Colors.Blue);

            pwd1.FontSize = 30;

            pwd1.Password = "1234";

            pwd1.FontFamily = new FontFamily("malgun gothic");

 

            //Control/Layout Add

            this.myStackPanel.Children.Add(pwd1);

        }

 

    }

}








반응형
posted by Magic_kit