빠른 WPF 질문 - WPF에서 Win 7 (및 Vista 가정)에서 기본 진행률 표시 줄은 멋진 작은 "휙휙"-y 애니메이션을 수행합니다.WPF/Windows 7 : 기본 진행 표시 줄 사용 안 함 애니메이션
나는 한 화면에 약 48 가지의 진행 상황을 보여 주며,이 모든 것들을 압도적 인 태도로 가지고 있습니다. 응용 프로그램의 나머지 기본 애니메이션에는 영향을주지 않고이 애니메이션을 비활성화 할 수 있습니까?
빠른 WPF 질문 - WPF에서 Win 7 (및 Vista 가정)에서 기본 진행률 표시 줄은 멋진 작은 "휙휙"-y 애니메이션을 수행합니다.WPF/Windows 7 : 기본 진행 표시 줄 사용 안 함 애니메이션
나는 한 화면에 약 48 가지의 진행 상황을 보여 주며,이 모든 것들을 압도적 인 태도로 가지고 있습니다. 응용 프로그램의 나머지 기본 애니메이션에는 영향을주지 않고이 애니메이션을 비활성화 할 수 있습니까?
Matthew의 의견에 동의하지만 어쨌든 귀하의 대답은 애니메이션없이 사용자 지정 스타일을 적용하는 것입니다.
<Style x:Key="{x:Type ProgressBar}" TargetType="{x:Type ProgressBar}">
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3" SnapsToDevicePixels="true">
<Border BorderThickness="1,1,1,0" BorderBrush="#BEBEBE" CornerRadius="2">
<Border BorderThickness="1" BorderBrush="#EFEFEF" CornerRadius="1">
<DockPanel Name="PART_Track" Margin="0,0,0,1" LastChildFill="false">
<Decorator Name="PART_Indicator" Dock="Bottom">
<Rectangle LayoutTransform="{RotateTransform Angle=-90}">
<Rectangle.Fill>
<MultiBinding Converter="{theme:ProgressBarBrushConverter}">
<Binding Path="Foreground" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsIndeterminate" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="ActualHeight" ElementName="PART_Indicator" />
<Binding Path="ActualWidth" ElementName="PART_Indicator" />
<Binding Path="ActualHeight" ElementName="PART_Track" />
</MultiBinding>
</Rectangle.Fill>
</Rectangle>
</Decorator>
</DockPanel>
</Border>
</Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
<Setter Property="Foreground" Value="{StaticResource [0] Ñ}" />
<Setter Property="Background" Value="{DynamicResource {x:Static WindowBrush}}" />
<Setter Property="BorderBrush" Value="#686868" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3" SnapsToDevicePixels="true">
<Border BorderThickness="1,1,1,0" BorderBrush="#BEBEBE" CornerRadius="2">
<Border BorderThickness="1" BorderBrush="#EFEFEF" CornerRadius="1">
<DockPanel Name="PART_Track" Margin="1,0,0,1" LastChildFill="false">
<Rectangle Name="PART_Indicator">
<Rectangle.Fill>
<MultiBinding Converter="{theme:ProgressBarBrushConverter}">
<Binding Path="Foreground" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsIndeterminate" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="ActualWidth" ElementName="PART_Indicator" />
<Binding Path="ActualHeight" ElementName="PART_Indicator" />
<Binding Path="ActualWidth" ElementName="PART_Track" />
</MultiBinding>
</Rectangle.Fill>
</Rectangle>
</DockPanel>
</Border>
</Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
그리고 컨버터 클래스 :
public class ProgressBarBrushConverter : IMultiValueConverter
{
// Methods
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
Type type = typeof(double);
if (((((values == null) || (values.Length != 5)) || ((values[0] == null) || (values[1] == null))) || (((values[2] == null) || (values[3] == null)) || ((values[4] == null) || !typeof(Brush).IsAssignableFrom(values[0].GetType())))) || ((!typeof(bool).IsAssignableFrom(values[1].GetType()) || !type.IsAssignableFrom(values[2].GetType())) || (!type.IsAssignableFrom(values[3].GetType()) || !type.IsAssignableFrom(values[4].GetType()))))
{
return null;
}
Brush brush = (Brush) values[0];
bool flag = (bool) values[1];
double d = (double) values[2];
double num2 = (double) values[3];
double num3 = (double) values[4];
if ((((d <= 0.0) || double.IsInfinity(d)) || (double.IsNaN(d) || (num2 <= 0.0))) || (double.IsInfinity(num2) || double.IsNaN(num2)))
{
return null;
}
DrawingBrush brush2 = new DrawingBrush();
brush2.Viewport = brush2.Viewbox = new Rect(0.0, 0.0, d, num2);
brush2.ViewportUnits = brush2.ViewboxUnits = BrushMappingMode.Absolute;
brush2.TileMode = TileMode.None;
brush2.Stretch = Stretch.None;
DrawingGroup group = new DrawingGroup();
DrawingContext context = group.Open();
double x = 0.0;
double width = 6.0;
double num6 = 2.0;
double num7 = width + num6;
if (flag)
{
int num8 = (int) Math.Ceiling((double) (d/num7));
double num9 = -num8 * num7;
double num10 = d * 0.3;
brush2.Viewport = brush2.Viewbox = new Rect(num9, 0.0, num10 - num9, num2);
TranslateTransform transform = new TranslateTransform();
double num11 = num8 * 100;
DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();
animation.Duration = new Duration(TimeSpan.FromMilliseconds(num11));
animation.RepeatBehavior = RepeatBehavior.Forever;
for (int i = 1; i <= num8; i++)
{
double num13 = i * num7;
animation.KeyFrames.Add(new DiscreteDoubleKeyFrame(num13, KeyTime.Uniform));
}
transform.BeginAnimation(TranslateTransform.XProperty, animation);
brush2.Transform = transform;
while ((x + width) < num10)
{
context.DrawRectangle(brush, null, new Rect(num9 + x, 0.0, width, num2));
x += num7;
}
d = num10;
x = 0.0;
}
while ((x + width) < d)
{
context.DrawRectangle(brush, null, new Rect(x, 0.0, width, num2));
x += num7;
}
double num14 = d - x;
if ((!flag && (num14 > 0.0)) && (Math.Abs((double) (d - num3)) < 1E-05))
{
context.DrawRectangle(brush, null, new Rect(x, 0.0, num14, num2));
}
context.Close();
brush2.Drawing = group;
return brush2;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}
누구나 실제로 이것을 성공적으로 사용 했습니까? 위의 스타일을 컴파일 할 수조차 없습니다. –
또한 모두 함께 Win7에이 효과를 해제 할 수 있습니다 여기에 어떤 (반사를 통해) 원래 스타일, 당신은/팅겨/제거 할 수 있습니다입니다.
바탕 화면에서 내 컴퓨터 아이콘을 마우스 오른쪽 단추로 클릭하고 속성을 선택하거나 Windows 키 + 일시 중지/중단 키를 클릭하고 왼쪽 창에서 고급 시스템 설정 링크를 클릭하십시오 (또한 sysdm.cpl을 입력하여 열 수도 있습니다). 실행 또는 시작 메뉴 검색 상자를 선택하고 Enter 키를 누릅니다). 이제 성능 섹션의 설정 버튼을 클릭하십시오 :
"창의 컨트롤 및 요소에 애니메이션 적용"의 선택을 취소하십시오. 첫 번째 선택 항목이어야합니다.
감사합니다.이 특별한 경우에는 응용 프로그램에만 국한해야합니다 (글로벌 OS 테마 변경에 의존하고 싶지는 않음). 그러나 좋은 정보 – Brandon
간단한 애니메이션이 아닌 진행률 막대는 두 개의 채워진 사각형이있는 격자로 쓸 수 있습니다. 왼쪽은 녹색으로, 오른쪽은 회색으로 채워집니다.
그리드에는 두 개의 열 정의가 있습니다.
두 가지의 너비를 변경하면 진행 상황이 변경됩니다. 내 지역 만이 대답
되지도 관련이있을 수 : Disabling progress bar animation on Vista Aero
로버트의 대답은 강력합니다. 진행 바를 변경 구현 방법하면
void SetGlowVisibility(ProgressBar progressBar, Visibility visibility) {
var glow = progressBar.Template.FindName("PART_GlowRect", progressBar) as FrameworkElement;
if (glow != null) glow.Visibility = visibility;
}
(이 구현 세부하고 후속 버전에서 변경 될 빛을 수행하는 요소의 내부 이름에 의존하기 때문에) 여기서 는 해킹 이 해킹은 작동을 멈출 수 있습니다.
반면에 XAML 및 스타일을 완전히 대체하는 솔루션은 색상, 경계선 등을 고정시키고 수정하여 향후 ProgressBar의 최신 버전에 추가 될 수있는 동작을 비활성화 할 수 있습니다.
사용중인 응용 프로그램에 대한 바로 가기를 만들고 바로 가기를 마우스 오른쪽 단추로 클릭 한 다음 속성을 선택하십시오. 호환성 탭에서 "비주얼 테마 사용 안함"체크 상자를 클릭하십시오.
응용 프로그램의 다른 애니메이션에 영향을줍니다 –
@Matthew, 48 진행 막대를 표시하는 데있어서 잘못된 점은 무엇입니까? 비행기 조종석 봤어? 또는 날씨 남자 대시 보드? 또는 모든 cnc 시스템의 대시 보드? 모든 응용 프로그램이 프로그래머와 관리자만을위한 것은 아니며, 대답은 질문과 관련이 있어야하고, 사람이 자신의 디자인을 변경한다고 말하고, 자신의 직업을 수행하고 있으며 질문하지 않았습니다. 48 진행 상태를 유지하는 것이 좋습니다. 바? –
@Matthew,이 응용 프로그램에서는 물리적으로 실시간으로 모니터링되는 48 개의 장치에 대한 정보를 표시하기 때문에이 진행 막대가 적절합니다. 이것이 LOB 앱이나 뭔가라면 나는 당신과 동의 할 것입니다. – Brandon