ChartEditorControl.cs 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066
  1. using System;
  2. using System.IO;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using FastReport.Utils;
  6. using FastReport.Data;
  7. using FastReport.DataVisualization.Charting;
  8. namespace FastReport.MSChart
  9. {
  10. internal partial class ChartEditorControl : UserControl
  11. {
  12. private MSChartObject chart;
  13. private bool updating;
  14. public event EventHandler Changed;
  15. public MSChartObject Chart
  16. {
  17. get { return chart; }
  18. set
  19. {
  20. chart = value;
  21. UpdateControls();
  22. }
  23. }
  24. public int ActivePageIndex
  25. {
  26. get { return pageControl1.ActivePageIndex; }
  27. set { pageControl1.ActivePageIndex = value; }
  28. }
  29. private Chart MSChart
  30. {
  31. get { return chart.Chart; }
  32. }
  33. private Report Report
  34. {
  35. get { return chart.Report; }
  36. }
  37. private ChartArea ChartArea
  38. {
  39. get { return MSChart.ChartAreas.FindByName(cbxChartArea.SelectedItem.ToString()); }
  40. }
  41. private Axis Axis
  42. {
  43. get { return cbxAxis.Items.Count == 0 ? null : ChartArea.Axes[cbxAxis.SelectedIndex]; }
  44. }
  45. private Grid Grid
  46. {
  47. get
  48. {
  49. if (cbxAxisGrid.SelectedIndex == 0)
  50. return Axis.MajorGrid;
  51. return Axis.MinorGrid;
  52. }
  53. }
  54. private TickMark Tick
  55. {
  56. get
  57. {
  58. if (cbxAxisTick.SelectedIndex == 0)
  59. return Axis.MajorTickMark;
  60. return Axis.MinorTickMark;
  61. }
  62. }
  63. private StripLine Strip
  64. {
  65. get
  66. {
  67. if (lbAxisStrips.SelectedIndex != -1)
  68. return Axis.StripLines[lbAxisStrips.SelectedIndex];
  69. return null;
  70. }
  71. }
  72. private CustomLabel CustomLabel
  73. {
  74. get
  75. {
  76. if (lbCustomLabels.SelectedIndex != -1)
  77. return Axis.CustomLabels[lbCustomLabels.SelectedIndex];
  78. return null;
  79. }
  80. }
  81. private Legend Legend
  82. {
  83. get
  84. {
  85. return MSChart.Legends.Count > 0 ? MSChart.Legends[0] : null;
  86. }
  87. }
  88. private Title Title
  89. {
  90. get
  91. {
  92. return MSChart.Titles.Count > 0 ? MSChart.Titles[0] : null;
  93. }
  94. }
  95. private void UpdateControls()
  96. {
  97. updating = true;
  98. #region Data tab
  99. // data source
  100. cbxDataSource.Items.Clear();
  101. cbxDataSource.Items.Add(Res.Get("Misc,None"));
  102. cbxDataSource.SelectedIndex = 0;
  103. foreach (Base c in Report.Dictionary.AllObjects)
  104. {
  105. DataSourceBase ds = c as DataSourceBase;
  106. if (ds != null && ds.Enabled)
  107. {
  108. cbxDataSource.Items.Add(ds.Alias);
  109. if (Chart.DataSource == ds)
  110. cbxDataSource.SelectedIndex = cbxDataSource.Items.Count - 1;
  111. }
  112. }
  113. // filter
  114. tbFilter.Text = Chart.Filter;
  115. // autoseries
  116. cbxAutoSeriesData.Report = Report;
  117. cbxAutoSeriesData.Text = Chart.AutoSeriesColumn;
  118. cbxAutoSeriesColor.Report = Report;
  119. cbxAutoSeriesColor.Text = Chart.AutoSeriesColor;
  120. cbxAutoSeriesSort.SelectedIndex = (int)Chart.AutoSeriesSortOrder;
  121. // align X values
  122. cbAlignXValues.Checked = Chart.AlignXValues;
  123. cbAutoSeriesForce.Checked = Chart.AutoSeriesForce;
  124. #endregion
  125. #region Appearance tab
  126. // back color
  127. cbxBackColor.Color = MSChart.BackColor;
  128. cbxSecondaryColor.Color = MSChart.BackSecondaryColor;
  129. cbxGradient.SelectedIndex = (int)MSChart.BackGradientStyle;
  130. cbxHatchStyle.SelectedIndex = (int)MSChart.BackHatchStyle;
  131. // border
  132. cbxBorderSkin.SelectedIndex = (int)MSChart.BorderSkin.SkinStyle;
  133. cbxBorderColor.Color = MSChart.BorderlineColor;
  134. cbxBorderStyle.SelectedIndex = (int)MSChart.BorderlineDashStyle;
  135. udBorderWidth.Value = MSChart.BorderlineWidth;
  136. // palette
  137. cbxSeriesPalette.SelectedIndex = (int)MSChart.Palette;
  138. #endregion
  139. #region Legend tab
  140. if (Legend == null)
  141. pgLegend.Enabled = false;
  142. else
  143. {
  144. pgLegend.Enabled = true;
  145. cbLegendEnabled.Checked = Legend.Enabled;
  146. cbxLegendStyle.SelectedIndex = (int)Legend.LegendStyle;
  147. UpdateLegendDockButtons();
  148. cbLegendInsideChartArea.Checked = Legend.IsDockedInsideChartArea &&
  149. Legend.DockedToChartArea == "Default";
  150. cbxLegendBackColor.Color = Legend.BackColor;
  151. cbxLegendSecondaryColor.Color = Legend.BackSecondaryColor;
  152. cbxLegendGradient.SelectedIndex = (int)Legend.BackGradientStyle;
  153. cbxLegendHatchStyle.SelectedIndex = (int)Legend.BackHatchStyle;
  154. cbxLegendBorderColor.Color = Legend.BorderColor;
  155. cbxLegendBorderStyle.SelectedIndex = (int)Legend.BorderDashStyle;
  156. udLegendBorderWidth.Value = Legend.BorderWidth;
  157. cbxLegendShadowColor.Color = Legend.ShadowColor;
  158. udLegendShadowOffset.Value = Legend.ShadowOffset;
  159. tbLegendFont.Text = Converter.ToString(Legend.Font);
  160. cbxLegendForeColor.Color = Legend.ForeColor;
  161. }
  162. #endregion
  163. #region Title tab
  164. if (Title == null)
  165. pgTitle.Enabled = false;
  166. else
  167. {
  168. pgTitle.Enabled = true;
  169. cbTitleVisible.Checked = Title.Visible;
  170. tbTitleText.Text = Title.Text;
  171. cbxTitleTextOrientation.SelectedIndex = (int)Title.TextOrientation;
  172. cbxTitleTextStyle.SelectedIndex = (int)Title.TextStyle;
  173. UpdateTitleDockButtons();
  174. cbTitleInsideChartArea.Checked = Title.IsDockedInsideChartArea &&
  175. Title.DockedToChartArea == "Default";
  176. cbxTitleBackColor.Color = Title.BackColor;
  177. cbxTitleSecondaryColor.Color = Title.BackSecondaryColor;
  178. cbxTitleGradient.SelectedIndex = (int)Title.BackGradientStyle;
  179. cbxTitleHatchStyle.SelectedIndex = (int)Title.BackHatchStyle;
  180. cbxTitleBorderColor.Color = Title.BorderColor;
  181. cbxTitleBorderStyle.SelectedIndex = (int)Title.BorderDashStyle;
  182. udTitleBorderWidth.Value = Title.BorderWidth;
  183. cbxTitleShadowColor.Color = Title.ShadowColor;
  184. udTitleShadowOffset.Value = Title.ShadowOffset;
  185. tbTitleFont.Text = Converter.ToString(Title.Font);
  186. cbxTitleForeColor.Color = Title.ForeColor;
  187. }
  188. #endregion
  189. updating = false;
  190. }
  191. private void UpdateLegendDockButtons()
  192. {
  193. Button[] dockButtons = new Button[] {
  194. btnL1, btnL2, btnL3, btnL4, btnL5, btnL6, btnL7, btnL8, btnL9, btnL10, btnL11, btnL12 };
  195. int activeBtnTag = (int)Legend.Docking * 3 + (int)Legend.Alignment;
  196. foreach (Button btn in dockButtons)
  197. {
  198. btn.BackColor = int.Parse(btn.Tag.ToString()) == activeBtnTag ?
  199. Color.Orange : SystemColors.ButtonFace;
  200. }
  201. }
  202. private void UpdateTitleDockButtons()
  203. {
  204. Button[] dockButtons = new Button[] {
  205. btnT1, btnT2, btnT3, btnT4, btnT5, btnT6, btnT7, btnT8, btnT9, btnT10, btnT11, btnT12 };
  206. int titleAlign = 0;
  207. switch (Title.Alignment)
  208. {
  209. case ContentAlignment.TopLeft:
  210. case ContentAlignment.MiddleLeft:
  211. case ContentAlignment.BottomLeft:
  212. titleAlign = 0;
  213. break;
  214. case ContentAlignment.TopCenter:
  215. case ContentAlignment.MiddleCenter:
  216. case ContentAlignment.BottomCenter:
  217. titleAlign = 1;
  218. break;
  219. case ContentAlignment.TopRight:
  220. case ContentAlignment.MiddleRight:
  221. case ContentAlignment.BottomRight:
  222. titleAlign = 2;
  223. break;
  224. }
  225. int activeBtnTag = (int)Title.Docking * 3 + titleAlign;
  226. foreach (Button btn in dockButtons)
  227. {
  228. btn.BackColor = int.Parse(btn.Tag.ToString()) == activeBtnTag ?
  229. Color.Orange : SystemColors.ButtonFace;
  230. }
  231. }
  232. private void UpdateChartAreaControls()
  233. {
  234. updating = true;
  235. // appearance
  236. cbxAreaBackColor.Color = ChartArea.BackColor;
  237. cbxAreaSecondaryColor.Color = ChartArea.BackSecondaryColor;
  238. cbxAreaGradient.SelectedIndex = (int)ChartArea.BackGradientStyle;
  239. cbxAreaHatchStyle.SelectedIndex = (int)ChartArea.BackHatchStyle;
  240. cbxAreaBorderColor.Color = ChartArea.BorderColor;
  241. cbxAreaBorderStyle.SelectedIndex = (int)ChartArea.BorderDashStyle;
  242. udAreaBorderWidth.Value = ChartArea.BorderWidth;
  243. cbxAreaShadowColor.Color = ChartArea.ShadowColor;
  244. udAreaShadowOffset.Value = ChartArea.ShadowOffset;
  245. // 3d
  246. cb3DEnable.Checked = ChartArea.Area3DStyle.Enable3D;
  247. trb3DXRotation.Value = ChartArea.Area3DStyle.Inclination;
  248. ud3DXRotation.Value = ChartArea.Area3DStyle.Inclination;
  249. trb3DYRotation.Value = ChartArea.Area3DStyle.Rotation;
  250. ud3DYRotation.Value = ChartArea.Area3DStyle.Rotation;
  251. trb3DPerspective.Value = ChartArea.Area3DStyle.Perspective;
  252. ud3DPerspective.Value = ChartArea.Area3DStyle.Perspective;
  253. ud3DWallWidth.Value = ChartArea.Area3DStyle.WallWidth;
  254. ud3DAxisDepth.Value = ChartArea.Area3DStyle.PointDepth;
  255. cbx3DLightStyle.SelectedIndex = (int)ChartArea.Area3DStyle.LightStyle;
  256. cb3DClustered.Checked = ChartArea.Area3DStyle.IsClustered;
  257. updating = false;
  258. UpdateAxes();
  259. }
  260. private void UpdateAxisControls()
  261. {
  262. updating = true;
  263. #region General tab
  264. cbAxisEnabled.Checked = Axis.Enabled != AxisEnabled.False;
  265. cbAxisMargin.Checked = Axis.IsMarginVisible;
  266. cbAxisLogarithmic.Checked = Axis.IsLogarithmic;
  267. cbAxisReversed.Checked = Axis.IsReversed;
  268. udAxisInterval.Value = (decimal)Axis.Interval;
  269. cbxAxisIntervalType.SelectedIndex = (int)Axis.IntervalType;
  270. cbxAxisLineColor.Color = Axis.LineColor;
  271. cbxAxisLineStyle.SelectedIndex = (int)Axis.LineDashStyle;
  272. udAxisLineWidth.Value = Axis.LineWidth;
  273. cbAxisInterlaced.Checked = Axis.IsInterlaced;
  274. cbxAxisInterlacedColor.Color = Axis.InterlacedColor;
  275. #endregion
  276. #region Labels tab
  277. cbAxisLabelEnabled.Checked = Axis.LabelStyle.Enabled;
  278. tbAxisLabelFormat.Text = Axis.LabelStyle.Format;
  279. tbAxisLabelFont.Text = Converter.ToString(Axis.LabelStyle.Font);
  280. cbxAxisLabelForeColor.Color = Axis.LabelStyle.ForeColor;
  281. udAxisLabelAngle.Value = Axis.LabelStyle.Angle;
  282. tbAxisTitleText.Text = Axis.Title;
  283. tbAxisTitleFont.Text = Converter.ToString(Axis.TitleFont);
  284. cbxAxisTitleForeColor.Color = Axis.TitleForeColor;
  285. #endregion
  286. #region Grid tab
  287. cbxAxisGrid.SelectedIndex = 0;
  288. #endregion
  289. #region Ticks tab
  290. cbxAxisTick.SelectedIndex = 0;
  291. #endregion
  292. #region Custom labels tab
  293. lbCustomLabels.Items.Clear();
  294. foreach (CustomLabel label in Axis.CustomLabels)
  295. {
  296. lbCustomLabels.Items.Add(Res.Get("Forms,ChartEditor,ChartEditorControl,Axes,CustomLabels,Label"));
  297. }
  298. if (lbCustomLabels.Items.Count > 0)
  299. lbCustomLabels.SelectedIndex = 0;
  300. #endregion
  301. #region Strips tab
  302. lbAxisStrips.Items.Clear();
  303. foreach (StripLine strip in Axis.StripLines)
  304. {
  305. lbAxisStrips.Items.Add(Res.Get("Forms,ChartEditor,ChartEditorControl,Axes,Strips,Strip"));
  306. }
  307. if (lbAxisStrips.Items.Count > 0)
  308. lbAxisStrips.SelectedIndex = 0;
  309. #endregion
  310. updating = false;
  311. btnCopyFromXAxis.Visible = cbxAxis.SelectedIndex == 1;
  312. btnCopyFromPrimaryAxis.Visible = cbxAxis.SelectedIndex > 1;
  313. UpdateAxisGridControls();
  314. UpdateAxisTickControls();
  315. UpdateAxisStripControls();
  316. UpdateAxisCustomLabels();
  317. }
  318. private void UpdateAxisGridControls()
  319. {
  320. updating = true;
  321. cbAxisGridEnabled.Checked = Grid.Enabled;
  322. cbxAxisGridLineColor.Color = Grid.LineColor;
  323. cbxAxisGridLineStyle.SelectedIndex = (int)Grid.LineDashStyle;
  324. udAxisGridLineWidth.Value = Grid.LineWidth;
  325. updating = false;
  326. }
  327. private void UpdateAxisTickControls()
  328. {
  329. updating = true;
  330. cbAxisTickEnabled.Checked = Tick.Enabled;
  331. cbxAxisTickStyle.SelectedIndex = (int)Tick.TickMarkStyle;
  332. udAxisTickSize.Value = (decimal)Tick.Size;
  333. cbxAxisTickLineColor.Color = Tick.LineColor;
  334. cbxAxisTickLineStyle.SelectedIndex = (int)Tick.LineDashStyle;
  335. udAxisTickLineWidth.Value = Tick.LineWidth;
  336. updating = false;
  337. }
  338. private void UpdateAxisStripControls()
  339. {
  340. updating = true;
  341. if (Strip == null)
  342. tabStripSettings.Enabled = false;
  343. else
  344. {
  345. tabStripSettings.Enabled = true;
  346. udStripStart.Value = (decimal)Strip.IntervalOffset;
  347. udStripWidth.Value = (decimal)Strip.StripWidth;
  348. udStripInterval.Value = (decimal)Strip.Interval;
  349. cbxStripStartType.SelectedIndex = (int)Strip.IntervalOffsetType;
  350. cbxStripWidthType.SelectedIndex = (int)Strip.StripWidthType;
  351. cbxStripIntervalType.SelectedIndex = (int)Strip.IntervalType;
  352. cbxStripBackColor.Color = Strip.BackColor;
  353. cbxStripSecondaryColor.Color = Strip.BackSecondaryColor;
  354. cbxStripGradient.SelectedIndex = (int)Strip.BackGradientStyle;
  355. cbxStripHatchStyle.SelectedIndex = (int)Strip.BackHatchStyle;
  356. cbxStripBorderColor.Color = Strip.BorderColor;
  357. cbxStripBorderStyle.SelectedIndex = (int)Strip.BorderDashStyle;
  358. udStripBorderWidth.Value = Strip.BorderWidth;
  359. tbStripText.Text = Strip.Text;
  360. tbStripTextFont.Text = Converter.ToString(Strip.Font);
  361. cbxStripTextForeColor.Color = Strip.ForeColor;
  362. cbxStripTextHorzAlign.SelectedIndex = (int)Strip.TextAlignment;
  363. cbxStripTextVertAlign.SelectedIndex = (int)Strip.TextLineAlignment;
  364. cbxStripTextOrientation.SelectedIndex = (int)Strip.TextOrientation;
  365. }
  366. updating = false;
  367. }
  368. private void UpdateAxisCustomLabels()
  369. {
  370. updating = true;
  371. if (CustomLabel == null)
  372. pnCustomLabel.Enabled = false;
  373. else
  374. {
  375. pnCustomLabel.Enabled = true;
  376. tbCustomLabelText.Text = CustomLabel.Text;
  377. udCustomLabelStart.Value = (decimal)CustomLabel.FromPosition;
  378. udCustomLabelEnd.Value = (decimal)CustomLabel.ToPosition;
  379. udCustomLabelRow.Value = CustomLabel.RowIndex;
  380. cbxCustomLabelForeColor.Color = CustomLabel.ForeColor;
  381. cbxCustomLabelMarkColor.Color = CustomLabel.MarkColor;
  382. cbxCustomLabelMarkStyle.SelectedIndex = (int)CustomLabel.LabelMark;
  383. }
  384. updating = false;
  385. }
  386. public void UpdateChartAreas()
  387. {
  388. cbxChartArea.Items.Clear();
  389. foreach (ChartArea area in MSChart.ChartAreas)
  390. {
  391. cbxChartArea.Items.Add(area.Name);
  392. }
  393. cbxChartArea.SelectedIndex = 0;
  394. }
  395. private void UpdateAxes()
  396. {
  397. cbxAxis.Items.Clear();
  398. foreach (Axis axis in ChartArea.Axes)
  399. {
  400. cbxAxis.Items.Add(axis.Name);
  401. }
  402. pgAxes.Enabled = cbxAxis.Items.Count > 0;
  403. if (cbxAxis.Items.Count > 0)
  404. cbxAxis.SelectedIndex = 0;
  405. }
  406. private void OnChange()
  407. {
  408. if (Changed != null)
  409. Changed(this, EventArgs.Empty);
  410. }
  411. private void Init()
  412. {
  413. MyRes res = null;
  414. MyRes cmnRes = new MyRes("Forms,ChartEditor,Common");
  415. #region Comboboxes
  416. res = new MyRes("Forms,GroupBandEditor");
  417. cbxAutoSeriesSort.Items.Clear();
  418. cbxAutoSeriesSort.Items.AddRange(new string[] {
  419. res.Get("NoSort"), res.Get("Ascending"), res.Get("Descending") });
  420. cbxGradient.Items.Clear();
  421. cbxGradient.Items.AddRange(Enum.GetNames(typeof(GradientStyle)));
  422. cbxHatchStyle.Items.Clear();
  423. cbxHatchStyle.Items.AddRange(Enum.GetNames(typeof(ChartHatchStyle)));
  424. cbxBorderSkin.Items.Clear();
  425. cbxBorderSkin.Items.AddRange(Enum.GetNames(typeof(BorderSkinStyle)));
  426. cbxBorderStyle.Items.Clear();
  427. cbxBorderStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  428. cbxSeriesPalette.Items.Clear();
  429. cbxSeriesPalette.Items.AddRange(Enum.GetNames(typeof(ChartColorPalette)));
  430. lbTemplate.Items.Clear();
  431. lbTemplate.Items.AddRange(new string[] {
  432. "Custom", "Blue", "Gray", "Green", "Pink", "Sand", "Steel", "Light" });
  433. cbxAreaGradient.Items.Clear();
  434. cbxAreaGradient.Items.AddRange(Enum.GetNames(typeof(GradientStyle)));
  435. cbxAreaHatchStyle.Items.Clear();
  436. cbxAreaHatchStyle.Items.AddRange(Enum.GetNames(typeof(ChartHatchStyle)));
  437. cbxAreaBorderStyle.Items.Clear();
  438. cbxAreaBorderStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  439. cbx3DLightStyle.Items.Clear();
  440. cbx3DLightStyle.Items.AddRange(Enum.GetNames(typeof(LightStyle)));
  441. cbxAxisIntervalType.Items.Clear();
  442. cbxAxisIntervalType.Items.AddRange(Enum.GetNames(typeof(DateTimeIntervalType)));
  443. cbxAxisLineStyle.Items.Clear();
  444. cbxAxisLineStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  445. cbxCustomLabelMarkStyle.Items.Clear();
  446. cbxCustomLabelMarkStyle.Items.AddRange(Enum.GetNames(typeof(LabelMarkStyle)));
  447. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes");
  448. cbxAxisGrid.Items.Clear();
  449. cbxAxisGrid.Items.AddRange(new string[] {
  450. res.Get("Major"), res.Get("Minor") });
  451. cbxAxisTick.Items.Clear();
  452. cbxAxisTick.Items.AddRange(new string[] {
  453. res.Get("Major"), res.Get("Minor") });
  454. cbxAxisGridLineStyle.Items.Clear();
  455. cbxAxisGridLineStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  456. cbxAxisTickStyle.Items.Clear();
  457. cbxAxisTickStyle.Items.AddRange(Enum.GetNames(typeof(TickMarkStyle)));
  458. cbxAxisTickLineStyle.Items.Clear();
  459. cbxAxisTickLineStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  460. cbxStripStartType.Items.Clear();
  461. cbxStripStartType.Items.AddRange(Enum.GetNames(typeof(IntervalType)));
  462. cbxStripWidthType.Items.Clear();
  463. cbxStripWidthType.Items.AddRange(Enum.GetNames(typeof(IntervalType)));
  464. cbxStripIntervalType.Items.Clear();
  465. cbxStripIntervalType.Items.AddRange(Enum.GetNames(typeof(IntervalType)));
  466. cbxStripGradient.Items.Clear();
  467. cbxStripGradient.Items.AddRange(Enum.GetNames(typeof(GradientStyle)));
  468. cbxStripHatchStyle.Items.Clear();
  469. cbxStripHatchStyle.Items.AddRange(Enum.GetNames(typeof(ChartHatchStyle)));
  470. cbxStripBorderStyle.Items.Clear();
  471. cbxStripBorderStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  472. cbxStripTextOrientation.Items.Clear();
  473. cbxStripTextOrientation.Items.AddRange(Enum.GetNames(typeof(TextOrientation)));
  474. cbxStripTextHorzAlign.Items.Clear();
  475. cbxStripTextHorzAlign.Items.AddRange(Enum.GetNames(typeof(StringAlignment)));
  476. cbxStripTextVertAlign.Items.Clear();
  477. cbxStripTextVertAlign.Items.AddRange(Enum.GetNames(typeof(StringAlignment)));
  478. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Legend");
  479. cbxLegendStyle.Items.Clear();
  480. cbxLegendStyle.Items.AddRange(new string[] {
  481. res.Get("StyleColumn"), res.Get("StyleRow"), res.Get("StyleTable") });
  482. cbxLegendGradient.Items.Clear();
  483. cbxLegendGradient.Items.AddRange(Enum.GetNames(typeof(GradientStyle)));
  484. cbxLegendHatchStyle.Items.Clear();
  485. cbxLegendHatchStyle.Items.AddRange(Enum.GetNames(typeof(ChartHatchStyle)));
  486. cbxLegendBorderStyle.Items.Clear();
  487. cbxLegendBorderStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  488. cbxTitleTextOrientation.Items.Clear();
  489. cbxTitleTextOrientation.Items.AddRange(Enum.GetNames(typeof(TextOrientation)));
  490. cbxTitleTextStyle.Items.Clear();
  491. cbxTitleTextStyle.Items.AddRange(Enum.GetNames(typeof(TextStyle)));
  492. cbxTitleGradient.Items.Clear();
  493. cbxTitleGradient.Items.AddRange(Enum.GetNames(typeof(GradientStyle)));
  494. cbxTitleHatchStyle.Items.Clear();
  495. cbxTitleHatchStyle.Items.AddRange(Enum.GetNames(typeof(ChartHatchStyle)));
  496. cbxTitleBorderStyle.Items.Clear();
  497. cbxTitleBorderStyle.Items.AddRange(Enum.GetNames(typeof(ChartDashStyle)));
  498. #endregion
  499. #region Data
  500. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Data");
  501. pgData.Text = res.Get("");
  502. lblDataSource.Text = res.Get("DataSource");
  503. lblFilter.Text = res.Get("Filter");
  504. lblAutoSeries.Text = res.Get("AutoSeries");
  505. lblAutoSeriesData.Text = res.Get("DataColumn");
  506. lblAutoSeriesColor.Text = res.Get("ColorColumn");
  507. lblAutoSeriesSort.Text = res.Get("SeriesSort");
  508. cbAlignXValues.Text = res.Get("AlignXValues");
  509. cbAutoSeriesForce.Text = res.Get("ForceAutoSeries");
  510. #endregion
  511. #region Appearance
  512. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Appearance");
  513. pgAppearance.Text = res.Get("");
  514. lblTemplate.Text = res.Get("Template");
  515. btnLoadTemplate.Text = res.Get("Load");
  516. btnSaveTemplate.Text = res.Get("Save");
  517. lblSeriesPalette.Text = res.Get("SeriesPalette");
  518. lblBackColor.Text = cmnRes.Get("BackColor");
  519. lblSecondaryColor.Text = cmnRes.Get("SecondaryColor");
  520. lblGradient.Text = cmnRes.Get("Gradient");
  521. lblHatchStyle.Text = cmnRes.Get("HatchStyle");
  522. lblBorderSkin.Text = res.Get("BorderSkin");
  523. lblBorderColor.Text = cmnRes.Get("BorderColor");
  524. lblBorderStyle.Text = cmnRes.Get("BorderStyle");
  525. lblBorderWidth.Text = cmnRes.Get("BorderWidth");
  526. #endregion
  527. #region Chart area
  528. res = new MyRes("Forms,ChartEditor,ChartEditorControl,ChartArea");
  529. pgChartArea.Text = res.Get("");
  530. lblChartArea.Text = res.Get("Area");
  531. lblAreaBackColor.Text = cmnRes.Get("BackColor");
  532. lblAreaSecondaryColor.Text = cmnRes.Get("SecondaryColor");
  533. lblAreaGradient.Text = cmnRes.Get("Gradient");
  534. lblAreaHatchStyle.Text = cmnRes.Get("HatchStyle");
  535. lblAreaBorderColor.Text = cmnRes.Get("BorderColor");
  536. lblAreaBorderStyle.Text = cmnRes.Get("BorderStyle");
  537. lblAreaBorderWidth.Text = cmnRes.Get("BorderWidth");
  538. lblAreaShadowColor.Text = cmnRes.Get("ShadowColor");
  539. lblAreaShadowOffset.Text = cmnRes.Get("ShadowOffset");
  540. #endregion
  541. #region 3D
  542. res = new MyRes("Forms,ChartEditor,ChartEditorControl,ThreeD");
  543. pg3D.Text = res.Get("");
  544. cb3DEnable.Text = res.Get("Enable");
  545. lbl3DXRotation.Text = res.Get("XRotation");
  546. lbl3DYRotation.Text = res.Get("YRotation");
  547. lbl3DPerspective.Text = res.Get("Perspective");
  548. lbl3DWallWidth.Text = res.Get("WallWidth");
  549. lbl3DAxisDepth.Text = res.Get("AxisDepth");
  550. lbl3DLightStyle.Text = res.Get("LightStyle");
  551. cb3DClustered.Text = res.Get("ClusteredSeries");
  552. #endregion
  553. #region Axes
  554. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes");
  555. pgAxes.Text = res.Get("");
  556. lblAxis.Text = res.Get("Axis");
  557. btnCopyFromXAxis.Text = res.Get("CopyFromX");
  558. btnCopyFromPrimaryAxis.Text = res.Get("CopyFromPrimary");
  559. #region General
  560. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,General");
  561. tabAxisGeneral.Text = res.Get("");
  562. cbAxisEnabled.Text = res.Get("Enabled");
  563. cbAxisMargin.Text = res.Get("MarginVisible");
  564. cbAxisLogarithmic.Text = res.Get("Logarithmic");
  565. cbAxisReversed.Text = res.Get("Reversed");
  566. lblAxisInterval.Text = res.Get("Interval");
  567. lblAxisLineColor.Text = cmnRes.Get("LineColor");
  568. lblAxisLineStyle.Text = cmnRes.Get("LineStyle");
  569. lblAxisLineWidth.Text = cmnRes.Get("LineWidth");
  570. cbAxisInterlaced.Text = res.Get("Interlaced");
  571. lblAxisInterlaceColor.Text = res.Get("InterlacedColor");
  572. #endregion
  573. #region Labels
  574. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,Labels");
  575. tabAxisLabels.Text = res.Get("");
  576. cbAxisLabelEnabled.Text = res.Get("Enabled");
  577. lblAxisLabelFormat.Text = cmnRes.Get("Format");
  578. lblAxisLabelFont.Text = cmnRes.Get("Font");
  579. lblAxisLabelForeColor.Text = cmnRes.Get("ForeColor");
  580. lblAxisLabelAngle.Text = res.Get("Angle");
  581. #endregion
  582. #region Title
  583. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,Title");
  584. tabAxisTitle.Text = res.Get("");
  585. lblAxisTitleText.Text = cmnRes.Get("Text");
  586. lblAxisTitleFont.Text = cmnRes.Get("Font");
  587. lblAxisTitleForeColor.Text = cmnRes.Get("ForeColor");
  588. #endregion
  589. #region Custom labels
  590. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,CustomLabels");
  591. tabAxisCustomLabels.Text = res.Get("");
  592. lblCustomLabelText.Text = cmnRes.Get("Text");
  593. lblCustomLabelStart.Text = res.Get("Start");
  594. lblCustomLabelEnd.Text = res.Get("End");
  595. lblCustomLabelRow.Text = res.Get("Row");
  596. lblCustomLabelForeColor.Text = cmnRes.Get("ForeColor");
  597. lblCustomLabelMarkColor.Text = res.Get("MarkColor");
  598. lblCustomLabelMarkStyle.Text = res.Get("MarkStyle");
  599. #endregion
  600. #region Grid
  601. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,Grid");
  602. tabAxisGrid.Text = res.Get("");
  603. lblAxisGrid.Text = res.Get("GridLine");
  604. cbAxisGridEnabled.Text = res.Get("Enabled");
  605. lblAxisGridLineColor.Text = cmnRes.Get("LineColor");
  606. lblAxisGridLineStyle.Text = cmnRes.Get("LineStyle");
  607. lblAxisGridLineWidth.Text = cmnRes.Get("LineWidth");
  608. #endregion
  609. #region Ticks
  610. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,Ticks");
  611. tabAxisTicks.Text = res.Get("");
  612. lblAxisTick.Text = res.Get("Ticks");
  613. cbAxisTickEnabled.Text = res.Get("Enabled");
  614. lblAxisTickStyle.Text = res.Get("TickStyle");
  615. lblAxisTickSize.Text = res.Get("TickSize");
  616. lblAxisTickLineColor.Text = cmnRes.Get("LineColor");
  617. lblAxisTickLineStyle.Text = cmnRes.Get("LineStyle");
  618. lblAxisTickLineWidth.Text = cmnRes.Get("LineWidth");
  619. #endregion
  620. #region Strips
  621. tabAxisStrips.Text = Res.Get("Forms,ChartEditor,ChartEditorControl,Axes,Strips");
  622. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,Strips,Interval");
  623. tabStripInterval.Text = res.Get("");
  624. lblStripStart.Text = res.Get("Start");
  625. lblStripWidth.Text = res.Get("Width");
  626. lblStripInterval.Text = res.Get("Interval");
  627. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,Strips,Appearance");
  628. tabStripAppearance.Text = res.Get("");
  629. lblStripBackColor.Text = cmnRes.Get("BackColor");
  630. lblStripSecondaryColor.Text = cmnRes.Get("SecondaryColor");
  631. lblStripGradient.Text = cmnRes.Get("Gradient");
  632. lblStripHatchStyle.Text = cmnRes.Get("HatchStyle");
  633. lblStripBorderColor.Text = cmnRes.Get("BorderColor");
  634. lblStripBorderStyle.Text = cmnRes.Get("BorderStyle");
  635. lblStripBorderWidth.Text = cmnRes.Get("BorderWidth");
  636. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Axes,Strips,Text");
  637. tabStripText.Text = res.Get("");
  638. lblStripText.Text = cmnRes.Get("Text");
  639. lblStripFont.Text = cmnRes.Get("Font");
  640. lblStripTextForeColor.Text = cmnRes.Get("ForeColor");
  641. lblStripTextAlign.Text = res.Get("HorizontalAlign");
  642. lblStripLineAlign.Text = res.Get("VerticalAlign");
  643. lblStripTextOrientation.Text = res.Get("TextOrientation");
  644. #endregion
  645. #endregion
  646. #region Legend
  647. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Legend");
  648. pgLegend.Text = res.Get("");
  649. cbLegendEnabled.Text = res.Get("Enabled");
  650. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Legend,General");
  651. tabLegendGeneral.Text = res.Get("");
  652. lblLegendStyle.Text = res.Get("LegendStyle");
  653. lblLegendDock.Text = cmnRes.Get("Dock");
  654. cbLegendInsideChartArea.Text = cmnRes.Get("InsideChartArea");
  655. tabLegendAppearance.Text = Res.Get("Forms,ChartEditor,ChartEditorControl,Legend,Appearance");
  656. lblLegendBackColor.Text = cmnRes.Get("BackColor");
  657. lblLegendSecondaryColor.Text = cmnRes.Get("SecondaryColor");
  658. lblLegendGradient.Text = cmnRes.Get("Gradient");
  659. lblLegendHatchStyle.Text = cmnRes.Get("HatchStyle");
  660. lblLegendBorderColor.Text = cmnRes.Get("BorderColor");
  661. lblLegendBorderStyle.Text = cmnRes.Get("BorderStyle");
  662. lblLegendBorderWidth.Text = cmnRes.Get("BorderWidth");
  663. lblLegendShadowColor.Text = cmnRes.Get("ShadowColor");
  664. lblLegendShadowOffset.Text = cmnRes.Get("ShadowOffset");
  665. lblLegendFont.Text = cmnRes.Get("Font");
  666. lblLegendForeColor.Text = cmnRes.Get("ForeColor");
  667. #endregion
  668. #region Title
  669. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Title");
  670. pgTitle.Text = res.Get("");
  671. cbTitleVisible.Text = res.Get("Visible");
  672. res = new MyRes("Forms,ChartEditor,ChartEditorControl,Title,General");
  673. tabTitleGeneral.Text = res.Get("");
  674. lblTitleText.Text = cmnRes.Get("Text");
  675. lblTitleTextOrientation.Text = res.Get("TextOrientation");
  676. lblTitleTextStyle.Text = res.Get("TextStyle");
  677. lblTitleDock.Text = cmnRes.Get("Dock");
  678. cbTitleInsideChartArea.Text = cmnRes.Get("InsideChartArea");
  679. tabTitleAppearance.Text = Res.Get("Forms,ChartEditor,ChartEditorControl,Title,Appearance");
  680. lblTitleBackColor.Text = cmnRes.Get("BackColor");
  681. lblTitleSecondaryColor.Text = cmnRes.Get("SecondaryColor");
  682. lblTitleGradient.Text = cmnRes.Get("Gradient");
  683. lblTitleHatchStyle.Text = cmnRes.Get("HatchStyle");
  684. lblTitleBorderColor.Text = cmnRes.Get("BorderColor");
  685. lblTitleBorderStyle.Text = cmnRes.Get("BorderStyle");
  686. lblTitleBorderWidth.Text = cmnRes.Get("BorderWidth");
  687. lblTitleShadowColor.Text = cmnRes.Get("ShadowColor");
  688. lblTitleShadowOffset.Text = cmnRes.Get("ShadowOffset");
  689. lblTitleFont.Text = cmnRes.Get("Font");
  690. lblTitleForeColor.Text = cmnRes.Get("ForeColor");
  691. #endregion
  692. }
  693. public void UpdateDpiDependencies()
  694. {
  695. lbTemplate.ItemHeight = this.LogicalToDevice(14);
  696. tbFilter.Image = this.GetImage(52);
  697. tbAxisLabelFont.Image = this.GetImage(59);
  698. tbAxisTitleFont.Image = this.GetImage(59);
  699. tbStripTextFont.Image = this.GetImage(59);
  700. tbLegendFont.Image = this.GetImage(59);
  701. tbTitleFont.Image = this.GetImage(59);
  702. }
  703. public ChartEditorControl()
  704. {
  705. InitializeComponent();
  706. Init();
  707. }
  708. #region Data tab
  709. private void cbxDataSource_SelectedIndexChanged(object sender, EventArgs e)
  710. {
  711. if (updating)
  712. return;
  713. DataSourceBase ds = Report.GetDataSource((string)cbxDataSource.Items[cbxDataSource.SelectedIndex]);
  714. Chart.DataSource = ds;
  715. cbxAutoSeriesData.DataSource = ds;
  716. cbxAutoSeriesColor.DataSource = ds;
  717. OnChange();
  718. }
  719. private void tbFilter_ButtonClick(object sender, EventArgs e)
  720. {
  721. tbFilter.Text = Editors.EditExpression(Report, tbFilter.Text);
  722. }
  723. private void tbFilter_Leave(object sender, EventArgs e)
  724. {
  725. if (updating)
  726. return;
  727. Chart.Filter = tbFilter.Text;
  728. OnChange();
  729. }
  730. private void cbxAutoSeriesData_Leave(object sender, EventArgs e)
  731. {
  732. Chart.AutoSeriesColumn = cbxAutoSeriesData.Text;
  733. OnChange();
  734. }
  735. private void cbxAutoSeriesColor_Leave(object sender, EventArgs e)
  736. {
  737. Chart.AutoSeriesColor = cbxAutoSeriesColor.Text;
  738. OnChange();
  739. }
  740. private void cbxAutoSeriesSort_Leave(object sender, EventArgs e)
  741. {
  742. Chart.AutoSeriesSortOrder = (SortOrder)cbxAutoSeriesSort.SelectedIndex;
  743. OnChange();
  744. }
  745. private void cbAlignXValues_Leave(object sender, EventArgs e)
  746. {
  747. Chart.AlignXValues = cbAlignXValues.Checked;
  748. OnChange();
  749. }
  750. #endregion
  751. #region Appearance tab
  752. private void LoadTemplate(Stream stream)
  753. {
  754. using (Chart tempChart = new Chart())
  755. {
  756. tempChart.Serializer.Content = SerializationContents.All;
  757. tempChart.Serializer.Load(stream);
  758. Helper.AssignChartAppearance(MSChart, tempChart);
  759. }
  760. UpdateControls();
  761. OnChange();
  762. }
  763. private void lbTemplate_SelectedIndexChanged(object sender, EventArgs e)
  764. {
  765. if (updating || lbTemplate.SelectedIndex == 0)
  766. return;
  767. string templateName = (string)lbTemplate.SelectedItem;
  768. using (Stream stream = ResourceLoader.GetStream("MSChart." + templateName + ".xml"))
  769. {
  770. LoadTemplate(stream);
  771. }
  772. }
  773. private void lbTemplate_DrawItem(object sender, DrawItemEventArgs e)
  774. {
  775. e.DrawBackground();
  776. string item = lbTemplate.Items[e.Index].ToString();
  777. item = Res.Get("Forms,ChartEditor,ChartEditorControl,Appearance,Templates," + item);
  778. TextRenderer.DrawText(e.Graphics, item, e.Font, e.Bounds.Location, e.ForeColor);
  779. }
  780. private void btnLoadTemplate_Click(object sender, EventArgs e)
  781. {
  782. using (OpenFileDialog dialog = new OpenFileDialog())
  783. {
  784. dialog.Filter = Res.Get("FileFilters,XmlFile");
  785. if (dialog.ShowDialog() == DialogResult.OK)
  786. {
  787. using (FileStream stream = new FileStream(dialog.FileName, FileMode.Open, FileAccess.Read))
  788. {
  789. LoadTemplate(stream);
  790. }
  791. }
  792. }
  793. }
  794. private void btnSaveTemplate_Click(object sender, EventArgs e)
  795. {
  796. using (SaveFileDialog dialog = new SaveFileDialog())
  797. {
  798. dialog.Filter = Res.Get("FileFilters,XmlFile");
  799. if (dialog.ShowDialog() == DialogResult.OK)
  800. {
  801. MSChart.Serializer.Content = SerializationContents.All;
  802. MSChart.Serializer.Save(dialog.FileName);
  803. }
  804. }
  805. }
  806. private void cbxBackColor_ColorSelected(object sender, EventArgs e)
  807. {
  808. if (updating)
  809. return;
  810. MSChart.BackColor = cbxBackColor.Color;
  811. OnChange();
  812. }
  813. private void cbxSecondaryColor_ColorSelected(object sender, EventArgs e)
  814. {
  815. if (updating)
  816. return;
  817. MSChart.BackSecondaryColor = cbxSecondaryColor.Color;
  818. OnChange();
  819. }
  820. private void cbxGradient_SelectedIndexChanged(object sender, EventArgs e)
  821. {
  822. if (updating)
  823. return;
  824. MSChart.BackGradientStyle = (GradientStyle)cbxGradient.SelectedIndex;
  825. OnChange();
  826. }
  827. private void cbxHatchStyle_SelectedIndexChanged(object sender, EventArgs e)
  828. {
  829. if (updating)
  830. return;
  831. MSChart.BackHatchStyle = (ChartHatchStyle)cbxHatchStyle.SelectedIndex;
  832. OnChange();
  833. }
  834. private void cbxBorderSkin_SelectedIndexChanged(object sender, EventArgs e)
  835. {
  836. if (updating)
  837. return;
  838. MSChart.BorderSkin.SkinStyle = (BorderSkinStyle)cbxBorderSkin.SelectedIndex;
  839. OnChange();
  840. }
  841. private void cbxBorderColor_ColorSelected(object sender, EventArgs e)
  842. {
  843. if (updating)
  844. return;
  845. MSChart.BorderlineColor = cbxBorderColor.Color;
  846. OnChange();
  847. }
  848. private void cbxBorderStyle_SelectedIndexChanged(object sender, EventArgs e)
  849. {
  850. if (updating)
  851. return;
  852. MSChart.BorderlineDashStyle = (ChartDashStyle)cbxBorderStyle.SelectedIndex;
  853. OnChange();
  854. }
  855. private void udBorderWidth_ValueChanged(object sender, EventArgs e)
  856. {
  857. if (updating)
  858. return;
  859. MSChart.BorderlineWidth = (int)udBorderWidth.Value;
  860. OnChange();
  861. }
  862. private void cbxSeriesPalette_SelectedIndexChanged(object sender, EventArgs e)
  863. {
  864. if (updating)
  865. return;
  866. MSChart.Palette = (ChartColorPalette)cbxSeriesPalette.SelectedIndex;
  867. OnChange();
  868. }
  869. #endregion
  870. #region Chart area tab
  871. private void cbxChartArea_SelectedIndexChanged(object sender, EventArgs e)
  872. {
  873. if (updating)
  874. return;
  875. UpdateChartAreaControls();
  876. }
  877. private void cbxAreaBackColor_ColorSelected(object sender, EventArgs e)
  878. {
  879. if (updating)
  880. return;
  881. ChartArea.BackColor = cbxAreaBackColor.Color;
  882. OnChange();
  883. }
  884. private void cbxAreaSecondaryColor_ColorSelected(object sender, EventArgs e)
  885. {
  886. if (updating)
  887. return;
  888. ChartArea.BackSecondaryColor = cbxAreaSecondaryColor.Color;
  889. OnChange();
  890. }
  891. private void cbxAreaGradient_SelectedIndexChanged(object sender, EventArgs e)
  892. {
  893. if (updating)
  894. return;
  895. ChartArea.BackGradientStyle = (GradientStyle)cbxAreaGradient.SelectedIndex;
  896. OnChange();
  897. }
  898. private void cbxAreaHatchStyle_SelectedIndexChanged(object sender, EventArgs e)
  899. {
  900. if (updating)
  901. return;
  902. ChartArea.BackHatchStyle = (ChartHatchStyle)cbxAreaHatchStyle.SelectedIndex;
  903. OnChange();
  904. }
  905. private void cbxAreaBorderColor_ColorSelected(object sender, EventArgs e)
  906. {
  907. if (updating)
  908. return;
  909. ChartArea.BorderColor = cbxAreaBorderColor.Color;
  910. OnChange();
  911. }
  912. private void cbxAreaBorderStyle_SelectedIndexChanged(object sender, EventArgs e)
  913. {
  914. if (updating)
  915. return;
  916. ChartArea.BorderDashStyle = (ChartDashStyle)cbxAreaBorderStyle.SelectedIndex;
  917. OnChange();
  918. }
  919. private void udAreaBorderWidth_ValueChanged(object sender, EventArgs e)
  920. {
  921. if (updating)
  922. return;
  923. ChartArea.BorderWidth = (int)udAreaBorderWidth.Value;
  924. OnChange();
  925. }
  926. private void cbxAreaShadowColor_ColorSelected(object sender, EventArgs e)
  927. {
  928. if (updating)
  929. return;
  930. ChartArea.ShadowColor = cbxAreaShadowColor.Color;
  931. OnChange();
  932. }
  933. private void cbxAreaShadowOffset_ValueChanged(object sender, EventArgs e)
  934. {
  935. if (updating)
  936. return;
  937. ChartArea.ShadowOffset = (int)udAreaShadowOffset.Value;
  938. OnChange();
  939. }
  940. #endregion
  941. #region 3D tab
  942. private void cb3DEnable_CheckedChanged(object sender, EventArgs e)
  943. {
  944. if (updating)
  945. return;
  946. ChartArea.Area3DStyle.Enable3D = cb3DEnable.Checked;
  947. OnChange();
  948. }
  949. private void trb3DXRotation_ValueChanged(object sender, EventArgs e)
  950. {
  951. if (updating)
  952. return;
  953. updating = true;
  954. if (sender == trb3DXRotation)
  955. ud3DXRotation.Value = trb3DXRotation.Value;
  956. else
  957. trb3DXRotation.Value = (int)ud3DXRotation.Value;
  958. ChartArea.Area3DStyle.Inclination = trb3DXRotation.Value;
  959. updating = false;
  960. OnChange();
  961. }
  962. private void trb3DYRotation_ValueChanged(object sender, EventArgs e)
  963. {
  964. if (updating)
  965. return;
  966. updating = true;
  967. if (sender == trb3DYRotation)
  968. ud3DYRotation.Value = trb3DYRotation.Value;
  969. else
  970. trb3DYRotation.Value = (int)ud3DYRotation.Value;
  971. ChartArea.Area3DStyle.Rotation = trb3DYRotation.Value;
  972. updating = false;
  973. OnChange();
  974. }
  975. private void trb3DPerspective_ValueChanged(object sender, EventArgs e)
  976. {
  977. if (updating)
  978. return;
  979. updating = true;
  980. if (sender == trb3DPerspective)
  981. ud3DPerspective.Value = trb3DPerspective.Value;
  982. else
  983. trb3DPerspective.Value = (int)ud3DPerspective.Value;
  984. ChartArea.Area3DStyle.Perspective = trb3DPerspective.Value;
  985. updating = false;
  986. OnChange();
  987. }
  988. private void ud3DWallWidth_ValueChanged(object sender, EventArgs e)
  989. {
  990. if (updating)
  991. return;
  992. ChartArea.Area3DStyle.WallWidth = (int)ud3DWallWidth.Value;
  993. OnChange();
  994. }
  995. private void ud3DAxisDepth_ValueChanged(object sender, EventArgs e)
  996. {
  997. if (updating)
  998. return;
  999. ChartArea.Area3DStyle.PointDepth = (int)ud3DAxisDepth.Value;
  1000. OnChange();
  1001. }
  1002. private void cbx3DLightStyle_SelectedIndexChanged(object sender, EventArgs e)
  1003. {
  1004. if (updating)
  1005. return;
  1006. ChartArea.Area3DStyle.LightStyle = (LightStyle)cbx3DLightStyle.SelectedIndex;
  1007. OnChange();
  1008. }
  1009. private void cb3DClustered_CheckedChanged(object sender, EventArgs e)
  1010. {
  1011. if (updating)
  1012. return;
  1013. ChartArea.Area3DStyle.IsClustered = cb3DClustered.Checked;
  1014. OnChange();
  1015. }
  1016. #endregion
  1017. #region Axes tab
  1018. private void cbxAxis_SelectedIndexChanged(object sender, EventArgs e)
  1019. {
  1020. if (updating)
  1021. return;
  1022. UpdateAxisControls();
  1023. }
  1024. private void btnCopyFromXAxis_Click(object sender, EventArgs e)
  1025. {
  1026. Helper.AssignAxisAppearance(Axis, ChartArea.AxisX);
  1027. UpdateAxisControls();
  1028. OnChange();
  1029. }
  1030. private void btnCopyFromPrimaryAxis_Click(object sender, EventArgs e)
  1031. {
  1032. Axis primaryAxis = cbxAxis.SelectedIndex == 2 ? ChartArea.AxisX : ChartArea.AxisY;
  1033. Helper.AssignAxisAppearance(Axis, primaryAxis);
  1034. UpdateAxisControls();
  1035. OnChange();
  1036. }
  1037. #region General tab
  1038. private void cbAxisEnabled_CheckedChanged(object sender, EventArgs e)
  1039. {
  1040. if (updating)
  1041. return;
  1042. Axis.Enabled = cbAxisEnabled.Checked ? AxisEnabled.Auto : AxisEnabled.False;
  1043. OnChange();
  1044. }
  1045. private void cbAxisMargin_CheckedChanged(object sender, EventArgs e)
  1046. {
  1047. if (updating)
  1048. return;
  1049. Axis.IsMarginVisible = cbAxisMargin.Checked;
  1050. OnChange();
  1051. }
  1052. private void cbAxisLogarithmic_CheckedChanged(object sender, EventArgs e)
  1053. {
  1054. if (updating)
  1055. return;
  1056. Axis.IsLogarithmic = cbAxisLogarithmic.Checked;
  1057. OnChange();
  1058. }
  1059. private void cbAxisReversed_CheckedChanged(object sender, EventArgs e)
  1060. {
  1061. if (updating)
  1062. return;
  1063. Axis.IsReversed = cbAxisReversed.Checked;
  1064. OnChange();
  1065. }
  1066. private void udAxisInterval_ValueChanged(object sender, EventArgs e)
  1067. {
  1068. if (updating)
  1069. return;
  1070. Axis.Interval = (double)udAxisInterval.Value;
  1071. OnChange();
  1072. }
  1073. private void cbxAxisIntervalType_SelectedIndexChanged(object sender, EventArgs e)
  1074. {
  1075. if (updating)
  1076. return;
  1077. Axis.IntervalType = (DateTimeIntervalType)cbxAxisIntervalType.SelectedIndex;
  1078. OnChange();
  1079. }
  1080. private void cbAxisInterlaced_CheckedChanged(object sender, EventArgs e)
  1081. {
  1082. if (updating)
  1083. return;
  1084. Axis.IsInterlaced = cbAxisInterlaced.Checked;
  1085. OnChange();
  1086. }
  1087. private void cbxAxisLineColor_ColorSelected(object sender, EventArgs e)
  1088. {
  1089. if (updating)
  1090. return;
  1091. Axis.LineColor = cbxAxisLineColor.Color;
  1092. OnChange();
  1093. }
  1094. private void cbxAxisLineStyle_SelectedIndexChanged(object sender, EventArgs e)
  1095. {
  1096. if (updating)
  1097. return;
  1098. Axis.LineDashStyle = (ChartDashStyle)cbxAxisLineStyle.SelectedIndex;
  1099. OnChange();
  1100. }
  1101. private void udAxisLineWidth_ValueChanged(object sender, EventArgs e)
  1102. {
  1103. if (updating)
  1104. return;
  1105. Axis.LineWidth = (int)udAxisLineWidth.Value;
  1106. OnChange();
  1107. }
  1108. private void cbxAxisInterlacedColor_ColorSelected(object sender, EventArgs e)
  1109. {
  1110. if (updating)
  1111. return;
  1112. Axis.InterlacedColor = cbxAxisInterlacedColor.Color;
  1113. OnChange();
  1114. }
  1115. #endregion
  1116. #region Labels tab
  1117. private void cbAxisLabelEnabled_CheckedChanged(object sender, EventArgs e)
  1118. {
  1119. if (updating)
  1120. return;
  1121. Axis.LabelStyle.Enabled = cbAxisLabelEnabled.Checked;
  1122. OnChange();
  1123. }
  1124. private void tbAxisLabelFormat_Leave(object sender, EventArgs e)
  1125. {
  1126. if (updating)
  1127. return;
  1128. Axis.LabelStyle.Format = tbAxisLabelFormat.Text;
  1129. OnChange();
  1130. }
  1131. private void tbAxisLabelFont_ButtonClick(object sender, EventArgs e)
  1132. {
  1133. using (FontDialog dialog = new FontDialog())
  1134. {
  1135. dialog.Font = Axis.LabelStyle.Font;
  1136. if (dialog.ShowDialog() == DialogResult.OK)
  1137. {
  1138. Axis.LabelStyle.Font = dialog.Font;
  1139. tbAxisLabelFont.Text = Converter.ToString(dialog.Font);
  1140. OnChange();
  1141. }
  1142. }
  1143. }
  1144. private void cbxAxisLabelForeColor_ColorSelected(object sender, EventArgs e)
  1145. {
  1146. if (updating)
  1147. return;
  1148. Axis.LabelStyle.ForeColor = cbxAxisLabelForeColor.Color;
  1149. OnChange();
  1150. }
  1151. private void udAxisLabelAngle_ValueChanged(object sender, EventArgs e)
  1152. {
  1153. if (updating)
  1154. return;
  1155. Axis.LabelStyle.Angle = (int)udAxisLabelAngle.Value;
  1156. OnChange();
  1157. }
  1158. #endregion
  1159. #region Title tab
  1160. private void tbAxisTitleText_Leave(object sender, EventArgs e)
  1161. {
  1162. if (updating)
  1163. return;
  1164. Axis.Title = tbAxisTitleText.Text;
  1165. OnChange();
  1166. }
  1167. private void tbAxisTitleFont_ButtonClick(object sender, EventArgs e)
  1168. {
  1169. using (FontDialog dialog = new FontDialog())
  1170. {
  1171. dialog.Font = Axis.TitleFont;
  1172. if (dialog.ShowDialog() == DialogResult.OK)
  1173. {
  1174. Axis.TitleFont = dialog.Font;
  1175. tbAxisTitleFont.Text = Converter.ToString(dialog.Font);
  1176. OnChange();
  1177. }
  1178. }
  1179. }
  1180. private void cbxAxisTitleForeColor_ColorSelected(object sender, EventArgs e)
  1181. {
  1182. if (updating)
  1183. return;
  1184. Axis.TitleForeColor = cbxAxisTitleForeColor.Color;
  1185. OnChange();
  1186. }
  1187. #endregion
  1188. #region Custom labels tab
  1189. private void lbCustomLabels_SelectedIndexChanged(object sender, EventArgs e)
  1190. {
  1191. if (updating)
  1192. return;
  1193. UpdateAxisCustomLabels();
  1194. }
  1195. private void btnAddCustomLabel_Click(object sender, EventArgs e)
  1196. {
  1197. CustomLabel label = new CustomLabel();
  1198. Axis.CustomLabels.Add(label);
  1199. lbCustomLabels.Items.Add(Res.Get("Forms,ChartEditor,ChartEditorControl,Axes,CustomLabels,Label"));
  1200. lbCustomLabels.SelectedIndex = lbCustomLabels.Items.Count - 1;
  1201. OnChange();
  1202. }
  1203. private void btnDeleteCustomLabel_Click(object sender, EventArgs e)
  1204. {
  1205. int index = lbCustomLabels.SelectedIndex;
  1206. lbCustomLabels.Items.RemoveAt(index);
  1207. Axis.CustomLabels.RemoveAt(index);
  1208. if (index >= lbCustomLabels.Items.Count)
  1209. index--;
  1210. if (index >= 0)
  1211. lbCustomLabels.SelectedIndex = index;
  1212. OnChange();
  1213. }
  1214. private void tbCustomLabelText_Leave(object sender, EventArgs e)
  1215. {
  1216. if (updating)
  1217. return;
  1218. CustomLabel.Text = tbCustomLabelText.Text;
  1219. OnChange();
  1220. }
  1221. private void udCustomLabelStart_ValueChanged(object sender, EventArgs e)
  1222. {
  1223. if (updating)
  1224. return;
  1225. CustomLabel.FromPosition = (double)udCustomLabelStart.Value;
  1226. OnChange();
  1227. }
  1228. private void udCustomLabelEnd_ValueChanged(object sender, EventArgs e)
  1229. {
  1230. if (updating)
  1231. return;
  1232. CustomLabel.ToPosition = (double)udCustomLabelEnd.Value;
  1233. OnChange();
  1234. }
  1235. private void udCustomLabelRow_ValueChanged(object sender, EventArgs e)
  1236. {
  1237. if (updating)
  1238. return;
  1239. CustomLabel.RowIndex = (int)udCustomLabelRow.Value;
  1240. OnChange();
  1241. }
  1242. private void cbxCustomLabelForeColor_ColorSelected(object sender, EventArgs e)
  1243. {
  1244. if (updating)
  1245. return;
  1246. CustomLabel.ForeColor = cbxCustomLabelForeColor.Color;
  1247. OnChange();
  1248. }
  1249. private void cbxCustomLabelMarkColor_ColorSelected(object sender, EventArgs e)
  1250. {
  1251. if (updating)
  1252. return;
  1253. CustomLabel.MarkColor = cbxCustomLabelMarkColor.Color;
  1254. OnChange();
  1255. }
  1256. private void cbxCustomLabelMarkStyle_SelectedIndexChanged(object sender, EventArgs e)
  1257. {
  1258. if (updating)
  1259. return;
  1260. CustomLabel.LabelMark = (LabelMarkStyle)cbxCustomLabelMarkStyle.SelectedIndex;
  1261. OnChange();
  1262. }
  1263. #endregion
  1264. #region Grid tab
  1265. private void cbxAxisGrid_SelectedIndexChanged(object sender, EventArgs e)
  1266. {
  1267. if (updating)
  1268. return;
  1269. UpdateAxisGridControls();
  1270. }
  1271. private void cbAxisGridEnabled_CheckedChanged(object sender, EventArgs e)
  1272. {
  1273. if (updating)
  1274. return;
  1275. Grid.Enabled = cbAxisGridEnabled.Checked;
  1276. OnChange();
  1277. }
  1278. private void cbxAxisGridLineColor_ColorSelected(object sender, EventArgs e)
  1279. {
  1280. if (updating)
  1281. return;
  1282. Grid.LineColor = cbxAxisGridLineColor.Color;
  1283. OnChange();
  1284. }
  1285. private void cbxAxisGridLineStyle_SelectedIndexChanged(object sender, EventArgs e)
  1286. {
  1287. if (updating)
  1288. return;
  1289. Grid.LineDashStyle = (ChartDashStyle)cbxAxisGridLineStyle.SelectedIndex;
  1290. OnChange();
  1291. }
  1292. private void udAxisGridLineWidth_ValueChanged(object sender, EventArgs e)
  1293. {
  1294. if (updating)
  1295. return;
  1296. Grid.LineWidth = (int)udAxisGridLineWidth.Value;
  1297. OnChange();
  1298. }
  1299. #endregion
  1300. #region Ticks tab
  1301. private void cbxAxisTick_SelectedIndexChanged(object sender, EventArgs e)
  1302. {
  1303. if (updating)
  1304. return;
  1305. UpdateAxisTickControls();
  1306. }
  1307. private void cbAxisTickEnabled_CheckedChanged(object sender, EventArgs e)
  1308. {
  1309. if (updating)
  1310. return;
  1311. Tick.Enabled = cbAxisTickEnabled.Checked;
  1312. OnChange();
  1313. }
  1314. private void cbxAxisTickStyle_SelectedIndexChanged(object sender, EventArgs e)
  1315. {
  1316. if (updating)
  1317. return;
  1318. Tick.TickMarkStyle = (TickMarkStyle)cbxAxisTickStyle.SelectedIndex;
  1319. OnChange();
  1320. }
  1321. private void udAxisTickSize_ValueChanged(object sender, EventArgs e)
  1322. {
  1323. if (updating)
  1324. return;
  1325. Tick.Size = (float)udAxisTickSize.Value;
  1326. OnChange();
  1327. }
  1328. private void cbxAxisTickLineColor_ColorSelected(object sender, EventArgs e)
  1329. {
  1330. if (updating)
  1331. return;
  1332. Tick.LineColor = cbxAxisTickLineColor.Color;
  1333. OnChange();
  1334. }
  1335. private void cbxAxisTickLineStyle_SelectedIndexChanged(object sender, EventArgs e)
  1336. {
  1337. if (updating)
  1338. return;
  1339. Tick.LineDashStyle = (ChartDashStyle)cbxAxisTickLineStyle.SelectedIndex;
  1340. OnChange();
  1341. }
  1342. private void udAxisTickLineWidth_ValueChanged(object sender, EventArgs e)
  1343. {
  1344. if (updating)
  1345. return;
  1346. Tick.LineWidth = (int)udAxisTickLineWidth.Value;
  1347. OnChange();
  1348. }
  1349. #endregion
  1350. #region Strips tab
  1351. private void lbAxisStrips_SelectedIndexChanged(object sender, EventArgs e)
  1352. {
  1353. if (updating)
  1354. return;
  1355. UpdateAxisStripControls();
  1356. }
  1357. private void btnAddStrip_Click(object sender, EventArgs e)
  1358. {
  1359. StripLine strip = new StripLine();
  1360. Axis.StripLines.Add(strip);
  1361. lbAxisStrips.Items.Add(Res.Get("Forms,ChartEditor,ChartEditorControl,Axes,Strips,Strip"));
  1362. lbAxisStrips.SelectedIndex = lbAxisStrips.Items.Count - 1;
  1363. OnChange();
  1364. }
  1365. private void btnDeleteStrip_Click(object sender, EventArgs e)
  1366. {
  1367. int index = lbAxisStrips.SelectedIndex;
  1368. lbAxisStrips.Items.RemoveAt(index);
  1369. Axis.StripLines.RemoveAt(index);
  1370. if (index >= lbAxisStrips.Items.Count)
  1371. index--;
  1372. if (index >= 0)
  1373. lbAxisStrips.SelectedIndex = index;
  1374. OnChange();
  1375. }
  1376. private void udStripStart_ValueChanged(object sender, EventArgs e)
  1377. {
  1378. if (updating)
  1379. return;
  1380. Strip.IntervalOffset = (double)udStripStart.Value;
  1381. OnChange();
  1382. }
  1383. private void udStripWidth_ValueChanged(object sender, EventArgs e)
  1384. {
  1385. if (updating)
  1386. return;
  1387. Strip.StripWidth = (double)udStripWidth.Value;
  1388. OnChange();
  1389. }
  1390. private void udStripInterval_ValueChanged(object sender, EventArgs e)
  1391. {
  1392. if (updating)
  1393. return;
  1394. Strip.Interval = (double)udStripInterval.Value;
  1395. OnChange();
  1396. }
  1397. private void cbxStripStartType_SelectedIndexChanged(object sender, EventArgs e)
  1398. {
  1399. if (updating)
  1400. return;
  1401. Strip.IntervalOffsetType = (DateTimeIntervalType)cbxStripStartType.SelectedIndex;
  1402. OnChange();
  1403. }
  1404. private void cbxStripWidthType_SelectedIndexChanged(object sender, EventArgs e)
  1405. {
  1406. if (updating)
  1407. return;
  1408. Strip.StripWidthType = (DateTimeIntervalType)cbxStripWidthType.SelectedIndex;
  1409. OnChange();
  1410. }
  1411. private void cbxStripIntervalType_SelectedIndexChanged(object sender, EventArgs e)
  1412. {
  1413. if (updating)
  1414. return;
  1415. Strip.IntervalType = (DateTimeIntervalType)cbxStripIntervalType.SelectedIndex;
  1416. OnChange();
  1417. }
  1418. private void cbxStripBackColor_ColorSelected(object sender, EventArgs e)
  1419. {
  1420. if (updating)
  1421. return;
  1422. Strip.BackColor = cbxStripBackColor.Color;
  1423. OnChange();
  1424. }
  1425. private void cbxStripSecondaryColor_ColorSelected(object sender, EventArgs e)
  1426. {
  1427. if (updating)
  1428. return;
  1429. Strip.BackSecondaryColor = cbxStripSecondaryColor.Color;
  1430. OnChange();
  1431. }
  1432. private void cbxStripGradient_SelectedIndexChanged(object sender, EventArgs e)
  1433. {
  1434. if (updating)
  1435. return;
  1436. Strip.BackGradientStyle = (GradientStyle)cbxStripGradient.SelectedIndex;
  1437. OnChange();
  1438. }
  1439. private void cbxStripHatchStyle_SelectedIndexChanged(object sender, EventArgs e)
  1440. {
  1441. if (updating)
  1442. return;
  1443. Strip.BackHatchStyle = (ChartHatchStyle)cbxStripHatchStyle.SelectedIndex;
  1444. OnChange();
  1445. }
  1446. private void cbxStripBorderColor_ColorSelected(object sender, EventArgs e)
  1447. {
  1448. if (updating)
  1449. return;
  1450. Strip.BorderColor = cbxStripBorderColor.Color;
  1451. OnChange();
  1452. }
  1453. private void cbxStripBorderStyle_SelectedIndexChanged(object sender, EventArgs e)
  1454. {
  1455. if (updating)
  1456. return;
  1457. Strip.BorderDashStyle = (ChartDashStyle)cbxStripBorderStyle.SelectedIndex;
  1458. OnChange();
  1459. }
  1460. private void udStripBorderWidth_ValueChanged(object sender, EventArgs e)
  1461. {
  1462. if (updating)
  1463. return;
  1464. Strip.BorderWidth = (int)udStripBorderWidth.Value;
  1465. OnChange();
  1466. }
  1467. private void tbStripText_Leave(object sender, EventArgs e)
  1468. {
  1469. if (updating)
  1470. return;
  1471. Strip.Text = tbStripText.Text;
  1472. OnChange();
  1473. }
  1474. private void tbStripTextFont_ButtonClick(object sender, EventArgs e)
  1475. {
  1476. using (FontDialog dialog = new FontDialog())
  1477. {
  1478. dialog.Font = Strip.Font;
  1479. if (dialog.ShowDialog() == DialogResult.OK)
  1480. {
  1481. Strip.Font = dialog.Font;
  1482. tbStripTextFont.Text = Converter.ToString(dialog.Font);
  1483. OnChange();
  1484. }
  1485. }
  1486. }
  1487. private void cbxStripTextForeColor_ColorSelected(object sender, EventArgs e)
  1488. {
  1489. if (updating)
  1490. return;
  1491. Strip.ForeColor = cbxStripTextForeColor.Color;
  1492. OnChange();
  1493. }
  1494. private void cbxStripTextHorzAlign_SelectedIndexChanged(object sender, EventArgs e)
  1495. {
  1496. if (updating)
  1497. return;
  1498. Strip.TextAlignment = (StringAlignment)cbxStripTextHorzAlign.SelectedIndex;
  1499. OnChange();
  1500. }
  1501. private void cbxStripTextVertAlign_SelectedIndexChanged(object sender, EventArgs e)
  1502. {
  1503. if (updating)
  1504. return;
  1505. Strip.TextLineAlignment = (StringAlignment)cbxStripTextVertAlign.SelectedIndex;
  1506. OnChange();
  1507. }
  1508. private void cbxStripTextOrientation_SelectedIndexChanged(object sender, EventArgs e)
  1509. {
  1510. if (updating)
  1511. return;
  1512. Strip.TextOrientation = (TextOrientation)cbxStripTextOrientation.SelectedIndex;
  1513. OnChange();
  1514. }
  1515. #endregion
  1516. #endregion
  1517. #region Legend tab
  1518. private void cbLegendEnabled_CheckedChanged(object sender, EventArgs e)
  1519. {
  1520. if (updating)
  1521. return;
  1522. Legend.Enabled = cbLegendEnabled.Checked;
  1523. OnChange();
  1524. }
  1525. private void cbxLegendStyle_SelectedIndexChanged(object sender, EventArgs e)
  1526. {
  1527. if (updating)
  1528. return;
  1529. Legend.LegendStyle = (LegendStyle)cbxLegendStyle.SelectedIndex;
  1530. OnChange();
  1531. }
  1532. private void btnL12_Click(object sender, EventArgs e)
  1533. {
  1534. if (updating)
  1535. return;
  1536. int dock = int.Parse((sender as Button).Tag.ToString());
  1537. Legend.Docking = (Docking)(dock / 3);
  1538. Legend.Alignment = (StringAlignment)(dock % 3);
  1539. UpdateLegendDockButtons();
  1540. OnChange();
  1541. }
  1542. private void cbLegendInsideChartArea_CheckedChanged(object sender, EventArgs e)
  1543. {
  1544. if (updating)
  1545. return;
  1546. Legend.IsDockedInsideChartArea = cbLegendInsideChartArea.Checked;
  1547. Legend.DockedToChartArea = Legend.IsDockedInsideChartArea ? "Default" : "";
  1548. OnChange();
  1549. }
  1550. private void cbxLegendBackColor_ColorSelected(object sender, EventArgs e)
  1551. {
  1552. if (updating)
  1553. return;
  1554. Legend.BackColor = cbxLegendBackColor.Color;
  1555. OnChange();
  1556. }
  1557. private void cbxLegendSecondaryColor_ColorSelected(object sender, EventArgs e)
  1558. {
  1559. if (updating)
  1560. return;
  1561. Legend.BackSecondaryColor = cbxLegendSecondaryColor.Color;
  1562. OnChange();
  1563. }
  1564. private void cbxLegendGradient_SelectedIndexChanged(object sender, EventArgs e)
  1565. {
  1566. if (updating)
  1567. return;
  1568. Legend.BackGradientStyle = (GradientStyle)cbxLegendGradient.SelectedIndex;
  1569. OnChange();
  1570. }
  1571. private void cbxLegendHatchStyle_SelectedIndexChanged(object sender, EventArgs e)
  1572. {
  1573. if (updating)
  1574. return;
  1575. Legend.BackHatchStyle = (ChartHatchStyle)cbxLegendHatchStyle.SelectedIndex;
  1576. OnChange();
  1577. }
  1578. private void cbxLegendBorderColor_ColorSelected(object sender, EventArgs e)
  1579. {
  1580. if (updating)
  1581. return;
  1582. Legend.BorderColor = cbxLegendBorderColor.Color;
  1583. OnChange();
  1584. }
  1585. private void cbxLegendBorderStyle_SelectedIndexChanged(object sender, EventArgs e)
  1586. {
  1587. if (updating)
  1588. return;
  1589. Legend.BorderDashStyle = (ChartDashStyle)cbxLegendBorderStyle.SelectedIndex;
  1590. OnChange();
  1591. }
  1592. private void udLegendBorderWidth_ValueChanged(object sender, EventArgs e)
  1593. {
  1594. if (updating)
  1595. return;
  1596. Legend.BorderWidth = (int)udLegendBorderWidth.Value;
  1597. OnChange();
  1598. }
  1599. private void cbxLegendShadowColor_ColorSelected(object sender, EventArgs e)
  1600. {
  1601. if (updating)
  1602. return;
  1603. Legend.ShadowColor = cbxLegendShadowColor.Color;
  1604. OnChange();
  1605. }
  1606. private void udLegendShadowOffset_ValueChanged(object sender, EventArgs e)
  1607. {
  1608. if (updating)
  1609. return;
  1610. Legend.ShadowOffset = (int)udLegendShadowOffset.Value;
  1611. OnChange();
  1612. }
  1613. private void tbLegendFont_ButtonClick(object sender, EventArgs e)
  1614. {
  1615. using (FontDialog dialog = new FontDialog())
  1616. {
  1617. dialog.Font = Legend.Font;
  1618. if (dialog.ShowDialog() == DialogResult.OK)
  1619. {
  1620. Legend.Font = dialog.Font;
  1621. tbLegendFont.Text = Converter.ToString(dialog.Font);
  1622. OnChange();
  1623. }
  1624. }
  1625. }
  1626. private void cbxLegendForeColor_ColorSelected(object sender, EventArgs e)
  1627. {
  1628. if (updating)
  1629. return;
  1630. Legend.ForeColor = cbxLegendForeColor.Color;
  1631. OnChange();
  1632. }
  1633. #endregion
  1634. #region Title tab
  1635. private void lblTitleVisible_CheckedChanged(object sender, EventArgs e)
  1636. {
  1637. if (updating)
  1638. return;
  1639. Title.Visible = cbTitleVisible.Checked;
  1640. OnChange();
  1641. }
  1642. private void tbTitleText_Leave(object sender, EventArgs e)
  1643. {
  1644. if (updating)
  1645. return;
  1646. Title.Text = tbTitleText.Text;
  1647. OnChange();
  1648. }
  1649. private void cbxTitleTextOrientation_SelectedIndexChanged(object sender, EventArgs e)
  1650. {
  1651. if (updating)
  1652. return;
  1653. Title.TextOrientation = (TextOrientation)cbxTitleTextOrientation.SelectedIndex;
  1654. OnChange();
  1655. }
  1656. private void cbxTitleTextStyle_SelectedIndexChanged(object sender, EventArgs e)
  1657. {
  1658. if (updating)
  1659. return;
  1660. Title.TextStyle = (TextStyle)cbxTitleTextStyle.SelectedIndex;
  1661. OnChange();
  1662. }
  1663. private void btnT12_Click(object sender, EventArgs e)
  1664. {
  1665. if (updating)
  1666. return;
  1667. int dock = int.Parse((sender as Button).Tag.ToString());
  1668. Title.Docking = (Docking)(dock / 3);
  1669. switch (dock % 3)
  1670. {
  1671. case 0:
  1672. Title.Alignment = ContentAlignment.TopLeft;
  1673. break;
  1674. case 1:
  1675. Title.Alignment = ContentAlignment.TopCenter;
  1676. break;
  1677. case 2:
  1678. Title.Alignment = ContentAlignment.TopRight;
  1679. break;
  1680. }
  1681. UpdateTitleDockButtons();
  1682. OnChange();
  1683. }
  1684. private void cbTitleDockInsideChartArea_CheckedChanged(object sender, EventArgs e)
  1685. {
  1686. if (updating)
  1687. return;
  1688. Title.IsDockedInsideChartArea = cbTitleInsideChartArea.Checked;
  1689. Title.DockedToChartArea = Title.IsDockedInsideChartArea ? "Default" : "";
  1690. OnChange();
  1691. }
  1692. private void cbxTitleBackColor_ColorSelected(object sender, EventArgs e)
  1693. {
  1694. if (updating)
  1695. return;
  1696. Title.BackColor = cbxTitleBackColor.Color;
  1697. OnChange();
  1698. }
  1699. private void cbxTitleSecondaryColor_ColorSelected(object sender, EventArgs e)
  1700. {
  1701. if (updating)
  1702. return;
  1703. Title.BackSecondaryColor = cbxTitleSecondaryColor.Color;
  1704. OnChange();
  1705. }
  1706. private void cbxTitleGradient_SelectedIndexChanged(object sender, EventArgs e)
  1707. {
  1708. if (updating)
  1709. return;
  1710. Title.BackGradientStyle = (GradientStyle)cbxTitleGradient.SelectedIndex;
  1711. OnChange();
  1712. }
  1713. private void cbxTitleHatchStyle_SelectedIndexChanged(object sender, EventArgs e)
  1714. {
  1715. if (updating)
  1716. return;
  1717. Title.BackHatchStyle = (ChartHatchStyle)cbxTitleHatchStyle.SelectedIndex;
  1718. OnChange();
  1719. }
  1720. private void cbxTitleBorderColor_ColorSelected(object sender, EventArgs e)
  1721. {
  1722. if (updating)
  1723. return;
  1724. Title.BorderColor = cbxTitleBorderColor.Color;
  1725. OnChange();
  1726. }
  1727. private void cbxTitleBorderStyle_SelectedIndexChanged(object sender, EventArgs e)
  1728. {
  1729. if (updating)
  1730. return;
  1731. Title.BorderDashStyle = (ChartDashStyle)cbxTitleBorderStyle.SelectedIndex;
  1732. OnChange();
  1733. }
  1734. private void udTitleBorderWidth_ValueChanged(object sender, EventArgs e)
  1735. {
  1736. if (updating)
  1737. return;
  1738. Title.BorderWidth = (int)udTitleBorderWidth.Value;
  1739. OnChange();
  1740. }
  1741. private void cbxTitleShadowColor_ColorSelected(object sender, EventArgs e)
  1742. {
  1743. if (updating)
  1744. return;
  1745. Title.ShadowColor = cbxTitleShadowColor.Color;
  1746. OnChange();
  1747. }
  1748. private void udTitleShadowOffset_ValueChanged(object sender, EventArgs e)
  1749. {
  1750. if (updating)
  1751. return;
  1752. Title.ShadowOffset = (int)udTitleShadowOffset.Value;
  1753. OnChange();
  1754. }
  1755. private void tbTitleFont_ButtonClick(object sender, EventArgs e)
  1756. {
  1757. using (FontDialog dialog = new FontDialog())
  1758. {
  1759. dialog.Font = Title.Font;
  1760. if (dialog.ShowDialog() == DialogResult.OK)
  1761. {
  1762. Title.Font = dialog.Font;
  1763. tbTitleFont.Text = Converter.ToString(dialog.Font);
  1764. OnChange();
  1765. }
  1766. }
  1767. }
  1768. private void cbxTitleForeColor_ColorSelected(object sender, EventArgs e)
  1769. {
  1770. if (updating)
  1771. return;
  1772. Title.ForeColor = cbxTitleForeColor.Color;
  1773. OnChange();
  1774. }
  1775. #endregion
  1776. private void cbForceAutoSeries_Leave(object sender, EventArgs e)
  1777. {
  1778. Chart.AutoSeriesForce = cbAutoSeriesForce.Checked;
  1779. OnChange();
  1780. }
  1781. }
  1782. }