개정판 40a810fc
main window 수정
Change-Id: I4ab3d66c5a5b1d06a9c9e40ca5fb972bf4d79cbb
KCOM/Controls/CustomWindow.cs | ||
---|---|---|
9 | 9 |
using System.Runtime.InteropServices; |
10 | 10 |
using System.Windows.Media; |
11 | 11 |
using System.Collections; |
12 |
using System.Linq; |
|
12 | 13 |
|
13 | 14 |
namespace KCOM.Controls.CustomizedWindow |
14 | 15 |
{ |
... | ... | |
39 | 40 |
|
40 | 41 |
public partial class VS2012WindowStyle |
41 | 42 |
{ |
43 |
|
|
42 | 44 |
#region sizing event handlers |
43 | 45 |
|
44 | 46 |
void OnSizeSouth(object sender, MouseButtonEventArgs e) { OnSize(sender, SizingAction.South); } |
... | ... | |
87 | 89 |
|
88 | 90 |
void MaxButtonClick(object sender, RoutedEventArgs e) |
89 | 91 |
{ |
90 |
sender.ForWindowFromTemplate(w => w.WindowState = (w.WindowState == WindowState.Maximized) ? WindowState.Normal : WindowState.Maximized); |
|
92 |
sender.ForWindowFromTemplate(w => |
|
93 |
{ |
|
94 |
if (w.WindowState == WindowState.Maximized) |
|
95 |
{ |
|
96 |
w.WindowState = WindowState.Normal; |
|
97 |
} |
|
98 |
else |
|
99 |
{ |
|
100 |
w.WindowState = WindowState.Maximized; |
|
101 |
} |
|
102 |
}); |
|
91 | 103 |
} |
92 | 104 |
|
93 |
void TitleBarMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
105 |
void TitleBarMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
94 | 106 |
{ |
95 |
// System.Diagnostics.Debug.WriteLine("Click Time " + new TimeSpan(e.Timestamp).ToString()); |
|
107 |
|
|
108 |
} |
|
96 | 109 |
|
97 |
if (e.ClickCount == 2 && new TimeSpan(e.Timestamp) < new TimeSpan(0, 0, 0, 3)) |
|
110 |
void TitleBarMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
111 |
{ |
|
112 |
// System.Diagnostics.Debug.WriteLine("Click Time " + new TimeSpan(e.Timestamp).ToString()); |
|
113 |
|
|
114 |
if (e.ClickCount > 1) |
|
98 | 115 |
{ |
99 | 116 |
MaxButtonClick(sender, e); |
100 |
|
|
101 |
e.Handled = true; |
|
102 | 117 |
} |
103 |
else if (e.LeftButton == MouseButtonState.Pressed) |
|
104 |
{ |
|
105 |
sender.ForWindowFromTemplate(w => w.DragMove()); |
|
118 |
//else if (e.LeftButton == MouseButtonState.Pressed) |
|
119 |
//{ |
|
106 | 120 |
|
107 |
e.Handled = true; |
|
108 |
} |
|
121 |
// sender.ForWindowFromTemplate(w => w.DragMove()); |
|
122 |
// //e.Handled = true; |
|
123 |
//} |
|
109 | 124 |
} |
110 | 125 |
|
111 | 126 |
void TitleBarMouseMove(object sender, MouseEventArgs e) |
112 | 127 |
{ |
113 | 128 |
if (e.LeftButton == MouseButtonState.Pressed) |
114 | 129 |
{ |
115 |
sender.ForWindowFromTemplate(w => |
|
130 |
sender.ForWindowFromTemplate(w =>w.DragMove()); |
|
131 |
} |
|
132 |
// sender.ForWindowFromTemplate(w => |
|
133 |
// { |
|
134 |
// if (w.WindowState == WindowState.Maximized) |
|
135 |
// { |
|
136 |
// try |
|
137 |
// { |
|
138 |
// w.BeginInit(); |
|
139 |
// double adjustment = 40.0; |
|
140 |
|
|
141 |
// var mouse1 = GetScreenMousePoint(); |
|
142 |
|
|
143 |
// //var mouse1 = e.MouseDevice.GetPosition(w); |
|
144 |
|
|
145 |
// System.Diagnostics.Debug.WriteLine(mouse1.X + " + " + mouse1.Y); |
|
146 |
|
|
147 |
// var width1 = Math.Max(w.ActualWidth - 2 * adjustment, adjustment); |
|
148 |
// w.WindowState = WindowState.Normal; |
|
149 |
// var width2 = Math.Max(w.ActualWidth - 2 * adjustment, adjustment); |
|
150 |
// w.Left = mouse1.X - width1; |
|
151 |
// w.Top = mouse1.Y; |
|
152 |
// w.EndInit(); |
|
153 |
// w.DragMove(); |
|
154 |
// } |
|
155 |
// catch (Exception ex) |
|
156 |
// { |
|
157 |
// } |
|
158 |
// } |
|
159 |
// else |
|
160 |
// { |
|
161 |
// w.DragMove(); |
|
162 |
// } |
|
163 |
// }); |
|
164 |
//} |
|
165 |
} |
|
166 |
|
|
167 |
private Point GetScreenMousePoint() |
|
168 |
{ |
|
169 |
Point result = new Point(); |
|
170 |
|
|
171 |
//first get all the screens |
|
172 |
System.Drawing.Rectangle ret; |
|
173 |
|
|
174 |
var mousePosition = System.Windows.Forms.Cursor.Position; |
|
175 |
|
|
176 |
for (int i = 1; i <= System.Windows.Forms.Screen.AllScreens.Count(); i++) |
|
177 |
{ |
|
178 |
ret = System.Windows.Forms.Screen.AllScreens[i - 1].Bounds; |
|
179 |
|
|
180 |
if (ret.Contains(mousePosition)) |
|
116 | 181 |
{ |
117 |
if (w.WindowState == WindowState.Maximized) |
|
118 |
{ |
|
119 |
w.BeginInit(); |
|
120 |
double adjustment = 40.0; |
|
121 |
var mouse1 = e.MouseDevice.GetPosition(w); |
|
122 |
|
|
123 |
System.Diagnostics.Debug.WriteLine(mouse1.X + " + " + mouse1.Y); |
|
124 |
|
|
125 |
var width1 = Math.Max(w.ActualWidth - 2 * adjustment, adjustment); |
|
126 |
w.WindowState = WindowState.Normal; |
|
127 |
var width2 = Math.Max(w.ActualWidth - 2 * adjustment, adjustment); |
|
128 |
w.Left = (mouse1.X - adjustment) * (1 - width2 / width1); |
|
129 |
w.Top = -7; |
|
130 |
w.EndInit(); |
|
131 |
w.DragMove(); |
|
132 |
} |
|
133 |
}); |
|
182 |
return new Point(mousePosition.X, mousePosition.Y); |
|
183 |
} |
|
134 | 184 |
} |
185 |
|
|
186 |
return result; |
|
135 | 187 |
} |
136 | 188 |
|
137 | 189 |
#endregion |
KCOM/MainWindow.xaml.cs | ||
---|---|---|
181 | 181 |
// UserID = "H2011357", |
182 | 182 |
// //UserID = "H2009115", |
183 | 183 |
// //Mode = 0 , 1 , 2 |
184 |
//}; |
|
184 |
//};0
|
|
185 | 185 |
|
186 | 186 |
//this.dzMainMenu.ServiceOn(); |
187 | 187 |
//this.dzMainMenu.SetView(App.ViewInfo); |
KCOM/Resources/WindowStyle.xaml | ||
---|---|---|
8 | 8 |
<SolidColorBrush x:Key="VS2012WindowBorderBrushInactive" Color="#999999" /> |
9 | 9 |
<SolidColorBrush x:Key="VS2012WindowStatusForeground" Color="#FFFFFF" /> |
10 | 10 |
<SolidColorBrush x:Key="VS2012WindowStatusForegroundInactive" Color="#FFFFFF" /> |
11 |
|
|
11 |
<Visibility x:Key="GripVisible">Visible</Visibility> |
|
12 | 12 |
<Style x:Key="VS2012WindowStyleTitleBarButton" TargetType="{x:Type Button}"> |
13 | 13 |
<Setter Property="Focusable" Value="false" /> |
14 | 14 |
<Setter Property="Foreground" Value="White"/> |
... | ... | |
209 | 209 |
x:Name="lnSizeEast" |
210 | 210 |
Stroke="Transparent" |
211 | 211 |
HorizontalAlignment="Right" |
212 |
Cursor="SizeWE" |
|
212 |
Cursor="SizeWE"
|
|
213 | 213 |
X1="{TemplateBinding ActualWidth}" X2="{TemplateBinding ActualWidth}" Y1="1" Y2="{TemplateBinding ActualHeight}" |
214 | 214 |
StrokeThickness="3" |
215 | 215 |
/> |
내보내기 Unified diff