質問編集履歴

1

楕円部分のコーディングを修正

2019/07/06 14:25

投稿

dem0nmichik0
dem0nmichik0

スコア37

test CHANGED
File without changes
test CHANGED
@@ -324,6 +324,42 @@
324
324
 
325
325
  with Canvas do begin
326
326
 
327
+ // フォームのColor色で塗りつぶし
328
+
329
+ Brush.Color:= Color;
330
+
331
+ Brush.Style:= bsSolid;
332
+
333
+ FillRect(Rect(Left, Top, (Left+Width), (Top+Height)));
334
+
335
+ // ↓の図形内部の色を決めるBrushに何を書けばいいかわからない
336
+
337
+ Brush.Color:= Brush.Color;
338
+
339
+ Brush.Style:= bsSolid;
340
+
341
+ // 黒色で太さ1で枠線描画
342
+
343
+ Pen.Color:= clBlack;
344
+
345
+ Pen.Style:= psSolid;
346
+
347
+ Pen.Width:= 1;
348
+
349
+ Ellipse(Left, Top, (Left+Width), (Top+Height));
350
+
351
+ end;
352
+
353
+ end
354
+
355
+ // 角の丸い四角形の場合
356
+
357
+ else if FShape = stRoundRect then
358
+
359
+ begin
360
+
361
+ with Canvas do begin
362
+
327
363
  // 白色で塗りつぶし
328
364
 
329
365
  Brush.Color:= clWhite;
@@ -346,20 +382,28 @@
346
382
 
347
383
  Pen.Width:= 1;
348
384
 
349
- Ellipse(Left, Top, (Left+Width), (Top+Height));
385
+ RoundRect(Left, Top, Width, Height, 50, 50);
350
386
 
351
387
  end;
352
388
 
353
389
  end
354
390
 
355
- // 角の丸い四角形の場合
391
+ // 角の丸い正方形の場合
356
-
392
+
357
- else if FShape = stRoundRect then
393
+ else if FShape = stRoundSquare then
358
394
 
359
395
  begin
360
396
 
361
397
  with Canvas do begin
362
398
 
399
+ if Width <> Height then
400
+
401
+ begin
402
+
403
+ Height:= Width;
404
+
405
+ end;
406
+
363
407
  // 白色で塗りつぶし
364
408
 
365
409
  Brush.Color:= clWhite;
@@ -388,9 +432,9 @@
388
432
 
389
433
  end
390
434
 
391
- // 角の丸い正方形の場合
435
+ // 正方形の場合
392
-
436
+
393
- else if FShape = stRoundSquare then
437
+ else if FShape = stSquare then
394
438
 
395
439
  begin
396
440
 
@@ -406,18 +450,12 @@
406
450
 
407
451
  // 白色で塗りつぶし
408
452
 
409
- Brush.Color:= clWhite;
410
-
411
- Brush.Style:= bsSolid;
412
-
413
- FillRect(Rect(Left, Top, (Left+Width), (Top+Height)));
414
-
415
- // Color色で塗りつぶし
416
-
417
453
  Brush.Color:= Color;
418
454
 
419
455
  Brush.Style:= bsSolid;
420
456
 
457
+ FillRect(Rect(0, 0, Width, Height));
458
+
421
459
  // 黒色で太さ1で枠線描画
422
460
 
423
461
  Pen.Color:= clBlack;
@@ -426,48 +464,10 @@
426
464
 
427
465
  Pen.Width:= 1;
428
466
 
429
- RoundRect(Left, Top, Width, Height, 50, 50);
467
+ Rectangle(Rect(0, 0, Width, Height));
430
468
 
431
469
  end;
432
470
 
433
- end
434
-
435
- // 正方形の場合
436
-
437
- else if FShape = stSquare then
438
-
439
- begin
440
-
441
- with Canvas do begin
442
-
443
- if Width <> Height then
444
-
445
- begin
446
-
447
- Height:= Width;
448
-
449
- end;
450
-
451
- // 白色で塗りつぶし
452
-
453
- Brush.Color:= Color;
454
-
455
- Brush.Style:= bsSolid;
456
-
457
- FillRect(Rect(0, 0, Width, Height));
458
-
459
- // 黒色で太さ1で枠線描画
460
-
461
- Pen.Color:= clBlack;
462
-
463
- Pen.Style:= psSolid;
464
-
465
- Pen.Width:= 1;
466
-
467
- Rectangle(Rect(0, 0, Width, Height));
468
-
469
- end;
470
-
471
471
  end;
472
472
 
473
473
  end;