Autor |
Beitrag |
ebber
Beiträge: 239
Erhaltene Danke: 1
Win XP, Win 7
C# (VS 2010), Delphi (2007), Expression 4
|
Verfasst: Fr 26.12.08 19:25
Hallo,
ich habe ein ein wenig mysteriöses Problem. Ich habe in mein Programm einen SplashScreen eingebaut. Zuerst dachte ich er funktioniert, aber dann habe ich gemerkt, dass meine Hauptprogrammoberfläche nicht mehr reagiert.
Ich kann jeden Button drücken und der Code dahinter wird auch ausgeführt, aber die Oberfläche wird nicht neu gezeichnet. Also ich sehe nicht dass ich den Button gedrückt habe und ich kann in einer Textbox nicht scrollen.
Das Problem wird mit einem Klick auf das Main Menu behoben. Danach funktioniert wieder alles wie gewohnt. Die Textbox ist danach sogar gescrollt.
Der Splash Screen ist eine ganz normale Form und wird so erstellt:
C#-Quelltext 1: 2: 3: 4: 5: 6: 7:
| public Window1() { Splash = new SpScreen(); Splash.Show(); this.InitializeComponent(); } |
Wenn ich nur die Zeile Splash.Show(); weg lasse, funktioniert alles.
Oder ich schließe den SplashScreen am Ende nicht, dann funktioniert es auch.
Geschlossen wird er irgendwann durch den Aufruf des Hauptprogramms von CloseSoon
C#-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| public void CloseSoon() { TimerClose.Tick += new System.EventHandler(TimerClose_Tick); TimerClose.Interval = TimeSpan.FromMilliseconds(1000); TimerClose.Start(); }
void TimerClose_Tick(object sender, System.EventArgs e) { Close(); } |
Das scheint mir ein sehr mysteriöses und unlösbares Problem, aber vielleicht hat jemand zufällig die Antwort.
MfG
|
|
jaenicke
Beiträge: 19284
Erhaltene Danke: 1742
W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Fr 26.12.08 20:49
Zuletzt bearbeitet von jaenicke am Fr 26.12.08 21:17, insgesamt 2-mal bearbeitet
|
|
Kha
Beiträge: 3803
Erhaltene Danke: 176
Arch Linux
Python, C, C++ (vim)
|
Verfasst: Fr 26.12.08 20:53
Kleiner Hinweis, es geht hier um WPF . Ich finde das Problem aber ebenso mysteriös .
ebber hat folgendes geschrieben : | Zuerst dachte ich er funktioniert, aber dann habe ich gemerkt, dass meine Hauptprogrammoberfläche nicht mehr reagiert. |
Also auch nach dem Splashscreen?
_________________ >λ=
|
|
Christian S.
Beiträge: 20451
Erhaltene Danke: 2264
Win 10
C# (VS 2019)
|
Verfasst: Fr 26.12.08 20:54
Ab .NET 3.5 SP1 kannst Du einem in Dein Projekt eingebundenen Bild übrigens die Build-Action "SplashScreen" verpassen, dann sparst Du Dir den Aufwand
_________________ Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
|
|
jaenicke
Beiträge: 19284
Erhaltene Danke: 1742
W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Fr 26.12.08 21:16
|
|
ebber
Beiträge: 239
Erhaltene Danke: 1
Win XP, Win 7
C# (VS 2010), Delphi (2007), Expression 4
|
Verfasst: Fr 26.12.08 21:52
|
|
jaenicke
Beiträge: 19284
Erhaltene Danke: 1742
W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Fr 26.12.08 22:01
ebber hat folgendes geschrieben : | Aussehen tut bei mir auch alles normal und Buttons klicken kann ich auch. Es kommt bloß keine Animation beim Button klicken oder sonst irgendwie verändert sich auch nur das geringste auf dem Fenster. |
Der Button geht ganz normal runter und wieder hoch bei mir, das meinte ich.
|
|
ebber
Beiträge: 239
Erhaltene Danke: 1
Win XP, Win 7
C# (VS 2010), Delphi (2007), Expression 4
|
Verfasst: Sa 27.12.08 15:52
Nach einigem rumprobieren konnte ich es in gewisser Weise nachstellen.
Es muss wohl am SplashScreen liegen. Als ich seinen xaml Code in einem neuen Projekt benutzt habe ist der Fehler wieder aufgetreten.
Er ist ein wenig lang, aber ich habe keine Ahnung woran es liegen könnte. Vielleicht fällt jemandem gerade zufällig was auf.
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: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176:
| <Window x:Class="RSHe.SpScreen" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="SplashScreen" Height="247" Width="599" AllowsTransparency="True" WindowStyle="None" BorderThickness="4,0,4,0" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" WindowStartupLocation="CenterScreen" x:Name="SplashScreenWin" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Topmost="True"> <Window.Resources> <DrawingBrush x:Key="Brush1" Stretch="Fill" TileMode="FlipX" Viewbox="0,0,20,20" ViewboxUnits="Absolute"> <DrawingBrush.Drawing> <DrawingGroup> <GeometryDrawing Brush="#FFD3D3D3"> <GeometryDrawing.Geometry> <RectangleGeometry Rect="0,0,20,20"/> </GeometryDrawing.Geometry> </GeometryDrawing> <GeometryDrawing Brush="#FF000000"> <GeometryDrawing.Geometry> <EllipseGeometry Center="0,0" RadiusX="10" RadiusY="10"/> </GeometryDrawing.Geometry> </GeometryDrawing> <GeometryDrawing Brush="#FF000000"> <GeometryDrawing.Geometry> <EllipseGeometry Center="20,20" RadiusX="10" RadiusY="10"/> </GeometryDrawing.Geometry> </GeometryDrawing> <GeometryDrawing Brush="#FFFFFFFF"> <GeometryDrawing.Geometry> <EllipseGeometry Center="20,0" RadiusX="10" RadiusY="10"/> </GeometryDrawing.Geometry> </GeometryDrawing> <GeometryDrawing Brush="#FFFFFFFF"> <GeometryDrawing.Geometry> <EllipseGeometry Center="0,20" RadiusX="10" RadiusY="10"/> </GeometryDrawing.Geometry> </GeometryDrawing> </DrawingGroup> </DrawingBrush.Drawing> </DrawingBrush> <LinearGradientBrush x:Key="Brush2" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFFF8C00" Offset="0.558"/> <GradientStop Color="#FFF69E33" Offset="0.47"/> <GradientStop Color="#FFCD7000" Offset="0"/> </LinearGradientBrush> <Style x:Key="ProgressBarStyle1" TargetType="{x:Type ProgressBar}"> <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> <Setter Property="BorderBrush"> <Setter.Value> <SolidColorBrush/> </Setter.Value> </Setter> <Setter Property="BorderThickness" Value="1,1,1,1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ProgressBar}"> <Microsoft_Windows_Themes:ClassicBorderDecorator BorderStyle="ThinPressed" BorderThickness="{TemplateBinding BorderThickness}"> <Microsoft_Windows_Themes:ClassicBorderDecorator.BorderBrush> <LinearGradientBrush EndPoint="1.009,0.5" StartPoint="-0.006,0.5"> <GradientStop Color="#FFFFFFFF" Offset="0"/> <GradientStop Color="#FFFFFFFF" Offset="1"/> <GradientStop Color="#00FFFFFF" Offset="0.093"/> <GradientStop Color="#00FFFFFF" Offset="0.907"/> </LinearGradientBrush> </Microsoft_Windows_Themes:ClassicBorderDecorator.BorderBrush> <DockPanel Margin="0,0,2,2" x:Name="PART_Track" LastChildFill="False"> <Rectangle x:Name="PART_Indicator" Fill="{TemplateBinding Foreground}"> <Rectangle.OpacityMask> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#5FFFFFFF" Offset="0"/> <GradientStop Color="#FFFFFFFF" Offset="1"/> </LinearGradientBrush> </Rectangle.OpacityMask> </Rectangle> </DockPanel> </Microsoft_Windows_Themes:ClassicBorderDecorator> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="Orientation" Value="Vertical"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ProgressBar}"> <Microsoft_Windows_Themes:ClassicBorderDecorator Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="ThinPressed" BorderThickness="{TemplateBinding BorderThickness}"> <DockPanel Margin="0,0,2,2" x:Name="PART_Track" LastChildFill="False"> <Decorator x:Name="PART_Indicator" DockPanel.Dock="Bottom"> <Rectangle> <Rectangle.LayoutTransform> <RotateTransform Angle="-90"/> </Rectangle.LayoutTransform> <Rectangle.Fill> <MultiBinding UpdateSourceTrigger="Default" StringFormat="{x:Null}"> <MultiBinding.Converter> <Microsoft_Windows_Themes:ProgressBarBrushConverter/> </MultiBinding.Converter> <Binding Path="Foreground" RelativeSource="{RelativeSource TemplatedParent}" StringFormat="{x:Null}"/> <Binding Path="IsIndeterminate" RelativeSource="{RelativeSource TemplatedParent}" StringFormat="{x:Null}"/> <Binding Path="ActualHeight" ElementName="PART_Indicator" StringFormat="{x:Null}"/> <Binding Path="ActualWidth" ElementName="PART_Indicator" StringFormat="{x:Null}"/> <Binding Path="ActualHeight" ElementName="PART_Track" StringFormat="{x:Null}"/> </MultiBinding> </Rectangle.Fill> </Rectangle> </Decorator> </DockPanel> </Microsoft_Windows_Themes:ClassicBorderDecorator> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> <Storyboard x:Key="OnLoaded1" AutoReverse="True" RepeatBehavior="Forever"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PrBLoad" Storyboard.TargetProperty="(TextElement.Foreground).(GradientBrush.GradientStops)[4].(GradientStop.Offset)"> <SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="0.981" KeySpline="0.573,0,0.405,1"/> <SplineDoubleKeyFrame KeyTime="00:00:03.2000000" Value="0.089" KeySpline="0.586,0,0.434,1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PrBLoad" Storyboard.TargetProperty="(TextElement.Foreground).(GradientBrush.GradientStops)[3].(GradientStop.Offset)"> <SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="0.949" KeySpline="0.573,0,0.405,1"/> <SplineDoubleKeyFrame KeyTime="00:00:03.2000000" Value="0.052" KeySpline="0.586,0,0.434,1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PrBLoad" Storyboard.TargetProperty="(TextElement.Foreground).(GradientBrush.GradientStops)[2].(GradientStop.Offset)"> <SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="0.916" KeySpline="0.573,0,0.405,1"/> <SplineDoubleKeyFrame KeyTime="00:00:03.2000000" Value="0.019" KeySpline="0.586,0,0.434,1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="OnLoaded2"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </Window.Resources> <Window.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="PrBLoad"> <BeginStoryboard Storyboard="{StaticResource OnLoaded1}"/> </EventTrigger> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource OnLoaded2}" x:Name="OnLoaded2_BeginStoryboard"/> </EventTrigger> </Window.Triggers> <Window.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#00000000" Offset="0"/> <GradientStop Color="#00000000" Offset="1"/> <GradientStop Color="#F2000000" Offset="0.344"/> <GradientStop Color="#FF000000" Offset="0.66"/> </LinearGradientBrush> </Window.Background> <Window.BorderBrush> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#00FF6900" Offset="0.084"/> <GradientStop Color="#00FF6900" Offset="0.921"/> <GradientStop Color="#FFFF6900" Offset="0.475"/> <GradientStop Color="#FFFF6900" Offset="0.521"/> </LinearGradientBrush> </Window.BorderBrush> <Grid> <ProgressBar Margin="24,0,25,80" Style="{DynamicResource ProgressBarStyle1}" VerticalAlignment="Bottom" Height="10" Value="75" x:Name="PrBLoad" > <ProgressBar.Foreground> <LinearGradientBrush EndPoint="-0.005,0.5" StartPoint="1.004,0.5"> <GradientStop Color="#FFFF8900" Offset="0"/> <GradientStop Color="#FFFF8900" Offset="1"/> <GradientStop Color="#FFFF8A00" Offset="0.038"/> <GradientStop Color="#FFFFFFFF" Offset="0.066"/> <GradientStop Color="#FFFF8900" Offset="0.098"/> </LinearGradientBrush> </ProgressBar.Foreground> </ProgressBar> <Label Margin="253,89,150,94" Content="Rs He" FontFamily="./Fonts\#Calibri" FontSize="36" Foreground="#FFFFFFFF"> <Label.BitmapEffect> <OuterGlowBitmapEffect GlowColor="#FFFF9600" GlowSize="8"/> </Label.BitmapEffect> </Label> <TextBlock Margin="139.772,0,127.74,56.427" VerticalAlignment="Bottom" Height="19.573" Text="Loading ..." TextWrapping="Wrap" TextAlignment="Center" Foreground="#FFFFFFFF" x:Name="LblStatus"/> </Grid> </Window> |
Mir ist nicht ganz klar, wie der xaml Code ein anderes Fenster auf diese Weise beeinflussen kann.
MfG
|
|
|