WPF 글꼴 이나 내용 이 모호 한 해결 방법

본문 은 여러분 에 게 시 도 했 던 몇 가지 방법 을 소개 할 것 이 니 모두 가 함께 볼 수 있 습 니 다.
1.WPF 4.0 의 새 글꼴 렌 더 링 방법 으로 개선 되 지 않 음

<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
2.컨트롤 에 SnapToDevicePixels 속성 을 추가 하여 개선 되 지 않 음
UI 전체 에 픽 셀 정렬 을 사용 한 다 는 전설 이 있 습 니 다.96 dots per inch (dpi) 이상 의 장 치 를 운행 하 는 경우 픽 셀 정렬 은 단일 실선 부근 에 나타 나 는 톱날 의 시각 적 하 자 를 최소 화 할 수 있 습 니 다.
3.Times New Roman 글꼴 이나 마이크로소프트 검은색 글꼴 을 사용 하 는 것 이 좋 습 니 다.그러나 글씨체 가 못 생 겨 서 허 황 된 것 을 완전히 피 할 수 없습니다.또한 애니메이션 을 해결 하지 못 한 후에 문자 가 계속 허 변 현상 을 해결 할 수 없습니다.
4.최종 해결
사실은 자신 이 작성 한 BorderDropShadowEffect(그림자 효과)을 설정 해서 생 긴 것 입 니 다.DropShadowEffect 으로 인해 요소/하위 요 소 를 비트 맵 으로 먼저 렌 더 링 하여 비트 맵 격자 정렬 으로 인 한 모호 함.
해결 방법 은 몇 가지 가 있다.
  • UseLayoutRounding 을 사용 하여 컨트롤 을 배치 할 때 격자 를 맞 춥 니 다(효과 2 참조).
  • 은 Text 요 소 를 DropShadowEffect 의 서브 요소 로 하지 않 고 ShadowEffectButton 에 영향 을 주지 않도록 하 는 것 이다(효과 3 참조).
  • 효 과 는 다음 과 같다(0:기준      1:허전 하 다        2:UseLayoutRounding      3:평행 원소)

  • 효과 4 는 System DropShadow Chrome 을 시험 하여 주석 을 달 수 있 습 니 다.
    
    <Window x:Class="WpfApplication1.MainWindow"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:luna="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna"
     Title="MainWindow" Height="350" Width="525" SnapsToDevicePixels="True">
     <Window.Resources>
      <Style TargetType="Button">
       <Setter Property="Width" Value="80" />
       <Setter Property="Height" Value="40" />
       <Setter Property="Margin" Value="0,5,0,5" />
      </Style>
     </Window.Resources>
     <StackPanel>
      <Button Content="     0" />
      <Button Content="     1" >
       <Button.Effect><DropShadowEffect/></Button.Effect>
      </Button>
      <Button Content="     2" UseLayoutRounding="True">
       <Button.Effect>
        <DropShadowEffect/>
       </Button.Effect>
      </Button>
      <Grid Width="80" Height="40" Margin="0,5,0,5">
       <Border Background="Black" Margin="1,0,0,0" CornerRadius="2">
        <Border.Effect><DropShadowEffect /></Border.Effect>
       </Border>
       <Button Content="     3" Margin="0"/>
      </Grid>
      <luna:SystemDropShadowChrome Width="80" Height="40" Margin="0,5,0,0">
       <Button Content="     4" Margin="0" />
      </luna:SystemDropShadowChrome>
     </StackPanel>
    </Window>
    총결산
    이상 은 이 글 의 전체 내용 입 니 다.본 논문 의 내용 이 여러분 의 학습 이나 업무 에 어느 정도 도움 이 되 기 를 바 랍 니 다.궁금 한 점 이 있 으 면 댓 글 을 남 겨 주 십시오.

    좋은 웹페이지 즐겨찾기