private void RegisterSylte( SelectorCategory cate, Image image, string text, Color lineColor, int lineWidth, DashStyle lineDashStyle ) { cate.AddLabel( image, text, () => SetLineStyle(lineColor, lineWidth, lineDashStyle) ); }
private void SetDeepSolidStyle( SelectorCategory cate, Image image, string text, Color color, Color borderColor ) { cate.AddLabel( image, text, () => { SetStyle( Color.White, new SolidBrushDescription(color), true, borderColor, 2, DashStyle.Solid ); } ); }
private void SetHollowStyle( SelectorCategory cate, Image image, string text, Color borderColor ) { cate.AddLabel( image, text, () => { SetStyle( Color.Black, null, true, borderColor, 2, DashStyle.Solid ); } ); }
private void SetDeepGradientStyle( SelectorCategory cate, Image image, string text, Color color1, Color color2, Color borderColor ) { cate.AddLabel( image, text, () => { SetStyle( Color.White, new GradientBrushDescription(color1, color2, 90f), true, borderColor, 1, DashStyle.Solid ); } ); }
private void AddTool( SelectorCategory cate, Image image, string text, ITool tool ) { cate.AddLabel( image, text, () => { if (_form.EditorCanvas != null) { _form.EditorCanvas.Tool = tool; Hide(); _form.Activate(); _form.EditorCanvas.Select(); } } ); }
private void AddFreehand( SelectorCategory cate, Image image, string text, int width, Color color ) { AddTool( cate, image, text, new FreehandTool( null, new DelegatingModelFactory <MemoFreehand>( () => MemoFactory.CreateFreehand() ), width, color ) ); }
// ======================================== // property // ======================================== // ======================================== // method // ======================================== public void Prepare() { if (_isPrepared) { return; } SuspendLayout(); var style = new SelectorCategory("スタイル"); style.BackColor = Color.White; style.LabelSize = new Size(20, 20); style.MaxCols = 9; var black = Color.Black; /// 0, 0, 0 var gray = Color.DimGray; /// 105, 105, 105 var blue = Color.FromArgb(75, 125, 190); var red = Color.FromArgb(190, 75, 70); var green = Color.FromArgb(150, 185, 85); var purple = Color.FromArgb(125, 95, 160); var aqua = Color.FromArgb(70, 170, 200); var orange = Color.FromArgb(245, 145, 65); var yellow = Color.FromArgb(250, 210, 80); /// 細,実線 RegisterSylte( style, Resources.line_style_black_thin, "細黒実線", black, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_gray_thin, "細灰実線", gray, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_blue_thin, "細青実線", blue, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_red_thin, "細赤実線", red, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_green_thin, "細緑実線", green, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_purple_thin, "細紫実線", purple, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_aqua_thin, "細水色実線", aqua, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_orange_thin, "細オレンジ実線", orange, 1, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_yellow_thin, "細黄実線", yellow, 1, DashStyle.Solid ); /// 中実線 RegisterSylte( style, Resources.line_style_black_middle, "中黒実線", black, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_gray_middle, "中灰実線", gray, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_blue_middle, "中青実線", blue, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_red_middle, "中赤実線", red, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_green_middle, "中緑実線", green, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_purple_middle, "中紫実線", purple, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_aqua_middle, "中水色実線", aqua, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_orange_middle, "中オレンジ実線", orange, 2, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_yellow_middle, "中黄実線", yellow, 2, DashStyle.Solid ); /// 太実線 RegisterSylte( style, Resources.line_style_black_thick, "太黒実線", black, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_gray_thick, "太灰実線", gray, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_blue_thick, "太青実線", blue, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_red_thick, "太赤実線", red, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_green_thick, "太緑実線", green, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_purple_thick, "太紫実線", purple, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_aqua_thick, "太水色実線", aqua, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_orange_thick, "太オレンジ実線", orange, 3, DashStyle.Solid ); RegisterSylte( style, Resources.line_style_yellow_thick, "太黄実線", yellow, 3, DashStyle.Solid ); /// 細,点線 RegisterSylte( style, Resources.line_style_black_thin_dash, "細黒点線", black, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_gray_thin_dash, "細灰点線", gray, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_blue_thin_dash, "細青点線", blue, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_red_thin_dash, "細赤点線", red, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_green_thin_dash, "細緑点線", green, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_purple_thin_dash, "細紫点線", purple, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_aqua_thin_dash, "細水色点線", aqua, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_orange_thin_dash, "細オレンジ点線", orange, 1, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_yellow_thin_dash, "細黄点線", yellow, 1, DashStyle.Dash ); /// 中点線 RegisterSylte( style, Resources.line_style_black_middle_dash, "中黒点線", black, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_gray_middle_dash, "中灰点線", gray, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_blue_middle_dash, "中青点線", blue, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_red_middle_dash, "中赤点線", red, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_green_middle_dash, "中緑点線", green, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_purple_middle_dash, "中紫点線", purple, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_aqua_middle_dash, "中水色点線", aqua, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_orange_middle_dash, "中オレンジ点線", orange, 2, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_yellow_middle_dash, "中黄点線", yellow, 2, DashStyle.Dash ); /// 太点線 RegisterSylte( style, Resources.line_style_black_thick_dash, "太黒点線", black, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_gray_thick_dash, "太灰点線", gray, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_blue_thick_dash, "太青点線", blue, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_red_thick_dash, "太赤点線", red, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_green_thick_dash, "太緑点線", green, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_purple_thick_dash, "太紫点線", purple, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_aqua_thick_dash, "太水色点線", aqua, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_orange_thick_dash, "太オレンジ点線", orange, 3, DashStyle.Dash ); RegisterSylte( style, Resources.line_style_yellow_thick_dash, "太黄点線", yellow, 3, DashStyle.Dash ); AddCategory(style); ResumeLayout(); _isPrepared = true; }
// ======================================== // property // ======================================== // ======================================== // method // ======================================== public void Prepare() { if (_isPrepared) { return; } SuspendLayout(); var style = new SelectorCategory("スタイル"); style.LabelSize = new Size(36, 36); var yellowBorder = Color.FromArgb(250, 210, 80); var yellowLight1 = Color.FromArgb(255, 250, 210); var yellowLight2 = Color.FromArgb(255, 230, 160); var yellowDeep1 = Color.FromArgb(240, 200, 30); var yellowDeep2 = Color.FromArgb(230, 170, 0); SetHollowStyle( style, Resources.style_hollow_black, "太枠中抜黒", Color.Black ); SetHollowStyle( style, Resources.style_hollow_blue, "太枠中抜青", Color.FromArgb(75, 125, 190) ); SetHollowStyle( style, Resources.style_hollow_red, "太枠中抜赤", Color.FromArgb(190, 75, 70) ); SetHollowStyle( style, Resources.style_hollow_green, "太枠中抜緑", Color.FromArgb(150, 185, 85) ); SetHollowStyle( style, Resources.style_hollow_violet, "太枠中抜紫", Color.FromArgb(125, 95, 160) ); SetHollowStyle( style, Resources.style_hollow_sblue, "太枠中抜水色", Color.FromArgb(70, 170, 200) ); SetHollowStyle( style, Resources.style_hollow_orange, "太枠中抜オレンジ", Color.FromArgb(245, 145, 65) ); SetHollowStyle( style, Resources.style_hollow_yellow, "太枠中抜黄", yellowBorder ); SetLightSolidStyle( style, Resources.style_light_solid_black, "太枠淡色単色黒", Color.FromArgb(240, 240, 240), Color.Black ); SetLightSolidStyle( style, Resources.style_light_solid_blue, "太枠淡色単色青", Color.FromArgb(230, 240, 255), Color.FromArgb(75, 125, 190) ); SetLightSolidStyle( style, Resources.style_light_solid_red, "太枠淡色単色赤", Color.FromArgb(255, 230, 230), Color.FromArgb(190, 75, 70) ); SetLightSolidStyle( style, Resources.style_light_solid_green, "太枠淡色単色緑", Color.FromArgb(245, 255, 230), Color.FromArgb(150, 185, 85) ); SetLightSolidStyle( style, Resources.style_light_solid_violet, "太枠淡色単色紫", Color.FromArgb(240, 235, 250), Color.FromArgb(125, 95, 160) ); SetLightSolidStyle( style, Resources.style_light_solid_sblue, "太枠淡色単色水色", Color.FromArgb(230, 250, 255), Color.FromArgb(70, 170, 200) ); SetLightSolidStyle( style, Resources.style_light_solid_orange, "太枠淡色単色オレンジ", Color.FromArgb(255, 235, 220), Color.FromArgb(245, 145, 65) ); SetLightSolidStyle( style, Resources.style_light_solid_yellow, "太枠淡色単色黄", yellowLight1, yellowBorder ); SetDeepSolidStyle( style, Resources.style_deep_solid_black, "太枠濃色単色黒", Color.Black, Color.Black ); SetDeepSolidStyle( style, Resources.style_deep_solid_blue, "太枠濃色単色青", Color.FromArgb(45, 95, 150), Color.FromArgb(75, 125, 190) ); SetDeepSolidStyle( style, Resources.style_deep_solid_red, "太枠濃色単色赤", Color.FromArgb(155, 45, 40), Color.FromArgb(190, 75, 70) ); SetDeepSolidStyle( style, Resources.style_deep_solid_green, "太枠濃色単色緑", Color.FromArgb(120, 150, 55), Color.FromArgb(150, 185, 85) ); SetDeepSolidStyle( style, Resources.style_deep_solid_violet, "太枠濃色単色紫", Color.FromArgb(95, 65, 125), Color.FromArgb(125, 95, 160) ); SetDeepSolidStyle( style, Resources.style_deep_solid_sblue, "太枠濃色単色水色", Color.FromArgb(40, 135, 160), Color.FromArgb(70, 170, 200) ); SetDeepSolidStyle( style, Resources.style_deep_solid_orange, "太枠濃色単色オレンジ", Color.FromArgb(200, 110, 30), Color.FromArgb(245, 145, 65) ); SetDeepSolidStyle( style, Resources.style_deep_solid_yellow, "太枠濃色単色黄", yellowDeep2, yellowBorder ); SetLightGradientStyle( style, Resources.style_light_grad_black, "細枠淡色グラデーション黒", Color.FromArgb(240, 240, 240), Color.FromArgb(190, 190, 190), Color.Black ); SetLightGradientStyle( style, Resources.style_light_grad_blue, "細枠淡色グラデーション青", Color.FromArgb(230, 240, 255), Color.FromArgb(200, 220, 240), Color.FromArgb(75, 125, 190) ); SetLightGradientStyle( style, Resources.style_light_grad_red, "細枠淡色グラデーション赤", Color.FromArgb(255, 230, 230), Color.FromArgb(255, 160, 160), Color.FromArgb(190, 75, 70) ); SetLightGradientStyle( style, Resources.style_light_grad_green, "細枠淡色グラデーション緑", Color.FromArgb(245, 255, 230), Color.FromArgb(220, 255, 170), Color.FromArgb(150, 185, 85) ); SetLightGradientStyle( style, Resources.style_light_grad_violet, "細枠淡色グラデーション紫", Color.FromArgb(240, 235, 250), Color.FromArgb(200, 180, 230), Color.FromArgb(125, 95, 160) ); SetLightGradientStyle( style, Resources.style_light_grad_sblue, "細枠淡色グラデーション水色", Color.FromArgb(230, 250, 255), Color.FromArgb(160, 235, 255), Color.FromArgb(70, 170, 200) ); SetLightGradientStyle( style, Resources.style_light_grad_orange, "細枠淡色グラデーションオレンジ", Color.FromArgb(255, 235, 220), Color.FromArgb(255, 190, 135), Color.FromArgb(245, 145, 65) ); SetLightGradientStyle( style, Resources.style_light_grad_yellow, "細枠淡色グラデーション黄", yellowLight1, yellowLight2, yellowBorder ); SetDeepGradientStyle( style, Resources.style_deep_grad_black, "細枠濃色グラデーション黒", Color.FromArgb(100, 100, 100), Color.Black, Color.Black ); SetDeepGradientStyle( style, Resources.style_deep_grad_blue, "細枠濃色グラデーション青", Color.FromArgb(60, 125, 200), Color.FromArgb(45, 95, 150), Color.FromArgb(75, 125, 190) ); SetDeepGradientStyle( style, Resources.style_deep_grad_red, "細枠濃色グラデーション赤", Color.FromArgb(205, 60, 55), Color.FromArgb(155, 45, 40), Color.FromArgb(190, 75, 70) ); SetDeepGradientStyle( style, Resources.style_deep_grad_green, "細枠濃色グラデーション緑", Color.FromArgb(155, 200, 70), Color.FromArgb(120, 150, 55), Color.FromArgb(150, 185, 85) ); SetDeepGradientStyle( style, Resources.style_deep_grad_violet, "細枠濃色グラデーション紫", Color.FromArgb(125, 90, 170), Color.FromArgb(95, 65, 125), Color.FromArgb(125, 95, 160) ); SetDeepGradientStyle( style, Resources.style_deep_grad_sblue, "細枠濃色グラデーション水色", Color.FromArgb(50, 180, 215), Color.FromArgb(40, 135, 160), Color.FromArgb(70, 170, 200) ); SetDeepGradientStyle( style, Resources.style_deep_grad_orange, "細枠濃色グラデーションオレンジ", Color.FromArgb(255, 140, 40), Color.FromArgb(200, 110, 30), Color.FromArgb(245, 145, 65) ); SetDeepGradientStyle( style, Resources.style_deep_grad_yellow, "細枠濃色グラデーション黄", yellowDeep1, yellowDeep2, yellowBorder ); AddCategory(style); ResumeLayout(); _isPrepared = true; }
// ======================================== // property // ======================================== // ======================================== // method // ======================================== public void Prepare() { if (_isPrepared) { return; } SuspendLayout(); var operation = new SelectorCategory("操作"); { operation.LabelSize = new Size(36, 36); operation.BackColor = Color.White; operation.MaxCols = 5; var select = new SelectTool(); _defaultTool = select; operation.AddLabel( Resources.cursor24, "選択", () => { _form.EditorCanvas.Tool = select; Hide(); _form.Activate(); _form.EditorCanvas.Select(); } ); var remove = new EraserTool( editor => editor.Model is MemoFreehand ); operation.AddLabel( Resources.eraser24, "消しゴム", () => { _form.EditorCanvas.Tool = remove; Hide(); _form.Activate(); _form.EditorCanvas.Select(); } ); var dragSelect = new DragSelectTool( editor => editor.Model is MemoFreehand ); operation.AddLabel( Resources.drag_select24, "ドラッグ選択", () => { _form.EditorCanvas.SelectionManager.DeselectAll(); _form.EditorCanvas.Tool = dragSelect; Hide(); _form.Activate(); _form.EditorCanvas.Select(); } ); dragSelect.Finished += HandleDragSelectToolFinished; AddCategory(operation); } var thin = new SelectorCategory("ペン (細)"); { thin.LabelSize = new Size(36, 36); thin.BackColor = Color.White; thin.MaxCols = 5; AddFreehand(thin, Resources.black_thin, "黒 太さ1pt", 1, Color.Black); AddFreehand(thin, Resources.red_thin, "赤 太さ1pt", 1, Color.Red); AddFreehand(thin, Resources.blue_thin, "青 太さ1pt", 1, Color.Blue); AddFreehand(thin, Resources.green_thin, "緑 太さ1pt", 1, Color.Green); AddFreehand(thin, Resources.gray_thin, "灰色 太さ1pt", 1, Color.Gray); AddCategory(thin); } var middle = new SelectorCategory("ペン (中)"); { middle.LabelSize = new Size(36, 36); middle.BackColor = Color.White; middle.MaxCols = 5; AddFreehand(middle, Resources.black_middle, "黒 太さ2pt", 2, Color.Black); AddFreehand(middle, Resources.red_middle, "赤 太さ2pt", 2, Color.Red); AddFreehand(middle, Resources.blue_middle, "青 太さ2pt", 2, Color.Blue); AddFreehand(middle, Resources.green_middle, "緑 太さ2pt", 2, Color.Green); AddFreehand(middle, Resources.gray_middle, "灰色 太さ2pt", 2, Color.Gray); AddCategory(middle); } var thick = new SelectorCategory("ペン (太)"); { thick.LabelSize = new Size(36, 36); thick.BackColor = Color.White; thick.MaxCols = 5; AddFreehand(thick, Resources.black_thick, "黒 太さ4pt", 4, Color.Black); AddFreehand(thick, Resources.red_thick, "赤 太さ4pt", 4, Color.Red); AddFreehand(thick, Resources.blue_thick, "青 太さ4pt", 4, Color.Blue); AddFreehand(thick, Resources.green_thick, "緑 太さ4pt", 4, Color.Green); AddFreehand(thick, Resources.gray_thick, "灰色 太さ4pt", 4, Color.Gray); AddCategory(thick); } ResumeLayout(); _isPrepared = true; }