本文整理汇总了C#中WindowStyle类的典型用法代码示例。如果您正苦于以下问题:C# WindowStyle类的具体用法?C# WindowStyle怎么用?C# WindowStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WindowStyle类属于命名空间,在下文中一共展示了WindowStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GoFullScreen
public static void GoFullScreen(this Window window)
{
if (IsFullScreen(window))
{
return;
}
windowState = window.WindowState;
windowStyle = window.WindowStyle;
windowTopmost = window.Topmost;
windowResizeMode = window.ResizeMode;
windowRect.X = window.Left;
windowRect.Y = window.Top;
windowRect.Width = window.Width;
windowRect.Height = window.Height;
window.WindowState = WindowState.Maximized;
window.WindowStyle = WindowStyle.None;
windowTopmost = false;
windowResizeMode = ResizeMode.NoResize;
IntPtr handle = new WindowInteropHelper(window).Handle;
Screen screen = Screen.FromHandle(handle);
window.Width = screen.Bounds.Width;
window.Height = screen.Bounds.Height;
fullWindow = window;
}
示例2: AddPopupWindow
public void AddPopupWindow(Control _TargetControl, Control _PopupControl, PopupEvent _PStyle,WindowStyle _WStyle, int _width, int _height,bool _ismouseclickhide)
{
PopupContent popup = new PopupContent();
popup.TargetControl = _TargetControl;
popup.PopupControl = _PopupControl;
popup.PType = PopupType.Window;
popup.PStyle = _PStyle;
popup.WStyle = _WStyle;
popup.Width = _width;
popup.Height = _height;
popup.IsMCHide = _ismouseclickhide;
popup.WindowTitle = "";
_PopupControl.Tag = this;
if (popup.PStyle == PopupEvent.Click)
{
_TargetControl.Click += new EventHandler(_TargetControl_Click);
}
else if (popup.PStyle == PopupEvent.Mouse)
{
_TargetControl.MouseEnter += new EventHandler(_TargetControl_MouseEnter);
_TargetControl.MouseLeave += new EventHandler(_TargetControl_MouseLeave);
}
else
{
}
popupList.Add(popup);
_PopupControl.Hide();
}
示例3: ToFullscreen
public static void ToFullscreen(this Window window)
{
if (window.IsFullscreen())
{
return;
}
_windowState = window.WindowState;
_windowStyle = window.WindowStyle;
_windowTopMost = window.Topmost;
_windowResizeMode = window.ResizeMode;
_windowRect.X = window.Left;
_windowRect.Y = window.Top;
_windowRect.Width = window.Width;
_windowRect.Height = window.Height;
window.WindowState = WindowState.Normal;
window.WindowStyle = WindowStyle.None;
window.ResizeMode = ResizeMode.NoResize;
window.Topmost = true;
var handle = new WindowInteropHelper(window).Handle;
Screen screen = Screen.FromHandle(handle);
window.MaxWidth = screen.Bounds.Width;
window.MaxHeight = screen.Bounds.Height;
window.WindowState = WindowState.Maximized;
window.Activated += new EventHandler(window_Activated);
window.Deactivated += new EventHandler(window_Deactivated);
_fullWindow = window;
}
示例4: CheckIfWindowStyleIsFullscreen
public static void CheckIfWindowStyleIsFullscreen(WindowStyle w)
{
if (w.Equals(WindowStyle.Fullscreen))
MessageBox.Show("Your windowstyle seems to be \"Fullscreen\".\n" +
"If you want to use this tool, change the\n" +
"Windowstyle to \"Windowed\" or \"Windowed Fullscreen\"\n" +
"to have the best experience!", "Windowstyle");
}
示例5: CreateRadioButton
RadioButton CreateRadioButton(string strText, WindowStyle winstyle)
{
RadioButton radio = new RadioButton();
radio.Content = strText;
radio.Tag = winstyle;
radio.Margin = new Thickness(5);
radio.IsChecked = (winstyle == WindowStyle);
return radio;
}
示例6: InitWithContentRectStyleMaskBackingDefer
static void InitWithContentRectStyleMaskBackingDefer(ref IntPtr nativePointer, Rectangle contentRect, WindowStyle windowStyle, SafeNativeMethods.BackingStoreType bufferingType, bool deferCreation)
{
nativePointer = ObjectiveC.LP64 ?
objc_msgSend_initWithContentRect_styleMask_backing_defer_64(
nativePointer, Selectors.InitWithContentRectStyleMaskBackingDefer,
contentRect, (long)windowStyle, (long)bufferingType, deferCreation) :
objc_msgSend_initWithContentRect_styleMask_backing_defer_32(
nativePointer, Selectors.InitWithContentRectStyleMaskBackingDefer,
contentRect, (int)windowStyle, (int)bufferingType, deferCreation);
}
示例7: WindowProfile
public WindowProfile(string title, WindowStyle style, ExtendedWindowStyle extStyle, int x, int y, int width, int height)
{
Title = title;
WindowStyle = style;
ExtendedWindowStyle = extStyle;
X = x;
Y = y;
Width = width;
Height = height;
}
示例8: CreateMenuItem
MenuItem CreateMenuItem(string str, WindowStyle style)
{
MenuItem item = new MenuItem();
item.Header = str;
item.Tag = style;
item.IsChecked = (style == WindowStyle);
item.Click += StyleOnClick;
if (item.IsChecked)
itemChecked = item;
return item;
}
示例9: CreateMenuItem
MenuItem CreateMenuItem(string str, WindowStyle style)
{
MenuItem item = new MenuItem();
item.Header = str;
item.Tag = style;
item.IsChecked = (style == WindowStyle);
item.Click += styleonclick; // 메뉴 생성과 동시에 같은 이벤트를 설정한다.
if (item.IsChecked)
itemchecked = item;
return item;
}
示例10: SetFullScreen
/// <summary>
/// Sets the window's fullscreen state.
/// </summary>
/// <param name="fullScreen">True for fullscreen, false otherwise.</param>
public void SetFullScreen( bool fullScreen = true )
{
if ( fullScreen == IsFullScreen )
return;
if ( fullScreen && !IsFullScreen )
{
oldState = Player.windowData.Window.WindowState;
oldStyle = Player.windowData.Window.WindowStyle;
}
Player.windowData.Window.ResizeMode = fullScreen ? ResizeMode.NoResize : ResizeMode.CanResize;
Player.windowData.Window.ShowTitleBar = !fullScreen;
Player.windowData.Window.ShowCloseButton = !fullScreen;
Player.windowData.Window.WindowStyle = fullScreen ? WindowStyle.None : oldStyle;
Player.windowData.Window.WindowState = fullScreen ? WindowState.Maximized : oldState;
IsFullScreen = fullScreen;
OnFullscreenChanged?.Invoke( this, new OnFullscreenChangedEventArgs( IsFullScreen ) );
}
示例11: GoFullscreen
/// <summary>
/// 进入全屏
/// </summary>
/// <param name="window"></param>
public static void GoFullscreen(this Window window)
{
//已经是全屏
if (window.IsFullscreen()) return;
//存储窗体信息
_windowState = window.WindowState;
_windowStyle = window.WindowStyle;
_windowTopMost = window.Topmost;
_windowResizeMode = window.ResizeMode;
_windowRect.X = window.Left;
_windowRect.Y = window.Top;
_windowRect.Width = window.Width;
_windowRect.Height = window.Height;
//变成无边窗体
window.WindowState = WindowState.Normal;//假如已经是Maximized,就不能进入全屏,所以这里先调整状态
window.WindowStyle = WindowStyle.None;
window.ResizeMode = ResizeMode.NoResize;
window.Topmost = true;//最大化后总是在最上面
//获取窗口句柄
var handle = new WindowInteropHelper(window).Handle;
//获取当前显示器屏幕
Screen screen = Screen.FromHandle(handle);
//调整窗口最大化,全屏的关键代码就是下面3句
window.MaxWidth = screen.Bounds.Width;
window.MaxHeight = screen.Bounds.Height;
window.WindowState = WindowState.Maximized;
//解决切换应用程序的问题
window.Activated += new EventHandler(window_Activated);
window.Deactivated += new EventHandler(window_Deactivated);
//记住成功最大化的窗体
_fullWindow = window;
}
示例12: WindowDelegate
public WindowDelegate(NavigationWindow window)
{
_window = window;
_dispatcher = window.Dispatcher;
_scenes = new List<Scene>();
_resources = new Dictionary<string, ResourceDictionary>();
_sceneIndex = -1;
_windowRect = new Rect();
_dispatcher.Invoke(() =>
{
_windowTopmost = window.Topmost;
_windowState = window.WindowState;
_windowStyle = window.WindowStyle;
_windowResizemode = window.ResizeMode;
_windowRect.X = window.Left;
_windowRect.Y = window.Top;
_windowRect.Width = window.Width;
_windowRect.Height = window.Height;
window.LoadCompleted += (sender, e) => NavigateFinished();
});
}
示例13: GoFullscreen
/// <summary>
/// ����ȫ��
/// </summary>
/// <param name="window"></param>
public static void GoFullscreen(this Window window)
{
//�Ѿ���ȫ��
if(window.IsFullscreen()) return;
//�洢������Ϣ
_windowState = window.WindowState;
_windowStyle = window.WindowStyle;
_windowTopMost = window.Topmost;
_windowResizeMode = window.ResizeMode;
_windowRect.X = window.Left;
_windowRect.Y = window.Top;
_windowRect.Height = window.Width;
_windowRect.Height = window.Height;
//����ޱߴ���
window.WindowState = WindowState.Normal;//�����Ѿ���Maximized���Ͳ��ܽ���ȫ�������������ȵ���״̬
window.WindowStyle = WindowStyle.None;
window.ResizeMode = ResizeMode.NoResize;
window.Topmost = true;//���������������
//��ȡ���ھ��
var handle = new WindowInteropHelper(window).Handle;
//��ȡ��ǰ��ʾ����Ļ
Screen screen = Screen.FromHandle(handle);
//�����������,ȫ���Ĺؼ������������3��
window.MaxWidth = screen.Bounds.Width;
window.MaxHeight = screen.Bounds.Height;
window.WindowState = WindowState.Maximized;
//����л�Ӧ�ó��������
window.Activated += new EventHandler(window_Activated);
window.Deactivated += new EventHandler(window_Deactivated);
//��ס�ɹ���Ĵ���
_fullWindow = window;
}
示例14: OnCoerceWindowStyle
protected override object OnCoerceWindowStyle( WindowStyle newValue )
{
if( newValue != WindowStyle.SingleBorderWindow )
throw new InvalidOperationException( "Window style on MessageBox is not available." );
return newValue;
}
示例15: SetFullScreen
private void SetFullScreen()
{
_windowState = _window.WindowState;
_windowStyle = _window.WindowStyle;
_windowResizemode = _window.ResizeMode;
_windowRect.X = _window.Left;
_windowRect.Y = _window.Top;
_windowRect.Width = _window.Width;
_windowRect.Height = _window.Height;
_window.WindowState = WindowState.Normal;
_window.WindowStyle = WindowStyle.None;
_window.ResizeMode = ResizeMode.NoResize;
_window.Topmost = true;
_window.Left = 0;
_window.Top = 0;
_window.Width = SystemParameters.PrimaryScreenWidth;
_window.Height = SystemParameters.PrimaryScreenHeight;
_window.Activated += Window_Active;
_window.Deactivated += Window_Deactive;
}